Logo ROOT  
Reference Guide
sqlcreatedb.C File Reference

Detailed Description

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;
}
Author
Sergey Linev

Definition in file sqlcreatedb.C.

TSQLResult
Definition: TSQLResult.h:32
TSQLServer::Connect
static TSQLServer * Connect(const char *db, const char *uid, const char *pw)
The db should be of the form: <dbms>://<host>[:<port>][/<database>], e.g.
Definition: TSQLServer.cxx:61
TSQLServer::Query
virtual TSQLResult * Query(const char *sql)=0
sqlcreatedb
Definition: sqlcreatedb.py:1
TSQLServer
Definition: TSQLServer.h:41