-} // wxDB::DispNextError()
-
-
-/********** wxDB::logError() **********/
-void wxDB::logError(const char *errMsg, const char *SQLState)
-{
- assert(errMsg && wxStrlen(errMsg));
-
- static int pLast = -1;
- int dbStatus;
-
- if (++pLast == DB_MAX_ERROR_HISTORY)
- {
- int i;
- for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)
- wxStrcpy(errorList[i], errorList[i+1]);
- pLast--;
- }
-
- wxStrcpy(errorList[pLast], errMsg);
-
- if (SQLState && wxStrlen(SQLState))
- if ((dbStatus = TranslateSqlState(SQLState)) != DB_ERR_FUNCTION_SEQUENCE_ERROR)
- DB_STATUS = dbStatus;
-
- // Add the errmsg to the sql log
- WriteSqlLog(errMsg);
-
-} // wxDB::logError()
-
-
-/**********wxDB::TranslateSqlState() **********/
-int wxDB::TranslateSqlState(const char *SQLState)
-{
- if (!wxStrcmp(SQLState, "01000"))
- return(DB_ERR_GENERAL_WARNING);
- if (!wxStrcmp(SQLState, "01002"))
- return(DB_ERR_DISCONNECT_ERROR);
- if (!wxStrcmp(SQLState, "01004"))
- return(DB_ERR_DATA_TRUNCATED);
- if (!wxStrcmp(SQLState, "01006"))
- return(DB_ERR_PRIV_NOT_REVOKED);
- if (!wxStrcmp(SQLState, "01S00"))
- return(DB_ERR_INVALID_CONN_STR_ATTR);
- if (!wxStrcmp(SQLState, "01S01"))
- return(DB_ERR_ERROR_IN_ROW);
- if (!wxStrcmp(SQLState, "01S02"))
- return(DB_ERR_OPTION_VALUE_CHANGED);
- if (!wxStrcmp(SQLState, "01S03"))
- return(DB_ERR_NO_ROWS_UPD_OR_DEL);
- if (!wxStrcmp(SQLState, "01S04"))
- return(DB_ERR_MULTI_ROWS_UPD_OR_DEL);
- if (!wxStrcmp(SQLState, "07001"))
- return(DB_ERR_WRONG_NO_OF_PARAMS);
- if (!wxStrcmp(SQLState, "07006"))
- return(DB_ERR_DATA_TYPE_ATTR_VIOL);
- if (!wxStrcmp(SQLState, "08001"))
- return(DB_ERR_UNABLE_TO_CONNECT);
- if (!wxStrcmp(SQLState, "08002"))
- return(DB_ERR_CONNECTION_IN_USE);
- if (!wxStrcmp(SQLState, "08003"))
- return(DB_ERR_CONNECTION_NOT_OPEN);
- if (!wxStrcmp(SQLState, "08004"))
- return(DB_ERR_REJECTED_CONNECTION);
- if (!wxStrcmp(SQLState, "08007"))
- return(DB_ERR_CONN_FAIL_IN_TRANS);
- if (!wxStrcmp(SQLState, "08S01"))
- return(DB_ERR_COMM_LINK_FAILURE);
- if (!wxStrcmp(SQLState, "21S01"))
- return(DB_ERR_INSERT_VALUE_LIST_MISMATCH);
- if (!wxStrcmp(SQLState, "21S02"))
- return(DB_ERR_DERIVED_TABLE_MISMATCH);
- if (!wxStrcmp(SQLState, "22001"))
- return(DB_ERR_STRING_RIGHT_TRUNC);
- if (!wxStrcmp(SQLState, "22003"))
- return(DB_ERR_NUMERIC_VALUE_OUT_OF_RNG);
- if (!wxStrcmp(SQLState, "22005"))
- return(DB_ERR_ERROR_IN_ASSIGNMENT);
- if (!wxStrcmp(SQLState, "22008"))
- return(DB_ERR_DATETIME_FLD_OVERFLOW);
- if (!wxStrcmp(SQLState, "22012"))
- return(DB_ERR_DIVIDE_BY_ZERO);
- if (!wxStrcmp(SQLState, "22026"))
- return(DB_ERR_STR_DATA_LENGTH_MISMATCH);
- if (!wxStrcmp(SQLState, "23000"))
- return(DB_ERR_INTEGRITY_CONSTRAINT_VIOL);
- if (!wxStrcmp(SQLState, "24000"))
- return(DB_ERR_INVALID_CURSOR_STATE);
- if (!wxStrcmp(SQLState, "25000"))
- return(DB_ERR_INVALID_TRANS_STATE);
- if (!wxStrcmp(SQLState, "28000"))
- return(DB_ERR_INVALID_AUTH_SPEC);
- if (!wxStrcmp(SQLState, "34000"))
- return(DB_ERR_INVALID_CURSOR_NAME);
- if (!wxStrcmp(SQLState, "37000"))
- return(DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL);
- if (!wxStrcmp(SQLState, "3C000"))
- return(DB_ERR_DUPLICATE_CURSOR_NAME);
- if (!wxStrcmp(SQLState, "40001"))
- return(DB_ERR_SERIALIZATION_FAILURE);
- if (!wxStrcmp(SQLState, "42000"))
- return(DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2);
- if (!wxStrcmp(SQLState, "70100"))
- return(DB_ERR_OPERATION_ABORTED);
- if (!wxStrcmp(SQLState, "IM001"))
- return(DB_ERR_UNSUPPORTED_FUNCTION);
- if (!wxStrcmp(SQLState, "IM002"))
- return(DB_ERR_NO_DATA_SOURCE);
- if (!wxStrcmp(SQLState, "IM003"))
- return(DB_ERR_DRIVER_LOAD_ERROR);
- if (!wxStrcmp(SQLState, "IM004"))
- return(DB_ERR_SQLALLOCENV_FAILED);
- if (!wxStrcmp(SQLState, "IM005"))
- return(DB_ERR_SQLALLOCCONNECT_FAILED);
- if (!wxStrcmp(SQLState, "IM006"))
- return(DB_ERR_SQLSETCONNECTOPTION_FAILED);
- if (!wxStrcmp(SQLState, "IM007"))
- return(DB_ERR_NO_DATA_SOURCE_DLG_PROHIB);
- if (!wxStrcmp(SQLState, "IM008"))
- return(DB_ERR_DIALOG_FAILED);
- if (!wxStrcmp(SQLState, "IM009"))
- return(DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL);
- if (!wxStrcmp(SQLState, "IM010"))
- return(DB_ERR_DATA_SOURCE_NAME_TOO_LONG);
- if (!wxStrcmp(SQLState, "IM011"))
- return(DB_ERR_DRIVER_NAME_TOO_LONG);
- if (!wxStrcmp(SQLState, "IM012"))
- return(DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR);
- if (!wxStrcmp(SQLState, "IM013"))
- return(DB_ERR_TRACE_FILE_ERROR);
- if (!wxStrcmp(SQLState, "S0001"))
- return(DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS);
- if (!wxStrcmp(SQLState, "S0002"))
- return(DB_ERR_TABLE_NOT_FOUND);
- if (!wxStrcmp(SQLState, "S0011"))
- return(DB_ERR_INDEX_ALREADY_EXISTS);
- if (!wxStrcmp(SQLState, "S0012"))
- return(DB_ERR_INDEX_NOT_FOUND);
- if (!wxStrcmp(SQLState, "S0021"))
- return(DB_ERR_COLUMN_ALREADY_EXISTS);
- if (!wxStrcmp(SQLState, "S0022"))
- return(DB_ERR_COLUMN_NOT_FOUND);
- if (!wxStrcmp(SQLState, "S0023"))
- return(DB_ERR_NO_DEFAULT_FOR_COLUMN);
- if (!wxStrcmp(SQLState, "S1000"))
- return(DB_ERR_GENERAL_ERROR);
- if (!wxStrcmp(SQLState, "S1001"))
- return(DB_ERR_MEMORY_ALLOCATION_FAILURE);
- if (!wxStrcmp(SQLState, "S1002"))
- return(DB_ERR_INVALID_COLUMN_NUMBER);
- if (!wxStrcmp(SQLState, "S1003"))
- return(DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1004"))
- return(DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1008"))
- return(DB_ERR_OPERATION_CANCELLED);
- if (!wxStrcmp(SQLState, "S1009"))
- return(DB_ERR_INVALID_ARGUMENT_VALUE);
- if (!wxStrcmp(SQLState, "S1010"))
- return(DB_ERR_FUNCTION_SEQUENCE_ERROR);
- if (!wxStrcmp(SQLState, "S1011"))
- return(DB_ERR_OPERATION_INVALID_AT_THIS_TIME);
- if (!wxStrcmp(SQLState, "S1012"))
- return(DB_ERR_INVALID_TRANS_OPERATION_CODE);
- if (!wxStrcmp(SQLState, "S1015"))
- return(DB_ERR_NO_CURSOR_NAME_AVAIL);
- if (!wxStrcmp(SQLState, "S1090"))
- return(DB_ERR_INVALID_STR_OR_BUF_LEN);
- if (!wxStrcmp(SQLState, "S1091"))
- return(DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1092"))
- return(DB_ERR_OPTION_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1093"))
- return(DB_ERR_INVALID_PARAM_NO);
- if (!wxStrcmp(SQLState, "S1094"))
- return(DB_ERR_INVALID_SCALE_VALUE);
- if (!wxStrcmp(SQLState, "S1095"))
- return(DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1096"))
- return(DB_ERR_INF_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1097"))
- return(DB_ERR_COLUMN_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1098"))
- return(DB_ERR_SCOPE_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1099"))
- return(DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1100"))
- return(DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1101"))
- return(DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1103"))
- return(DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1104"))
- return(DB_ERR_INVALID_PRECISION_VALUE);
- if (!wxStrcmp(SQLState, "S1105"))
- return(DB_ERR_INVALID_PARAM_TYPE);
- if (!wxStrcmp(SQLState, "S1106"))
- return(DB_ERR_FETCH_TYPE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1107"))
- return(DB_ERR_ROW_VALUE_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1108"))
- return(DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE);
- if (!wxStrcmp(SQLState, "S1109"))
- return(DB_ERR_INVALID_CURSOR_POSITION);
- if (!wxStrcmp(SQLState, "S1110"))
- return(DB_ERR_INVALID_DRIVER_COMPLETION);
- if (!wxStrcmp(SQLState, "S1111"))
- return(DB_ERR_INVALID_BOOKMARK_VALUE);
- if (!wxStrcmp(SQLState, "S1C00"))
- return(DB_ERR_DRIVER_NOT_CAPABLE);
- if (!wxStrcmp(SQLState, "S1T00"))
- return(DB_ERR_TIMEOUT_EXPIRED);
-
- // No match
- return(0);
-
-} // wxDB::TranslateSqlState()
-
-
-/********** wxDB::Grant() **********/
-bool wxDB::Grant(int privileges, const char *tableName, const char *userList)
-{
- char sqlStmt[DB_MAX_STATEMENT_LEN];
-
- // Build the grant statement
- wxStrcpy(sqlStmt, "GRANT ");
- if (privileges == DB_GRANT_ALL)
- wxStrcat(sqlStmt, "ALL");
- else
- {
- int c = 0;
- if (privileges & DB_GRANT_SELECT)
- {
- wxStrcat(sqlStmt, "SELECT");
- c++;
- }
- if (privileges & DB_GRANT_INSERT)
- {
- if (c++)
- wxStrcat(sqlStmt, ", ");
- wxStrcat(sqlStmt, "INSERT");
- }
- if (privileges & DB_GRANT_UPDATE)
- {
- if (c++)
- wxStrcat(sqlStmt, ", ");
- wxStrcat(sqlStmt, "UPDATE");
- }
- if (privileges & DB_GRANT_DELETE)
- {
- if (c++)
- wxStrcat(sqlStmt, ", ");
- wxStrcat(sqlStmt, "DELETE");
- }
- }
-
- wxStrcat(sqlStmt, " ON ");
- wxStrcat(sqlStmt, tableName);
- wxStrcat(sqlStmt, " TO ");
- wxStrcat(sqlStmt, userList);
+#ifdef __WXDEBUG__
+ wxLogDebug(odbcErrMsg,wxT("ODBC DEBUG MESSAGE"));
+#endif // __WXDEBUG__
+
+} // wxDb::DispNextError()
+
+
+/********** wxDb::logError() **********/
+void wxDb::logError(const wxString &errMsg, const wxString &SQLState)
+{
+ wxASSERT(errMsg.Length());
+
+ static int pLast = -1;
+ int dbStatus;
+
+ if (++pLast == DB_MAX_ERROR_HISTORY)
+ {
+ int i;
+ for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)
+ wxStrcpy(errorList[i], errorList[i+1]);
+ pLast--;
+ }
+
+ wxStrcpy(errorList[pLast], errMsg);
+
+ if (SQLState.Length())
+ if ((dbStatus = TranslateSqlState(SQLState)) != DB_ERR_FUNCTION_SEQUENCE_ERROR)
+ DB_STATUS = dbStatus;
+
+ // Add the errmsg to the sql log
+ WriteSqlLog(errMsg);
+
+} // wxDb::logError()
+
+
+/**********wxDb::TranslateSqlState() **********/
+int wxDb::TranslateSqlState(const wxString &SQLState)
+{
+ if (!wxStrcmp(SQLState, wxT("01000")))
+ return(DB_ERR_GENERAL_WARNING);
+ if (!wxStrcmp(SQLState, wxT("01002")))
+ return(DB_ERR_DISCONNECT_ERROR);
+ if (!wxStrcmp(SQLState, wxT("01004")))
+ return(DB_ERR_DATA_TRUNCATED);
+ if (!wxStrcmp(SQLState, wxT("01006")))
+ return(DB_ERR_PRIV_NOT_REVOKED);
+ if (!wxStrcmp(SQLState, wxT("01S00")))
+ return(DB_ERR_INVALID_CONN_STR_ATTR);
+ if (!wxStrcmp(SQLState, wxT("01S01")))
+ return(DB_ERR_ERROR_IN_ROW);
+ if (!wxStrcmp(SQLState, wxT("01S02")))
+ return(DB_ERR_OPTION_VALUE_CHANGED);
+ if (!wxStrcmp(SQLState, wxT("01S03")))
+ return(DB_ERR_NO_ROWS_UPD_OR_DEL);
+ if (!wxStrcmp(SQLState, wxT("01S04")))
+ return(DB_ERR_MULTI_ROWS_UPD_OR_DEL);
+ if (!wxStrcmp(SQLState, wxT("07001")))
+ return(DB_ERR_WRONG_NO_OF_PARAMS);
+ if (!wxStrcmp(SQLState, wxT("07006")))
+ return(DB_ERR_DATA_TYPE_ATTR_VIOL);
+ if (!wxStrcmp(SQLState, wxT("08001")))
+ return(DB_ERR_UNABLE_TO_CONNECT);
+ if (!wxStrcmp(SQLState, wxT("08002")))
+ return(DB_ERR_CONNECTION_IN_USE);
+ if (!wxStrcmp(SQLState, wxT("08003")))
+ return(DB_ERR_CONNECTION_NOT_OPEN);
+ if (!wxStrcmp(SQLState, wxT("08004")))
+ return(DB_ERR_REJECTED_CONNECTION);
+ if (!wxStrcmp(SQLState, wxT("08007")))
+ return(DB_ERR_CONN_FAIL_IN_TRANS);
+ if (!wxStrcmp(SQLState, wxT("08S01")))
+ return(DB_ERR_COMM_LINK_FAILURE);
+ if (!wxStrcmp(SQLState, wxT("21S01")))
+ return(DB_ERR_INSERT_VALUE_LIST_MISMATCH);
+ if (!wxStrcmp(SQLState, wxT("21S02")))
+ return(DB_ERR_DERIVED_TABLE_MISMATCH);
+ if (!wxStrcmp(SQLState, wxT("22001")))
+ return(DB_ERR_STRING_RIGHT_TRUNC);
+ if (!wxStrcmp(SQLState, wxT("22003")))
+ return(DB_ERR_NUMERIC_VALUE_OUT_OF_RNG);
+ if (!wxStrcmp(SQLState, wxT("22005")))
+ return(DB_ERR_ERROR_IN_ASSIGNMENT);
+ if (!wxStrcmp(SQLState, wxT("22008")))
+ return(DB_ERR_DATETIME_FLD_OVERFLOW);
+ if (!wxStrcmp(SQLState, wxT("22012")))
+ return(DB_ERR_DIVIDE_BY_ZERO);
+ if (!wxStrcmp(SQLState, wxT("22026")))
+ return(DB_ERR_STR_DATA_LENGTH_MISMATCH);
+ if (!wxStrcmp(SQLState, wxT("23000")))
+ return(DB_ERR_INTEGRITY_CONSTRAINT_VIOL);
+ if (!wxStrcmp(SQLState, wxT("24000")))
+ return(DB_ERR_INVALID_CURSOR_STATE);
+ if (!wxStrcmp(SQLState, wxT("25000")))
+ return(DB_ERR_INVALID_TRANS_STATE);
+ if (!wxStrcmp(SQLState, wxT("28000")))
+ return(DB_ERR_INVALID_AUTH_SPEC);
+ if (!wxStrcmp(SQLState, wxT("34000")))
+ return(DB_ERR_INVALID_CURSOR_NAME);
+ if (!wxStrcmp(SQLState, wxT("37000")))
+ return(DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL);
+ if (!wxStrcmp(SQLState, wxT("3C000")))
+ return(DB_ERR_DUPLICATE_CURSOR_NAME);
+ if (!wxStrcmp(SQLState, wxT("40001")))
+ return(DB_ERR_SERIALIZATION_FAILURE);
+ if (!wxStrcmp(SQLState, wxT("42000")))
+ return(DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2);
+ if (!wxStrcmp(SQLState, wxT("70100")))
+ return(DB_ERR_OPERATION_ABORTED);
+ if (!wxStrcmp(SQLState, wxT("IM001")))
+ return(DB_ERR_UNSUPPORTED_FUNCTION);
+ if (!wxStrcmp(SQLState, wxT("IM002")))
+ return(DB_ERR_NO_DATA_SOURCE);
+ if (!wxStrcmp(SQLState, wxT("IM003")))
+ return(DB_ERR_DRIVER_LOAD_ERROR);
+ if (!wxStrcmp(SQLState, wxT("IM004")))
+ return(DB_ERR_SQLALLOCENV_FAILED);
+ if (!wxStrcmp(SQLState, wxT("IM005")))
+ return(DB_ERR_SQLALLOCCONNECT_FAILED);
+ if (!wxStrcmp(SQLState, wxT("IM006")))
+ return(DB_ERR_SQLSETCONNECTOPTION_FAILED);
+ if (!wxStrcmp(SQLState, wxT("IM007")))
+ return(DB_ERR_NO_DATA_SOURCE_DLG_PROHIB);
+ if (!wxStrcmp(SQLState, wxT("IM008")))
+ return(DB_ERR_DIALOG_FAILED);
+ if (!wxStrcmp(SQLState, wxT("IM009")))
+ return(DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL);
+ if (!wxStrcmp(SQLState, wxT("IM010")))
+ return(DB_ERR_DATA_SOURCE_NAME_TOO_LONG);
+ if (!wxStrcmp(SQLState, wxT("IM011")))
+ return(DB_ERR_DRIVER_NAME_TOO_LONG);
+ if (!wxStrcmp(SQLState, wxT("IM012")))
+ return(DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR);
+ if (!wxStrcmp(SQLState, wxT("IM013")))
+ return(DB_ERR_TRACE_FILE_ERROR);
+ if (!wxStrcmp(SQLState, wxT("S0001")))
+ return(DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS);
+ if (!wxStrcmp(SQLState, wxT("S0002")))
+ return(DB_ERR_TABLE_NOT_FOUND);
+ if (!wxStrcmp(SQLState, wxT("S0011")))
+ return(DB_ERR_INDEX_ALREADY_EXISTS);
+ if (!wxStrcmp(SQLState, wxT("S0012")))
+ return(DB_ERR_INDEX_NOT_FOUND);
+ if (!wxStrcmp(SQLState, wxT("S0021")))
+ return(DB_ERR_COLUMN_ALREADY_EXISTS);
+ if (!wxStrcmp(SQLState, wxT("S0022")))
+ return(DB_ERR_COLUMN_NOT_FOUND);
+ if (!wxStrcmp(SQLState, wxT("S0023")))
+ return(DB_ERR_NO_DEFAULT_FOR_COLUMN);
+ if (!wxStrcmp(SQLState, wxT("S1000")))
+ return(DB_ERR_GENERAL_ERROR);
+ if (!wxStrcmp(SQLState, wxT("S1001")))
+ return(DB_ERR_MEMORY_ALLOCATION_FAILURE);
+ if (!wxStrcmp(SQLState, wxT("S1002")))
+ return(DB_ERR_INVALID_COLUMN_NUMBER);
+ if (!wxStrcmp(SQLState, wxT("S1003")))
+ return(DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1004")))
+ return(DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1008")))
+ return(DB_ERR_OPERATION_CANCELLED);
+ if (!wxStrcmp(SQLState, wxT("S1009")))
+ return(DB_ERR_INVALID_ARGUMENT_VALUE);
+ if (!wxStrcmp(SQLState, wxT("S1010")))
+ return(DB_ERR_FUNCTION_SEQUENCE_ERROR);
+ if (!wxStrcmp(SQLState, wxT("S1011")))
+ return(DB_ERR_OPERATION_INVALID_AT_THIS_TIME);
+ if (!wxStrcmp(SQLState, wxT("S1012")))
+ return(DB_ERR_INVALID_TRANS_OPERATION_CODE);
+ if (!wxStrcmp(SQLState, wxT("S1015")))
+ return(DB_ERR_NO_CURSOR_NAME_AVAIL);
+ if (!wxStrcmp(SQLState, wxT("S1090")))
+ return(DB_ERR_INVALID_STR_OR_BUF_LEN);
+ if (!wxStrcmp(SQLState, wxT("S1091")))
+ return(DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1092")))
+ return(DB_ERR_OPTION_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1093")))
+ return(DB_ERR_INVALID_PARAM_NO);
+ if (!wxStrcmp(SQLState, wxT("S1094")))
+ return(DB_ERR_INVALID_SCALE_VALUE);
+ if (!wxStrcmp(SQLState, wxT("S1095")))
+ return(DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1096")))
+ return(DB_ERR_INF_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1097")))
+ return(DB_ERR_COLUMN_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1098")))
+ return(DB_ERR_SCOPE_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1099")))
+ return(DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1100")))
+ return(DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1101")))
+ return(DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1103")))
+ return(DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1104")))
+ return(DB_ERR_INVALID_PRECISION_VALUE);
+ if (!wxStrcmp(SQLState, wxT("S1105")))
+ return(DB_ERR_INVALID_PARAM_TYPE);
+ if (!wxStrcmp(SQLState, wxT("S1106")))
+ return(DB_ERR_FETCH_TYPE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1107")))
+ return(DB_ERR_ROW_VALUE_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1108")))
+ return(DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE);
+ if (!wxStrcmp(SQLState, wxT("S1109")))
+ return(DB_ERR_INVALID_CURSOR_POSITION);
+ if (!wxStrcmp(SQLState, wxT("S1110")))
+ return(DB_ERR_INVALID_DRIVER_COMPLETION);
+ if (!wxStrcmp(SQLState, wxT("S1111")))
+ return(DB_ERR_INVALID_BOOKMARK_VALUE);
+ if (!wxStrcmp(SQLState, wxT("S1C00")))
+ return(DB_ERR_DRIVER_NOT_CAPABLE);
+ if (!wxStrcmp(SQLState, wxT("S1T00")))
+ return(DB_ERR_TIMEOUT_EXPIRED);
+
+ // No match
+ return(0);
+
+} // wxDb::TranslateSqlState()
+
+
+/********** wxDb::Grant() **********/
+bool wxDb::Grant(int privileges, const wxString &tableName, const wxString &userList)
+{
+ wxString sqlStmt;
+
+ // Build the grant statement
+ sqlStmt = wxT("GRANT ");
+ if (privileges == DB_GRANT_ALL)
+ sqlStmt += wxT("ALL");
+ else
+ {
+ int c = 0;
+ if (privileges & DB_GRANT_SELECT)
+ {
+ sqlStmt += wxT("SELECT");
+ c++;
+ }
+ if (privileges & DB_GRANT_INSERT)
+ {
+ if (c++)
+ sqlStmt += wxT(", ");
+ sqlStmt += wxT("INSERT");
+ }
+ if (privileges & DB_GRANT_UPDATE)
+ {
+ if (c++)
+ sqlStmt += wxT(", ");
+ sqlStmt += wxT("UPDATE");
+ }
+ if (privileges & DB_GRANT_DELETE)
+ {
+ if (c++)
+ sqlStmt += wxT(", ");
+ sqlStmt += wxT("DELETE");
+ }
+ }
+
+ sqlStmt += wxT(" ON ");
+ sqlStmt += SQLTableName(tableName);
+ sqlStmt += wxT(" TO ");
+ sqlStmt += userList;