X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/38ae3a1019313cba6a753d652ac40f9432ad569f..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/common/dbtable.cpp diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index 65e863bcc0..d5f848518b 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -755,7 +755,6 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists) int i; wxString sqlStmt; wxString s; -// int NumKeyCols=0; // Calculate the maximum size of the concatenated // keys for use with wxDbGrid @@ -764,7 +763,6 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists) { if (colDefs[i].KeyField) { -// NumKeyCols++; m_keysize += colDefs[i].SzDataObj; } } @@ -792,7 +790,8 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists) else if (checkPrivileges) { // Verify the user has rights to access the table. - bool hasPrivs = true; + bool hasPrivs wxDUMMY_INITIALIZE(true); + if (pDb->Dbms() == dbmsPOSTGRES) hasPrivs = pDb->TablePrivileges(tableName, wxT("SELECT"), pDb->GetUsername(), NULL, tablePath); else @@ -802,11 +801,11 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists) s = wxT("Connecting user does not have sufficient privileges to access this table.\n"); } - if (!s.IsEmpty()) + if (!s.empty()) { wxString p; - if (!tablePath.IsEmpty()) + if (!tablePath.empty()) p.Printf(wxT("Error opening '%s/%s'.\n"),tablePath.c_str(),tableName.c_str()); else p.Printf(wxT("Error opening '%s'.\n"), tableName.c_str()); @@ -851,7 +850,6 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists) if (needComma) sqlStmt += wxT(","); sqlStmt += pDb->SQLColumnName(colDefs[i].ColName); -// sqlStmt += colDefs[i].ColName; needComma = true; } needComma = false; @@ -1102,7 +1100,6 @@ void wxDbTable::BuildSelectStmt(wxString &pSqlStmt, int typeOfSelect, bool disti { pSqlStmt += wxT(","); pSqlStmt += pDb->SQLTableName(queryTableName); -// pSqlStmt += queryTableName; pSqlStmt += wxT(".ROWID"); } else @@ -1311,9 +1308,9 @@ void wxDbTable::BuildWhereClause(wxString &pWhereClause, int typeOfWhere, switch(colDefs[colNumber].SqlCtype) { case SQL_C_CHAR: -#ifndef __UNIX__ +#ifdef SQL_C_WCHAR case SQL_C_WCHAR: -#endif +#endif //case SQL_C_WXCHAR: SQL_C_WXCHAR is covered by either SQL_C_CHAR or SQL_C_WCHAR colValue.Printf(wxT("'%s'"), (UCHAR FAR *) colDefs[colNumber].PtrDataObj); break; @@ -1856,6 +1853,7 @@ bool wxDbTable::DropIndex(const wxString &indexName) (pDb->Dbms() == dbmsSYBASE_ASE && !wxStrcmp(pDb->sqlState,wxT("37000"))) || (pDb->Dbms() == dbmsMS_SQL_SERVER && !wxStrcmp(pDb->sqlState,wxT("S1000"))) || (pDb->Dbms() == dbmsINTERBASE && !wxStrcmp(pDb->sqlState,wxT("S1000"))) || + (pDb->Dbms() == dbmsMAXDB && !wxStrcmp(pDb->sqlState,wxT("S1000"))) || (pDb->Dbms() == dbmsFIREBIRD && !wxStrcmp(pDb->sqlState,wxT("HY000"))) || (pDb->Dbms() == dbmsSYBASE_ASE && !wxStrcmp(pDb->sqlState,wxT("S0002"))) || // Base table not found (pDb->Dbms() == dbmsMY_SQL && !wxStrcmp(pDb->sqlState,wxT("42S12"))) || // tested by Christopher Ludwik Marino-Cebulski using v3.23.21beta @@ -2204,7 +2202,7 @@ void wxDbTable::ClearMemberVar(UWORD colNumber, bool setToNull) switch(colDefs[colNumber].SqlCtype) { case SQL_C_CHAR: -#ifndef __UNIX__ +#ifdef SQL_C_WCHAR case SQL_C_WCHAR: #endif //case SQL_C_WXCHAR: SQL_C_WXCHAR is covered by either SQL_C_CHAR or SQL_C_WCHAR @@ -2713,8 +2711,14 @@ wxVariant wxDbTable::GetColumn(const int colNumber) const { switch (colDefs[colNumber].SqlCtype) { +#if wxUSE_UNICODE + #if defined(SQL_WCHAR) case SQL_WCHAR: + #endif + #if defined(SQL_WVARCHAR) case SQL_WVARCHAR: + #endif +#endif case SQL_CHAR: case SQL_VARCHAR: val = (wxChar *)(colDefs[colNumber].PtrDataObj); @@ -2779,8 +2783,14 @@ void wxDbTable::SetColumn(const int colNumber, const wxVariant val) switch (colDefs[colNumber].SqlCtype) { +#if wxUSE_UNICODE + #if defined(SQL_WCHAR) case SQL_WCHAR: + #endif + #if defined(SQL_WVARCHAR) case SQL_WVARCHAR: + #endif +#endif case SQL_CHAR: case SQL_VARCHAR: csstrncpyt((wxChar *)(colDefs[colNumber].PtrDataObj),