Home > FMAToolbox > Database > DBUse.m

DBUse

PURPOSE ^

DBUse - Set (or determine) current database.

SYNOPSIS ^

function database = DBUse(database)

DESCRIPTION ^

DBUse - Set (or determine) current database.

 Set (or determine) current database to store/retrieve processed data.

  USAGE

    DBUse(database)
    database = DBUse()

    database           database name

  SEE

    See also DBConnect.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function database = DBUse(database)
0002 
0003 %DBUse - Set (or determine) current database.
0004 %
0005 % Set (or determine) current database to store/retrieve processed data.
0006 %
0007 %  USAGE
0008 %
0009 %    DBUse(database)
0010 %    database = DBUse()
0011 %
0012 %    database           database name
0013 %
0014 %  SEE
0015 %
0016 %    See also DBConnect.
0017 %
0018 
0019 % Copyright (C) 2007-2012 by Michaƫl Zugaro
0020 %
0021 % This program is free software; you can redistribute it and/or modify
0022 % it under the terms of the GNU General Public License as published by
0023 % the Free Software Foundation; either version 3 of the License, or
0024 % (at your option) any later version.
0025 
0026 % Make sure MyM is installed and functional
0027 CheckMyM;
0028 
0029 if nargin == 0,
0030     try
0031         h = mym('select database();');
0032     catch
0033         error(['Could not determine current database (check DB server connection).']);
0034     end
0035     database = getfield(h,'database()');
0036     database = database{1};
0037 else
0038     try
0039         h = mym(['use ' database]);
0040     catch
0041         error(['Could not open database ''' database '''.']);
0042     end
0043 end

Generated on Fri 16-Mar-2018 13:00:20 by m2html © 2005