From 69a2b59d535d798cc5fe85bda43acdfcf33adccd Mon Sep 17 00:00:00 2001 From: George Tasker Date: Wed, 23 May 2001 13:48:04 +0000 Subject: [PATCH] Removed TABs that had gotten in to the source Added more feature tests to the sample git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10293 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/db/dbtest.cpp | 680 +++++++++++++++++++++--------------------- samples/db/dbtest.h | 5 +- 2 files changed, 345 insertions(+), 340 deletions(-) diff --git a/samples/db/dbtest.cpp b/samples/db/dbtest.cpp index 89b4c14ffb..0cdf4bff85 100644 --- a/samples/db/dbtest.cpp +++ b/samples/db/dbtest.cpp @@ -553,7 +553,7 @@ void DatabaseDemoApp::CreateDataTable(bool recreate) } else { - if (!Contact->CreateIndexes()) + if (!Contact->CreateIndexes(recreate)) { wxEndBusyCursor(); wxString tStr; @@ -615,7 +615,9 @@ void DatabaseDemoFrame::OnRecreateTable(wxCommandEvent& event) void DatabaseDemoFrame::OnRecreateIndexes(wxCommandEvent& event) { - if (!wxGetApp().Contact->CreateIndexes()) + wxGetApp().Contact->GetDb()->RollbackTrans(); // Make sure the current cursor is in a known/stable state + + if (!wxGetApp().Contact->CreateIndexes(true)) { while (wxIsBusy()) wxEndBusyCursor(); @@ -624,7 +626,7 @@ void DatabaseDemoFrame::OnRecreateIndexes(wxCommandEvent& event) tStr += GetExtendedDBErrorMsg(wxGetApp().Contact->GetDb(),__FILE__,__LINE__); wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION); } - else + else wxMessageBox(wxT("Index(es) were successfully recreated."),wxT("Notice..."),wxOK | wxICON_INFORMATION); } // DatabaseDemoFrame::OnRecreateIndexes() @@ -810,7 +812,7 @@ void Ccontact::SetupColumns() } // Ccontact::SetupColumns -bool Ccontact::CreateIndexes(void) +bool Ccontact::CreateIndexes(bool recreate) { // This index could easily be accomplished with an "orderBy" clause, // but is done to show how to construct a non-primary index. @@ -827,7 +829,7 @@ bool Ccontact::CreateIndexes(void) indexName = GetTableName(); indexName += "_IDX1"; - Ok = CreateIndex(indexName.c_str(), TRUE, 2, idxDef); + Ok = CreateIndex(indexName.c_str(), TRUE, 2, idxDef, recreate); return Ok; } // Ccontact::CreateIndexes() @@ -1177,22 +1179,23 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) if (widgetName == pDataTypesBtn->GetName()) { CheckSupportForAllDataTypes(wxGetApp().READONLY_DB); - + wxMessageBox("Support datatypes was dumped to stdout."); return; } // Data types Button if (widgetName == pDbDiagsBtn->GetName()) { -/* -strcpy(wxGetApp().Contact->Addr1,"12345678901234567890"); -//wxString sqlStmt = "UPDATE CONTACTS set ADDRESS1='1234567890ABCEFG' where NAME='12345'"; -//if (wxGetApp().Contact->GetDb()->ExecSql(sqlStmt)) -if (wxGetApp().Contact->UpdateWhere("NAME = '12345'")) -wxGetApp().Contact->GetDb()->CommitTrans(); -else -wxGetApp().Contact->GetDb()->RollbackTrans(); -*/ DisplayDbDiagnostics(wxGetApp().READONLY_DB); + wxMessageBox("Diagnostics info was dumped to stdout."); + return; + } + + if (widgetName == pCatalogBtn->GetName()) + { + if (wxGetApp().Contact->GetDb()->Catalog("","catalog.txt")) + wxMessageBox("The file 'catalog.txt' was created."); + else + wxMessageBox("Creation of the file 'catalog.txt' was failed."); return; } @@ -1247,8 +1250,8 @@ bool CeditorDlg::Initialize() // open the table. if (!wxGetApp().Contact->GetDb()->TablePrivileges(CONTACT_TABLE_NAME, wxT("SELECT"), wxGetApp().Contact->GetDb()->GetUsername(), - wxGetApp().Contact->GetDb()->GetUsername(), - wxGetApp().DbConnectInf->GetDefaultDir())) + wxGetApp().Contact->GetDb()->GetUsername(), + wxGetApp().DbConnectInf->GetDefaultDir())) { wxString tStr; tStr.Printf(wxT("Unable to open the table '%s' (likely due to\ninsufficient privileges of the logged in user).\n\n"),CONTACT_TABLE_NAME); @@ -1322,6 +1325,7 @@ bool CeditorDlg::Initialize() pLinesMsg = new wxStaticText(this, EDITOR_DIALOG_LINES_MSG, wxT("Lines of code:"), wxPoint(303, 380), wxSize( -1, -1), 0, wxT("LinesMsg")); pLinesTxt = new wxTextCtrl(this, EDITOR_DIALOG_LINES_TEXT, wxT(""), wxPoint(303, 397), wxSize(100, 25), 0, wxDefaultValidator, wxT("LinesTxt")); + pCatalogBtn = new wxButton(this, EDITOR_DIALOG_CATALOG, wxT("Catalo&g"), wxPoint(430, 287), wxSize( 70, 35), 0, wxDefaultValidator, wxT("CatalogBtn")); pDataTypesBtn = new wxButton(this, EDITOR_DIALOG_DATATYPES, wxT("Data&types"), wxPoint(430, 337), wxSize( 70, 35), 0, wxDefaultValidator, wxT("DataTypesBtn")); pDbDiagsBtn = new wxButton(this, EDITOR_DIALOG_DB_DIAGS, wxT("DB Dia&gs"), wxPoint(430, 387), wxSize( 70, 35), 0, wxDefaultValidator, wxT("DbDiagsBtn")); @@ -2515,331 +2519,331 @@ bool CqueryDlg::ValidateWhereClause() void DisplayDbDiagnostics(wxDb *pDb) { - wxString s, t; - bool comma = FALSE; - - s = langDBINF_DB_NAME; - s += pDb->dbInf.dbmsName; - s += "\n"; - - s += langDBINF_DB_VER; - s += pDb->dbInf.dbmsVer; - s += "\n"; - - s += langDBINF_DRIVER_NAME; - s += pDb->dbInf.driverName; - s += "\n"; - - s += langDBINF_DRIVER_ODBC_VER; - s += pDb->dbInf.odbcVer; - s += "\n"; - - s += langDBINF_DRIVER_MGR_ODBC_VER; - s += pDb->dbInf.drvMgrOdbcVer; - s += "\n"; - - s += langDBINF_DRIVER_VER; - s += pDb->dbInf.driverVer; - s += "\n"; - - s += langDBINF_SERVER_NAME; - s += pDb->dbInf.serverName; - s += "\n"; - - s += langDBINF_FILENAME; - s += pDb->dbInf.databaseName; - s += "\n"; - - s += langDBINF_OUTER_JOINS; - s += pDb->dbInf.outerJoins; - s += "\n"; - - s += langDBINF_STORED_PROC; - s += pDb->dbInf.procedureSupport; - s += "\n"; - - if (pDb->dbInf.maxConnections) - t.sprintf("%s%d\n", langDBINF_MAX_HDBC, pDb->dbInf.maxConnections); - else - t.sprintf("%s%s\n", langDBINF_MAX_HDBC, langDBINF_UNLIMITED); - s += t; - - if (pDb->dbInf.maxStmts) - t.sprintf("%s%d\n", langDBINF_MAX_HSTMT, pDb->dbInf.maxStmts); - else - t.sprintf("%s%s\n", langDBINF_MAX_HSTMT, langDBINF_UNLIMITED); - s += t; - - s += langDBINF_API_LVL; - switch(pDb->dbInf.apiConfLvl) - { - case SQL_OAC_NONE: s += langDBINF_NONE; break; - case SQL_OAC_LEVEL1: s += langDBINF_LEVEL1; break; - case SQL_OAC_LEVEL2: s += langDBINF_LEVEL2; break; - } - s += "\n"; - - s += langDBINF_CLI_LVL; - switch(pDb->dbInf.cliConfLvl) - { - case SQL_OSCC_NOT_COMPLIANT: s += langDBINF_NOT_COMPLIANT; break; - case SQL_OSCC_COMPLIANT: s += langDBINF_COMPLIANT; break; - } - s += "\n"; - - s += langDBINF_SQL_LVL; - switch(pDb->dbInf.sqlConfLvl) - { - case SQL_OSC_MINIMUM: s += langDBINF_MIN_GRAMMAR; break; - case SQL_OSC_CORE: s += langDBINF_CORE_GRAMMAR; break; - case SQL_OSC_EXTENDED: s += langDBINF_EXT_GRAMMAR; break; - } - s += "\n"; - - s += langDBINF_COMMIT_BEHAVIOR; - switch(pDb->dbInf.cursorCommitBehavior) - { - case SQL_CB_DELETE: s += langDBINF_DELETE_CURSORS; break; - case SQL_CB_CLOSE: s += langDBINF_CLOSE_CURSORS; break; - case SQL_CB_PRESERVE: s += langDBINF_PRESERVE_CURSORS; break; - } - s += "\n"; - - s += langDBINF_ROLLBACK_BEHAVIOR; - switch(pDb->dbInf.cursorRollbackBehavior) - { - case SQL_CB_DELETE: s += langDBINF_DELETE_CURSORS; break; - case SQL_CB_CLOSE: s += langDBINF_CLOSE_CURSORS; break; - case SQL_CB_PRESERVE: s += langDBINF_PRESERVE_CURSORS; break; - } - s += "\n"; - - s += langDBINF_SUPP_NOT_NULL; - switch(pDb->dbInf.supportNotNullClause) - { - case SQL_NNC_NULL: s += langNO; break; - case SQL_NNC_NON_NULL: s += langYES; break; - } - s += "\n"; - - s += langDBINF_SUPP_IEF; - s += pDb->dbInf.supportIEF; - s += "\n"; - - // DEFAULT setting for "Transaction Isolation Level" - s += langDBINF_TXN_ISOLATION; - switch(pDb->dbInf.txnIsolation) - { - case SQL_TXN_READ_UNCOMMITTED: s += langDBINF_READ_UNCOMMITTED; break; - case SQL_TXN_READ_COMMITTED: s += langDBINF_READ_COMMITTED; break; - case SQL_TXN_REPEATABLE_READ: s += langDBINF_REPEATABLE_READ; break; - case SQL_TXN_SERIALIZABLE: s += langDBINF_SERIALIZABLE; break; + wxString s, t; + bool comma = FALSE; + + s = langDBINF_DB_NAME; + s += pDb->dbInf.dbmsName; + s += "\n"; + + s += langDBINF_DB_VER; + s += pDb->dbInf.dbmsVer; + s += "\n"; + + s += langDBINF_DRIVER_NAME; + s += pDb->dbInf.driverName; + s += "\n"; + + s += langDBINF_DRIVER_ODBC_VER; + s += pDb->dbInf.odbcVer; + s += "\n"; + + s += langDBINF_DRIVER_MGR_ODBC_VER; + s += pDb->dbInf.drvMgrOdbcVer; + s += "\n"; + + s += langDBINF_DRIVER_VER; + s += pDb->dbInf.driverVer; + s += "\n"; + + s += langDBINF_SERVER_NAME; + s += pDb->dbInf.serverName; + s += "\n"; + + s += langDBINF_FILENAME; + s += pDb->dbInf.databaseName; + s += "\n"; + + s += langDBINF_OUTER_JOINS; + s += pDb->dbInf.outerJoins; + s += "\n"; + + s += langDBINF_STORED_PROC; + s += pDb->dbInf.procedureSupport; + s += "\n"; + + if (pDb->dbInf.maxConnections) + t.sprintf("%s%d\n", langDBINF_MAX_HDBC, pDb->dbInf.maxConnections); + else + t.sprintf("%s%s\n", langDBINF_MAX_HDBC, langDBINF_UNLIMITED); + s += t; + + if (pDb->dbInf.maxStmts) + t.sprintf("%s%d\n", langDBINF_MAX_HSTMT, pDb->dbInf.maxStmts); + else + t.sprintf("%s%s\n", langDBINF_MAX_HSTMT, langDBINF_UNLIMITED); + s += t; + + s += langDBINF_API_LVL; + switch(pDb->dbInf.apiConfLvl) + { + case SQL_OAC_NONE: s += langDBINF_NONE; break; + case SQL_OAC_LEVEL1: s += langDBINF_LEVEL1; break; + case SQL_OAC_LEVEL2: s += langDBINF_LEVEL2; break; + } + s += "\n"; + + s += langDBINF_CLI_LVL; + switch(pDb->dbInf.cliConfLvl) + { + case SQL_OSCC_NOT_COMPLIANT: s += langDBINF_NOT_COMPLIANT; break; + case SQL_OSCC_COMPLIANT: s += langDBINF_COMPLIANT; break; + } + s += "\n"; + + s += langDBINF_SQL_LVL; + switch(pDb->dbInf.sqlConfLvl) + { + case SQL_OSC_MINIMUM: s += langDBINF_MIN_GRAMMAR; break; + case SQL_OSC_CORE: s += langDBINF_CORE_GRAMMAR; break; + case SQL_OSC_EXTENDED: s += langDBINF_EXT_GRAMMAR; break; + } + s += "\n"; + + s += langDBINF_COMMIT_BEHAVIOR; + switch(pDb->dbInf.cursorCommitBehavior) + { + case SQL_CB_DELETE: s += langDBINF_DELETE_CURSORS; break; + case SQL_CB_CLOSE: s += langDBINF_CLOSE_CURSORS; break; + case SQL_CB_PRESERVE: s += langDBINF_PRESERVE_CURSORS; break; + } + s += "\n"; + + s += langDBINF_ROLLBACK_BEHAVIOR; + switch(pDb->dbInf.cursorRollbackBehavior) + { + case SQL_CB_DELETE: s += langDBINF_DELETE_CURSORS; break; + case SQL_CB_CLOSE: s += langDBINF_CLOSE_CURSORS; break; + case SQL_CB_PRESERVE: s += langDBINF_PRESERVE_CURSORS; break; + } + s += "\n"; + + s += langDBINF_SUPP_NOT_NULL; + switch(pDb->dbInf.supportNotNullClause) + { + case SQL_NNC_NULL: s += langNO; break; + case SQL_NNC_NON_NULL: s += langYES; break; + } + s += "\n"; + + s += langDBINF_SUPP_IEF; + s += pDb->dbInf.supportIEF; + s += "\n"; + + // DEFAULT setting for "Transaction Isolation Level" + s += langDBINF_TXN_ISOLATION; + switch(pDb->dbInf.txnIsolation) + { + case SQL_TXN_READ_UNCOMMITTED: s += langDBINF_READ_UNCOMMITTED; break; + case SQL_TXN_READ_COMMITTED: s += langDBINF_READ_COMMITTED; break; + case SQL_TXN_REPEATABLE_READ: s += langDBINF_REPEATABLE_READ; break; + case SQL_TXN_SERIALIZABLE: s += langDBINF_SERIALIZABLE; break; #ifdef ODBC_V20 - case SQL_TXN_VERSIONING: s += langDBINF_VERSIONING; break; -#endif - } - s += "\n"; - - // CURRENT setting for "Transaction Isolation Level" - long txnIsoLvl; - s += langDBINF_TXN_ISOLATION_CURR; - if (SQLGetConnectOption(pDb->GetHDBC(),SQL_TXN_ISOLATION,&txnIsoLvl) == SQL_SUCCESS) - { - switch(txnIsoLvl) - { - case SQL_TXN_READ_UNCOMMITTED: s += langDBINF_READ_UNCOMMITTED; break; - case SQL_TXN_READ_COMMITTED: s += langDBINF_READ_COMMITTED; break; - case SQL_TXN_REPEATABLE_READ: s += langDBINF_REPEATABLE_READ; break; - case SQL_TXN_SERIALIZABLE: s += langDBINF_SERIALIZABLE; break; + case SQL_TXN_VERSIONING: s += langDBINF_VERSIONING; break; +#endif + } + s += "\n"; + + // CURRENT setting for "Transaction Isolation Level" + long txnIsoLvl; + s += langDBINF_TXN_ISOLATION_CURR; + if (SQLGetConnectOption(pDb->GetHDBC(),SQL_TXN_ISOLATION,&txnIsoLvl) == SQL_SUCCESS) + { + switch(txnIsoLvl) + { + case SQL_TXN_READ_UNCOMMITTED: s += langDBINF_READ_UNCOMMITTED; break; + case SQL_TXN_READ_COMMITTED: s += langDBINF_READ_COMMITTED; break; + case SQL_TXN_REPEATABLE_READ: s += langDBINF_REPEATABLE_READ; break; + case SQL_TXN_SERIALIZABLE: s += langDBINF_SERIALIZABLE; break; #ifdef ODBC_V20 - case SQL_TXN_VERSIONING: s += langDBINF_VERSIONING; break; -#endif - } - } - s += "\n"; - - comma = FALSE; - s += langDBINF_TXN_ISOLATION_OPTS; - if (pDb->dbInf.txnIsolationOptions & SQL_TXN_READ_UNCOMMITTED) - {s += langDBINF_READ_UNCOMMITTED; comma++;} - if (pDb->dbInf.txnIsolationOptions & SQL_TXN_READ_COMMITTED) - {if (comma++) s += ", "; s += langDBINF_READ_COMMITTED;} - if (pDb->dbInf.txnIsolationOptions & SQL_TXN_REPEATABLE_READ) - {if (comma++) s += ", "; s += langDBINF_REPEATABLE_READ;} - if (pDb->dbInf.txnIsolationOptions & SQL_TXN_SERIALIZABLE) - {if (comma++) s += ", "; s += langDBINF_SERIALIZABLE;} + case SQL_TXN_VERSIONING: s += langDBINF_VERSIONING; break; +#endif + } + } + s += "\n"; + + comma = FALSE; + s += langDBINF_TXN_ISOLATION_OPTS; + if (pDb->dbInf.txnIsolationOptions & SQL_TXN_READ_UNCOMMITTED) + {s += langDBINF_READ_UNCOMMITTED; comma++;} + if (pDb->dbInf.txnIsolationOptions & SQL_TXN_READ_COMMITTED) + {if (comma++) s += ", "; s += langDBINF_READ_COMMITTED;} + if (pDb->dbInf.txnIsolationOptions & SQL_TXN_REPEATABLE_READ) + {if (comma++) s += ", "; s += langDBINF_REPEATABLE_READ;} + if (pDb->dbInf.txnIsolationOptions & SQL_TXN_SERIALIZABLE) + {if (comma++) s += ", "; s += langDBINF_SERIALIZABLE;} #ifdef ODBC_V20 - if (pDb->dbInf.txnIsolationOptions & SQL_TXN_VERSIONING) - {if (comma++) s += ", "; s += langDBINF_VERSIONING;} -#endif - s += "\n"; - - comma = FALSE; - s += langDBINF_FETCH_DIRS; - if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_NEXT) - {s += langDBINF_NEXT; comma++;} - if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_PRIOR) - {if (comma++) s += ", "; s += langDBINF_PREV;} - if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_FIRST) - {if (comma++) s += ", "; s += langDBINF_FIRST;} - if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_LAST) - {if (comma++) s += ", "; s += langDBINF_LAST;} - if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_ABSOLUTE) - {if (comma++) s += ", "; s += langDBINF_ABSOLUTE;} - if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_RELATIVE) - {if (comma++) s += ", "; s += langDBINF_RELATIVE;} + if (pDb->dbInf.txnIsolationOptions & SQL_TXN_VERSIONING) + {if (comma++) s += ", "; s += langDBINF_VERSIONING;} +#endif + s += "\n"; + + comma = FALSE; + s += langDBINF_FETCH_DIRS; + if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_NEXT) + {s += langDBINF_NEXT; comma++;} + if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_PRIOR) + {if (comma++) s += ", "; s += langDBINF_PREV;} + if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_FIRST) + {if (comma++) s += ", "; s += langDBINF_FIRST;} + if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_LAST) + {if (comma++) s += ", "; s += langDBINF_LAST;} + if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_ABSOLUTE) + {if (comma++) s += ", "; s += langDBINF_ABSOLUTE;} + if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_RELATIVE) + {if (comma++) s += ", "; s += langDBINF_RELATIVE;} #ifdef ODBC_V20 - if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_RESUME) - {if (comma++) s += ", "; s += langDBINF_RESUME;} -#endif - if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_BOOKMARK) - {if (comma++) s += ", "; s += langDBINF_BOOKMARK;} - s += "\n"; - - comma = FALSE; - s += langDBINF_LOCK_TYPES; - if (pDb->dbInf.lockTypes & SQL_LCK_NO_CHANGE) - {s += langDBINF_NO_CHANGE; comma++;} - if (pDb->dbInf.lockTypes & SQL_LCK_EXCLUSIVE) - {if (comma++) s += ", "; s += langDBINF_EXCLUSIVE;} - if (pDb->dbInf.lockTypes & SQL_LCK_UNLOCK) - {if (comma++) s += ", "; s += langDBINF_UNLOCK;} - s += "\n"; - - comma = FALSE; - s += langDBINF_POS_OPERS; - if (pDb->dbInf.posOperations & SQL_POS_POSITION) - {s += langDBINF_POSITION; comma++;} - if (pDb->dbInf.posOperations & SQL_POS_REFRESH) - {if (comma++) s += ", "; s += langDBINF_REFRESH;} - if (pDb->dbInf.posOperations & SQL_POS_UPDATE) - {if (comma++) s += ", "; s += langDBINF_UPD;} - if (pDb->dbInf.posOperations & SQL_POS_DELETE) - {if (comma++) s += ", "; s += langDBINF_DEL;} - if (pDb->dbInf.posOperations & SQL_POS_ADD) - {if (comma++) s += ", "; s += langDBINF_ADD;} - s += "\n"; - - comma = FALSE; - s += langDBINF_POS_STMTS; - if (pDb->dbInf.posStmts & SQL_PS_POSITIONED_DELETE) - {s += langDBINF_POS_DEL; comma++;} - if (pDb->dbInf.posStmts & SQL_PS_POSITIONED_UPDATE) - {if (comma++) s += ", "; s += langDBINF_POS_UPD;} - if (pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE) - {if (comma++) s += ", "; s += langDBINF_SELECT_FOR_UPD;} - s += "\n"; - - comma = FALSE; - s += langDBINF_SCROLL_CONCURR; - if (pDb->dbInf.scrollConcurrency & SQL_SCCO_READ_ONLY) - {s += langDBINF_READ_ONLY; comma++;} - if (pDb->dbInf.scrollConcurrency & SQL_SCCO_LOCK) - {if (comma++) s += ", "; s += langDBINF_LOCK;} - if (pDb->dbInf.scrollConcurrency & SQL_SCCO_OPT_ROWVER) - {if (comma++) s += ", "; s += langDBINF_OPT_ROWVER;} - if (pDb->dbInf.scrollConcurrency & SQL_SCCO_OPT_VALUES) - {if (comma++) s += ", "; s += langDBINF_OPT_VALUES;} - s += "\n"; - - comma = FALSE; - s += langDBINF_SCROLL_OPTS; - if (pDb->dbInf.scrollOptions & SQL_SO_FORWARD_ONLY) - {s += langDBINF_FWD_ONLY; comma++;} - if (pDb->dbInf.scrollOptions & SQL_SO_STATIC) - {if (comma++) s += ", "; s += langDBINF_STATIC;} - if (pDb->dbInf.scrollOptions & SQL_SO_KEYSET_DRIVEN) - {if (comma++) s += ", "; s += langDBINF_KEYSET_DRIVEN;} - if (pDb->dbInf.scrollOptions & SQL_SO_DYNAMIC) - {if (comma++) s += ", "; s += langDBINF_DYNAMIC;} - if (pDb->dbInf.scrollOptions & SQL_SO_MIXED) - {if (comma++) s += ", "; s += langDBINF_MIXED;} - s += "\n"; - - comma = FALSE; - s += langDBINF_STATIC_SENS; - if (pDb->dbInf.staticSensitivity & SQL_SS_ADDITIONS) - {s += langDBINF_ADDITIONS; comma++;} - if (pDb->dbInf.staticSensitivity & SQL_SS_DELETIONS) - {if (comma++) s += ", "; s += langDBINF_DELETIONS;} - if (pDb->dbInf.staticSensitivity & SQL_SS_UPDATES) - {if (comma++) s += ", "; s += langDBINF_UPDATES;} - s += "\n"; - - - s += langDBINF_TXN_CAPABLE; - switch(pDb->dbInf.txnCapable) - { - case SQL_TC_NONE: s += langNO; break; - case SQL_TC_DML: s += langDBINF_DML_ONLY; break; - case SQL_TC_DDL_COMMIT: s += langDBINF_DDL_COMMIT; break; - case SQL_TC_DDL_IGNORE: s += langDBINF_DDL_IGNORE; break; - case SQL_TC_ALL: s += langDBINF_DDL_AND_DML; break; - } - s += "\n"; - - t.sprintf("%s%d\n", langDBINF_LOGIN_TIMEOUT, pDb->dbInf.loginTimeout); - s += t; - - // Oracle specific information - if (pDb->Dbms() == dbmsORACLE) - { - s += "\n"; - s += langDBINF_ORACLE_BANNER; - s += "\n"; - - // Oracle cache hit ratio - SDWORD cb; - ULONG dbBlockGets; - pDb->ExecSql("SELECT VALUE FROM V$SYSSTAT WHERE NAME = 'db block gets'"); - pDb->GetNext(); - if (pDb->GetData(1, SQL_C_ULONG, &dbBlockGets, 0, &cb)) - { - t.sprintf("%s: %lu\n", langDBINF_DB_BLOCK_GETS, dbBlockGets); - s += t; - } - - ULONG consistentGets; - pDb->ExecSql("SELECT VALUE FROM V$SYSSTAT WHERE NAME = 'consistent gets'"); - pDb->GetNext(); - if (pDb->GetData(1, SQL_C_ULONG, &consistentGets, 0, &cb)) - { - t.sprintf("%s: %lu\n", langDBINF_CONSISTENT_GETS, consistentGets); - s += t; - } - - ULONG physReads; - pDb->ExecSql("SELECT VALUE FROM V$SYSSTAT WHERE NAME = 'physical reads'"); - pDb->GetNext(); - if (pDb->GetData(1, SQL_C_ULONG, &physReads, 0, &cb)) - { - t.sprintf("%s: %lu\n", langDBINF_PHYSICAL_READS, physReads); - s += t; - } - - ULONG hitRatio = (ULONG)((1.00 - ((float)physReads / (float)(dbBlockGets + consistentGets))) * 100.00); - t.sprintf("*** %s: %lu%%\n", langDBINF_CACHE_HIT_RATIO, hitRatio); - s += t; - - // Tablespace information - s += "\n"; - s += langDBINF_TABLESPACE_IO; - s += "\n"; - ULONG physWrites; - char tablespaceName[257]; - pDb->ExecSql("SELECT NAME,PHYRDS,PHYWRTS FROM V$DATAFILE, V$FILESTAT WHERE V$DATAFILE.FILE# = V$FILESTAT.FILE#"); - while (pDb->GetNext()) - { - pDb->GetData(1, SQL_C_CHAR, tablespaceName, 257, &cb); - pDb->GetData(2, SQL_C_ULONG, &physReads, 0, &cb); - pDb->GetData(3, SQL_C_ULONG, &physWrites, 0, &cb); - t.sprintf("%s\n\t%s: %lu\t%s: %lu\n", tablespaceName, - langDBINF_PHYSICAL_READS, physReads, langDBINF_PHYSICAL_WRITES, physWrites); - s += t; - } - - s += "\n"; - } + if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_RESUME) + {if (comma++) s += ", "; s += langDBINF_RESUME;} +#endif + if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_BOOKMARK) + {if (comma++) s += ", "; s += langDBINF_BOOKMARK;} + s += "\n"; + + comma = FALSE; + s += langDBINF_LOCK_TYPES; + if (pDb->dbInf.lockTypes & SQL_LCK_NO_CHANGE) + {s += langDBINF_NO_CHANGE; comma++;} + if (pDb->dbInf.lockTypes & SQL_LCK_EXCLUSIVE) + {if (comma++) s += ", "; s += langDBINF_EXCLUSIVE;} + if (pDb->dbInf.lockTypes & SQL_LCK_UNLOCK) + {if (comma++) s += ", "; s += langDBINF_UNLOCK;} + s += "\n"; + + comma = FALSE; + s += langDBINF_POS_OPERS; + if (pDb->dbInf.posOperations & SQL_POS_POSITION) + {s += langDBINF_POSITION; comma++;} + if (pDb->dbInf.posOperations & SQL_POS_REFRESH) + {if (comma++) s += ", "; s += langDBINF_REFRESH;} + if (pDb->dbInf.posOperations & SQL_POS_UPDATE) + {if (comma++) s += ", "; s += langDBINF_UPD;} + if (pDb->dbInf.posOperations & SQL_POS_DELETE) + {if (comma++) s += ", "; s += langDBINF_DEL;} + if (pDb->dbInf.posOperations & SQL_POS_ADD) + {if (comma++) s += ", "; s += langDBINF_ADD;} + s += "\n"; + + comma = FALSE; + s += langDBINF_POS_STMTS; + if (pDb->dbInf.posStmts & SQL_PS_POSITIONED_DELETE) + {s += langDBINF_POS_DEL; comma++;} + if (pDb->dbInf.posStmts & SQL_PS_POSITIONED_UPDATE) + {if (comma++) s += ", "; s += langDBINF_POS_UPD;} + if (pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE) + {if (comma++) s += ", "; s += langDBINF_SELECT_FOR_UPD;} + s += "\n"; + + comma = FALSE; + s += langDBINF_SCROLL_CONCURR; + if (pDb->dbInf.scrollConcurrency & SQL_SCCO_READ_ONLY) + {s += langDBINF_READ_ONLY; comma++;} + if (pDb->dbInf.scrollConcurrency & SQL_SCCO_LOCK) + {if (comma++) s += ", "; s += langDBINF_LOCK;} + if (pDb->dbInf.scrollConcurrency & SQL_SCCO_OPT_ROWVER) + {if (comma++) s += ", "; s += langDBINF_OPT_ROWVER;} + if (pDb->dbInf.scrollConcurrency & SQL_SCCO_OPT_VALUES) + {if (comma++) s += ", "; s += langDBINF_OPT_VALUES;} + s += "\n"; + + comma = FALSE; + s += langDBINF_SCROLL_OPTS; + if (pDb->dbInf.scrollOptions & SQL_SO_FORWARD_ONLY) + {s += langDBINF_FWD_ONLY; comma++;} + if (pDb->dbInf.scrollOptions & SQL_SO_STATIC) + {if (comma++) s += ", "; s += langDBINF_STATIC;} + if (pDb->dbInf.scrollOptions & SQL_SO_KEYSET_DRIVEN) + {if (comma++) s += ", "; s += langDBINF_KEYSET_DRIVEN;} + if (pDb->dbInf.scrollOptions & SQL_SO_DYNAMIC) + {if (comma++) s += ", "; s += langDBINF_DYNAMIC;} + if (pDb->dbInf.scrollOptions & SQL_SO_MIXED) + {if (comma++) s += ", "; s += langDBINF_MIXED;} + s += "\n"; + + comma = FALSE; + s += langDBINF_STATIC_SENS; + if (pDb->dbInf.staticSensitivity & SQL_SS_ADDITIONS) + {s += langDBINF_ADDITIONS; comma++;} + if (pDb->dbInf.staticSensitivity & SQL_SS_DELETIONS) + {if (comma++) s += ", "; s += langDBINF_DELETIONS;} + if (pDb->dbInf.staticSensitivity & SQL_SS_UPDATES) + {if (comma++) s += ", "; s += langDBINF_UPDATES;} + s += "\n"; + + + s += langDBINF_TXN_CAPABLE; + switch(pDb->dbInf.txnCapable) + { + case SQL_TC_NONE: s += langNO; break; + case SQL_TC_DML: s += langDBINF_DML_ONLY; break; + case SQL_TC_DDL_COMMIT: s += langDBINF_DDL_COMMIT; break; + case SQL_TC_DDL_IGNORE: s += langDBINF_DDL_IGNORE; break; + case SQL_TC_ALL: s += langDBINF_DDL_AND_DML; break; + } + s += "\n"; + + t.sprintf("%s%d\n", langDBINF_LOGIN_TIMEOUT, pDb->dbInf.loginTimeout); + s += t; + + // Oracle specific information + if (pDb->Dbms() == dbmsORACLE) + { + s += "\n"; + s += langDBINF_ORACLE_BANNER; + s += "\n"; + + // Oracle cache hit ratio + SDWORD cb; + ULONG dbBlockGets; + pDb->ExecSql("SELECT VALUE FROM V$SYSSTAT WHERE NAME = 'db block gets'"); + pDb->GetNext(); + if (pDb->GetData(1, SQL_C_ULONG, &dbBlockGets, 0, &cb)) + { + t.sprintf("%s: %lu\n", langDBINF_DB_BLOCK_GETS, dbBlockGets); + s += t; + } + + ULONG consistentGets; + pDb->ExecSql("SELECT VALUE FROM V$SYSSTAT WHERE NAME = 'consistent gets'"); + pDb->GetNext(); + if (pDb->GetData(1, SQL_C_ULONG, &consistentGets, 0, &cb)) + { + t.sprintf("%s: %lu\n", langDBINF_CONSISTENT_GETS, consistentGets); + s += t; + } + + ULONG physReads; + pDb->ExecSql("SELECT VALUE FROM V$SYSSTAT WHERE NAME = 'physical reads'"); + pDb->GetNext(); + if (pDb->GetData(1, SQL_C_ULONG, &physReads, 0, &cb)) + { + t.sprintf("%s: %lu\n", langDBINF_PHYSICAL_READS, physReads); + s += t; + } + + ULONG hitRatio = (ULONG)((1.00 - ((float)physReads / (float)(dbBlockGets + consistentGets))) * 100.00); + t.sprintf("*** %s: %lu%%\n", langDBINF_CACHE_HIT_RATIO, hitRatio); + s += t; + + // Tablespace information + s += "\n"; + s += langDBINF_TABLESPACE_IO; + s += "\n"; + ULONG physWrites; + char tablespaceName[257]; + pDb->ExecSql("SELECT NAME,PHYRDS,PHYWRTS FROM V$DATAFILE, V$FILESTAT WHERE V$DATAFILE.FILE# = V$FILESTAT.FILE#"); + while (pDb->GetNext()) + { + pDb->GetData(1, SQL_C_CHAR, tablespaceName, 257, &cb); + pDb->GetData(2, SQL_C_ULONG, &physReads, 0, &cb); + pDb->GetData(3, SQL_C_ULONG, &physWrites, 0, &cb); + t.sprintf("%s\n\t%s: %lu\t%s: %lu\n", tablespaceName, + langDBINF_PHYSICAL_READS, physReads, langDBINF_PHYSICAL_WRITES, physWrites); + s += t; + } + + s += "\n"; + } wxLogMessage(s); diff --git a/samples/db/dbtest.h b/samples/db/dbtest.h index 089f79004f..d6bde8d91d 100644 --- a/samples/db/dbtest.h +++ b/samples/db/dbtest.h @@ -129,7 +129,7 @@ class Ccontact : public wxDbTable, public CstructContact // Contains all the index definitions and calls to wxDbTable::CreateIndex() // required to create all the indexes we wish to define for this table. - bool CreateIndexes(void); + bool CreateIndexes(bool recreate); // Since we do not wish to have duplicate code blocks all over our program // for a common query/fetch that we will need to do in many places, we @@ -252,7 +252,7 @@ class CeditorDlg : public wxPanel wxButton *pCreateBtn, *pEditBtn, *pDeleteBtn, *pCopyBtn, *pSaveBtn, *pCancelBtn; wxButton *pPrevBtn, *pNextBtn, *pQueryBtn, *pResetBtn, *pDoneBtn, *pHelpBtn; wxButton *pNameListBtn; - wxButton *pDataTypesBtn, *pDbDiagsBtn; + wxButton *pCatalogBtn, *pDataTypesBtn, *pDbDiagsBtn; wxTextCtrl *pNameTxt, *pAddress1Txt, *pAddress2Txt,*pCityTxt, *pStateTxt, *pCountryTxt,*pPostalCodeTxt; wxStaticText *pNameMsg, *pAddress1Msg, *pAddress2Msg,*pCityMsg, *pStateMsg, *pCountryMsg,*pPostalCodeMsg; wxTextCtrl *pJoinDateTxt,*pContribTxt, *pLinesTxt; @@ -348,6 +348,7 @@ DECLARE_EVENT_TABLE() #define EDITOR_DIALOG_DEVELOPER 236 #define EDITOR_DIALOG_JOIN_MSG 237 #define EDITOR_DIALOG_JOIN_TEXT 238 +#define EDITOR_DIALOG_CATALOG 240 #define EDITOR_DIALOG_DATATYPES 250 #define EDITOR_DIALOG_DB_DIAGS 260 -- 2.45.2