IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
assert_connected_to_cells.m
Go to the documentation of this file.
1 %>@ingroup ioio sheware assert
2 %>@file
3 %>@brief Checks connection, tries to connect to MySQL database usign if not connected
4 %>
5 %> Database specification in the DB global
6 %>
9 db_assert();
10 flag_error = 0;
11 try
12  a = mym('status');
13 catch ME %#ok<NASGU>
14  % Tolerates one error, but only one
15  flag_error = 1;
16 end;
17 
18 if flag_error || a ~= 0;
20 else
21  a = mym('select database()');
22  if isempty(a) || isempty(a.('database()'))
23  % It is connected to server, but database is not selected
24  mym('close');
26  else
27  b = a.('database()');
28  if isempty(b{1})
29  mym('close');
31  end;
32  end;
33 end;
34 
function connect_to_cells()
function db_assert()
function irquery(in varargin)
function assert_connected_to_cells()