DBCreateTables - Create tables in existing database. Create figure and variable tables in an existing database. If you have admin rights to the database server, use <a href="matlab:help DBCreate">DBCreate</a> instead. Otherwise ask the DBA to create an empty database with the appropriate access rights, and then use DBCreateTables to create the actual tables in the database. USAGE DBCreateTables(database) database database name SEE See also DBCreate.
0001 function DBCreateTables(database) 0002 0003 %DBCreateTables - Create tables in existing database. 0004 % 0005 % Create figure and variable tables in an existing database. If you 0006 % have admin rights to the database server, use <a href="matlab:help DBCreate">DBCreate</a> instead. 0007 % Otherwise ask the DBA to create an empty database with the appropriate 0008 % access rights, and then use DBCreateTables to create the actual tables 0009 % in the database. 0010 % 0011 % USAGE 0012 % 0013 % DBCreateTables(database) 0014 % 0015 % database database name 0016 % 0017 % SEE 0018 % 0019 % See also DBCreate. 0020 % 0021 0022 % Copyright (C) 2007-2013 by Michaël Zugaro 0023 % 0024 % This program is free software; you can redistribute it and/or modify 0025 % it under the terms of the GNU General Public License as published by 0026 % the Free Software Foundation; either version 3 of the License, or 0027 % (at your option) any later version. 0028 0029 % Make sure MyM is installed and functional 0030 CheckMyM; 0031 0032 % Check parameters 0033 if nargin < 1, 0034 error('Incorrect number of parameters (type ''help <a href="matlab:help DBCreateTables">DBCreateTables</a>'' for details).'); 0035 end 0036 if ~isastring(database), 0037 error('Incorrect database name (type ''help <a href="matlab:help DBCreateTables">DBCreateTables</a>'' for details).'); 0038 end 0039 0040 h = mym(['use ' database]); 0041 0042 try 0043 h = mym('create table figures (eid varchar(50),name varchar(100),comments varchar(255),parameters varchar(50),mfiles mediumblob,code mediumblob,date varchar(50),user varchar(15),md5 varchar(32),gid smallint unsigned,fig mediumblob,png mediumblob,primary key (eid,name));'); 0044 h = mym('create table variables (eid varchar(50),name varchar(100),comments varchar(255),parameters varchar(50),mfiles mediumblob,code mediumblob,date varchar(50),user varchar(15),md5 varchar(32),gid smallint unsigned,v longblob,primary key (eid,name));'); 0045 catch 0046 error(['Could not create tables in ''' database '''.']); 0047 end