https://github.com/root-project/root
Raw File
Tip revision: 432cba63e3322322a4347c28407c55a535f9f9b7 authored by Unknown Author on 11 March 2003, 16:59:48 UTC
This commit was manufactured by cvs2svn to create tag 'v3-05-03'.
Tip revision: 432cba6
sqlcreatedb.C
void createdb()
{
   // Create a runcatalog table in a MySQL test database.
   
   // read in runcatalog table definition
   FILE *fp = fopen("runcatalog.sql", "r");
   const char sql[4096];
   fread(sql, 1, 4096, fp);
   fclose(fp);
   
   // open connection to MySQL server on localhost
   TSQLServer *db = TSQLServer::Connect("mysql://localhost/test", "nobody", "");
   
   TSQLResult *res;

   // create new table (delete old one first if exists)
   res = db->Query("DROP TABLE runcatalog");
   delete res;
   
   res = db->Query(sql);
   delete res;
   
   delete db;
}
back to top