#include "FERODBFieldPositions.h" #include "DBQueryCreator.h" #include "OracleDB.h" #include "MysqlDB.h" #include #include #include #include #include int main( int argc, char** argv ) { uint32_t fdbSystem = 1; //FERODBFieldPositions *fp; //DBQueryCreator *dbq = NULL; AnyDB *db; if(fdbSystem == 0) { cout << "Trying to connect to mysql via: db->connect(\"localhost\", \"rbramm\", \"DimOTdb\", \"TPC\");" << endl; // dbq = new DBQueryCreator("mysql" ); db = new MysqlDB(); db->connect("localhost", "rbramm", "DimOTdb", "TPC"); } else if(fdbSystem == 1) { cout << "Trying to connect to oracle via: db->connect(\"rbramm\", \"DimOTdb\", \"orcl\");" << endl; // dbq = new DBQueryCreator("oracle" ); db = new OracleDB(); db->connect("rbramm","DimOTdb","orcl"); } else if(fdbSystem == 2) { cout << "Trying to connect to oracle via: db->connect(\"tpccfg\", \"tpc\", \"ALDCS031\");" << endl; // dbq = new DBQueryCreator("oracle" ); db = new OracleDB(); db->connect("tpccfg","tpc","ALDCS031"); } if(db->isConnected() == true){ cout << "successfully connected " << endl; }else{ cout << "Error :: Not connected !!" << endl; } db->calcRowCount("Select * from TPC WHERE tpc.\"id\"= 2"); db->executeQuery("Select * from TPC WHERE tpc.\"id\"= 2"); db->cacheResult(); cout << "Got " << db->getRowCount() << " Rows " << endl; for(int32_t rowCounter = 0; rowCounter < db->getRowCount(); rowCounter++) { db->getRow(); cout << setw(3) << rowCounter << ") Found Configuration ID = " << db->getRowValueAsInt(0) << endl; cout << " Configuration created at: " << db->getRowValueDateAsString(1) << endl; cout << " Configuration used from: " << db->getRowValueDateAsString(2) << endl; cout << " Configuration obsolete at: " << db->getRowValueDateAsString(3) << endl; cout << " Configuration Table Revision: " << db->getRowValueAsInt(4) << endl; cout << " Configuration Comment: " << db->getRowValueAsString(5) << endl << endl; } db->freeResult(); db->disconnect(); if(db->isConnected() == true){ cout << "successfully connected " << endl; }else{ cout << "Error :: Not connected !!" << endl; } cout << "delete db" << endl; delete db; cout << "Next connection" << endl; if(fdbSystem == 0) { cout << "Trying to connect to mysql via: db->connect(\"localhost\", \"rbramm\", \"DimOTdb\", \"TPC\");" << endl; // dbq = new DBQueryCreator("mysql" ); db = new MysqlDB(); db->connect("localhost", "rbramm", "DimOTdb", "TPC"); } else if(fdbSystem == 1) { cout << "Trying to connect to oracle via: db->connect(\"rbramm\", \"DimOTdb\", \"orcl\");" << endl; // dbq = new DBQueryCreator("oracle" ); db = new OracleDB(); db->connect("rbramm","DimOTdb","orcl"); } else if(fdbSystem == 2) { cout << "Trying to connect to oracle via: db->connect(\"tpccfg\", \"tpc\", \"ALDCS031\");" << endl; // dbq = new DBQueryCreator("oracle" ); db = new OracleDB(); db->connect("tpccfg","tpc","ALDCS031"); } if(db->isConnected() == true){ cout << "successfully connected " << endl; }else{ cout << "Error :: Not connected !!" << endl; return -1; } db->calcRowCount("Select * from TPC WHERE tpc.\"id\"= 1"); db->executeQuery("Select * from TPC WHERE tpc.\"id\"= 1"); db->cacheResult(); cout << "Got " << db->getRowCount() << " Rows " << endl; for(int32_t rowCounter = 0; rowCounter < db->getRowCount(); rowCounter++) { db->getRow(); cout << setw(3) << rowCounter << ") Found Configuration ID = " << db->getRowValueAsInt(0) << endl; cout << " Configuration created at: " << db->getRowValueDateAsString(1) << endl; cout << " Configuration used from: " << db->getRowValueDateAsString(2) << endl; cout << " Configuration obsolete at: " << db->getRowValueDateAsString(3) << endl; cout << " Configuration Table Revision: " << db->getRowValueAsInt(4) << endl; cout << " Configuration Comment: " << db->getRowValueAsString(5) << endl << endl; } db->freeResult(); db->disconnect(); if(db->isConnected() == true){ cout << "successfully connected " << endl; }else{ cout << "Error :: Not connected !!" << endl; } cout << "delete db" << endl; delete db; }