source: MML/trunk/applications/database/mym/utilities/tblist.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 749 bytes
Line 
1function[names] = tblist(varargin)
2% TBLIST    List tables in a MySQL database
3% INPUTS  : DBASE - database name, string (optional, current database default)
4% OUTPUTS : NAMES - list of table names, (m x 1) cell array
5% EXAMPLE : tblist('project1')       
6% AUTHOR  : Dimitri Shvorob, dimitri.shvorob@vanderbilt.edu, 8/7/06
7error(nargchk(0,1,nargin))
8if ~mycheck
9   error('No MySQL instance detected. Use MYOPEN to connect.')
10end
11if nargin
12   dbase  = varargin{1};
13else   
14   dbase = dbcurr;
15   if isempty(dbcurr)
16      error('No database currently selected. Use DBOPEN to open a database.')
17   end
18end
19try
20   names = mym(['show tables in ' dbase]);
21catch
22   error(['Database ' dbase ' not found. Use DBLIST to list available databases.'])
23end
Note: See TracBrowser for help on using the repository browser.