//*-- AUTHOR : Ilse Koenig //*-- Modified : 25/08/99 ////////////////////////////////////////////////////////////////////////////// // HOraUtil // // Utility class for I/O from database Oracle // ////////////////////////////////////////////////////////////////////////////// #include "horautil.h" #include "horaconn.h" #include #include "iodbc.h" #include "udbcext.h" #include "isql.h" #include "isqlext.h" ClassImp(HOraUtil) HOraUtil::HOraUtil(HOraConn* p) { // constructor // gets the pointer to the connection class pConn=p; } void HOraUtil::printOdbcDriverInfo() { // prints information about the ODBC driver void* hdbc=pConn->getHdbc(); if (!hdbc) { cerr<<"no connection to database"; return; } char buffer[512]; SWORD bufferlength; RETCODE rc= SQLGetInfo(hdbc,SQL_DRIVER_VER,buffer,sizeof(buffer),&bufferlength); if (rc!=SQL_SUCCESS && rc!=SQL_SUCCESS_WITH_INFO) { pConn->showErrorMessage("HOraUtil::printOdbcDriverInfo()"); return; } cout<<"SQL_DRIVER_VER "<showErrorMessage("HOraUtil::printOdbcDriverInfo()"); return; } cout<<"SQL_DRIVER_ODBC_VER "<getHdbc(); if (!hdbc) { cerr<<"no connection to database"; return; } // test for not supported functions Int_t i1[]={1,40}; Int_t i2[]={23,72}; UWORD fExists; RETCODE rc; cout<<"Functions supported by the ODBC driver"<<'\n'; for(Int_t j=0;j<2;j++) { for(Int_t i=i1[j];i<=i2[j];i++) { fExists=0; rc=SQLGetFunctions(hdbc,(UWORD)i,&fExists); if (rc!=SQL_SUCCESS && rc!=SQL_SUCCESS_WITH_INFO) { pConn->showErrorMessage("HOraUtil::printOdbcFunctionInfo()"); return; } if (fExists!=0) { switch(i) { case 1: { cout<getHstmt(); if (!hstmt) { cerr<<"no connection to database"; return kFALSE; } char statement[]= "select p3d_corner, P3D_X, P3D_Y, P3D_Z from hades_geom.geom_3dpoints " "where OBJ_INDEX=8 and vers_index=2 and p3d_corner>0 " "order by p3d_corner"; #define POINTS_AS 12 long np[POINTS_AS]; double x[POINTS_AS], y[POINTS_AS], z[POINTS_AS]; SDWORD np_Ind[POINTS_AS], x_Ind[POINTS_AS], y_Ind[POINTS_AS], z_Ind[POINTS_AS]; UDWORD numRows; UWORD rowStatus[POINTS_AS]; RETCODE rc; for(int i=0;ishowErrorMessage("HOraTest::testExtendedFetch"); cout<