#ifndef __CINT__ #include #include #include #endif void allrunlist() { const char* dbname = "mysql://jmysql/hapvdis"; const char* username = "hapvdis"; const char* userpass = "to<9uLkp"; TSQLServer *db = TSQLServer::Connect(dbname, username, userpass); printf("Server info: %s\n", db->ServerInfo()); cout<<"Database is: "<GetDB()<GetHost()<GetDataBases(); // while ((row = res->Next())) { // cout<GetField(0)<GetTables("hapvdis"); // while ((row = res->Next())) { // cout<GetField(0)<GetColumns("hapvdis", "runlist"); // while ((row = res->Next())){ // cout<GetField(0)<Query(sql); const Int_t nrows = res->GetRowCount(); cout<<"total rows: "<GetFieldCount(); // for (Int_t i = 0; i < nfields; i++) // cout<GetFieldName(i)<<"\t"; // cout<Next(); runnum[i] = atoi(row->GetField(0)); slugnum[i] = atoi(row->GetField(1)); prod[i] = atoi(row->GetField(2)); HWP[i] = atoi(row->GetField(3)); // cout<GetField(j)<<"\t"; // } delete row; } delete res; for (Int_t i = 0; i < nrows; i++) { TString sqltmp = "select leftlow, lefthigh, rightlow, righthigh from cutlist where run_num = "; sqltmp += runnum[i]; res = db->Query(sqltmp); if (res->GetRowCount() != 1) cout<<"Warning::query from cutlist returns not a single entry: runnum: "<GetRowCount()<Next(); leftlow[i] = atoi(row->GetField(0)); lefthigh[i] = atoi(row->GetField(1)); rightlow[i] = atoi(row->GetField(2)); righthigh[i] = atoi(row->GetField(3)); delete row; delete res; } for (Int_t i = 0; i < nrows; i++) { if (prod[i]) { out<