void sqlselect()
{
printf(
"\nList all databases on server %s\n", db->
GetHost());
while ((row = res->Next())) {
printf("%s\n", row->GetField(0));
delete row;
}
delete res;
printf("\nList all tables in database \"test\" on server %s\n",
while ((row = res->Next())) {
printf("%s\n", row->GetField(0));
delete row;
}
delete res;
printf("\nList all columns in table \"runcatalog\" in database \"test\" on server %s\n",
while ((row = res->Next())) {
printf("%s\n", row->GetField(0));
delete row;
}
delete res;
const char *sql = "select dataset,rawfilepath from test.runcatalog "
"WHERE tag&(1<<2) AND (run=490001 OR run=300122)";
printf("\nGot %d rows in result\n", nrows);
int nfields = res->GetFieldCount();
for (int i = 0; i < nfields; i++)
printf("%40s", res->GetFieldName(i));
printf("\n");
for (int i = 0; i < nfields*40; i++)
printf("=");
printf("\n");
for (int i = 0; i < nrows; i++) {
row = res->Next();
for (int j = 0; j < nfields; j++) {
printf("%40s", row->GetField(j));
}
printf("\n");
delete row;
}
delete res;
delete db;
printf("\nRealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime);
}