00001 void sqlcreatedb() 00002 { 00003 // Create a runcatalog table in a MySQL test database. 00004 00005 // read in runcatalog table definition 00006 FILE *fp = fopen("runcatalog.sql", "r"); 00007 const char sql[4096]; 00008 fread(sql, 1, 4096, fp); 00009 fclose(fp); 00010 00011 // open connection to MySQL server on localhost 00012 TSQLServer *db = TSQLServer::Connect("mysql://localhost/test", "nobody", ""); 00013 00014 TSQLResult *res; 00015 00016 // create new table (delete old one first if exists) 00017 res = db->Query("DROP TABLE runcatalog"); 00018 delete res; 00019 00020 res = db->Query(sql); 00021 delete res; 00022 00023 delete db; 00024 }