int main(int argc, char *argv[]) { int option; char opt; option = 0; while((opt = getopt(argc, argv, "hcdf:i:")) != -1) { switch(opt) { case 'h': displayHelp(); option = 1; break; case 'c': createDataBase(); option = 1; break; case 'd': dropDataBase(); option = 1; break; case 'f': launchStatsFile(optarg); option = 1; break; case 'i': launchImport(optarg); break; } } if(option == 0) launchStats(); return 0; }
void RequestHistory::init() { QDir home = QDir::home(); if( !home.exists(".qrestclient") ) { if( !home.mkdir(".qrestclient") ) { throw QObject::tr("Can't create directory. Home directory is not writable"); } } home.cd(".qrestclient"); QString file = home.absolutePath() + "/history.db"; bool bNeedToCreate = !QFile::exists(file); connect(file); if( bNeedToCreate ) { createDataBase(); } else { migrateTo2(); migrateTo3(); } }
void RequestHistory::init() { QDir home = QDir::home(); if(!home.exists(".qrestclient")) { if( !home.mkdir(".qrestclient")) { qDebug() << "Fatal create directory"; return; } } home.cd(".qrestclient"); QString file = home.absolutePath() + "/history.db"; bool bNeedToCreate = !QFile::exists(file); connect(file); if(bNeedToCreate) { createDataBase(); } }
int main(int argc, char **argv) { QCoreApplication app(argc, argv); QSqlDatabase db = createDataBase(":memory:"); if (argc < 2) { // Try stdin QFile in; in.open(stdin, QIODevice::ReadOnly); QByteArray xml = in.readAll(); if (xml.isEmpty()) { qDebug() << "Usage: chart xml-file [xml-file2 xml-file3 ...]"; qDebug() << "See also QTestLib's \"-chart\" option"; return 0; } else { loadXml(xml, QString()); } } QStringList files; for (int i = 1; i < argc; i++) { QString file = QString::fromLocal8Bit(argv[i]); files += file; } if (files.isEmpty() == false) loadXml(files); ReportGenerator reportGenerator; reportGenerator.writeReports(); db.close(); }
void DBFunction(int choice) { string dbName; int dbSize,pageSize; int result; // Add time information for the query... Use start time and end time...... switch(choice) { case 1: cout<<"Creating the database....."<<endl; cout<<"Enter the name of the database to be created: "; cin>>dbName; cout<<endl; cout<<"Do you want to specify the DB file size (default 100MB): "; cin>>dbSize; cout<<endl; cout<<"Do you want to specify the page size (default 2048): "; cin>>pageSize; result = createDataBase(dbSize,pageSize,dbName); break; default: cout<<"Unimplemented operation....."<<endl; cout<<"Contact the developer for the operation...."<<endl; break; } }
int main(int argc, char **argv) { QCoreApplication app(argc, argv); if (argc < 2) { qDebug() << "Usage: generatereport xml-file [xml-file2 xml-file3 ...]"; return 0; } QStringList files; for (int i = 1; i < argc; i++) { QString file = QString::fromLocal8Bit(argv[i]); files += file; qDebug() << "Reading xml from" << file; } QSqlDatabase db = createDataBase(":memory:"); loadXml(files); ReportGenerator reportGenerator; reportGenerator.writeReports(); db.close(); }