Removed tabs and cleaned up indentations.
Added SQL_LOG_FILENAME and SQL_CATALOG_FILENAME constants to remove embedded text filenames git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
688
include/wx/db.h
688
include/wx/db.h
@@ -7,18 +7,18 @@
|
|||||||
// Modified by: George Tasker
|
// Modified by: George Tasker
|
||||||
// Mods: Dec, 1998:
|
// Mods: Dec, 1998:
|
||||||
// -Added support for SQL statement logging and database cataloging
|
// -Added support for SQL statement logging and database cataloging
|
||||||
// April, 1999
|
// April, 1999
|
||||||
// -Added QUERY_ONLY mode support to reduce default number of cursors
|
// -Added QUERY_ONLY mode support to reduce default number of cursors
|
||||||
// -Added additional SQL logging code
|
// -Added additional SQL logging code
|
||||||
// -Added DEBUG-ONLY tracking of Ctable objects to detect orphaned DB connections
|
// -Added DEBUG-ONLY tracking of Ctable objects to detect orphaned DB connections
|
||||||
// -Set ODBC option to only read committed writes to the DB so all
|
// -Set ODBC option to only read committed writes to the DB so all
|
||||||
// databases operate the same in that respect
|
// databases operate the same in that respect
|
||||||
//
|
//
|
||||||
// Created: 9.96
|
// Created: 9.96
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1996 Remstar International, Inc.
|
// Copyright: (c) 1996 Remstar International, Inc.
|
||||||
// Licence: wxWindows licence, plus:
|
// Licence: wxWindows licence, plus:
|
||||||
// Notice: This class library and its intellectual design are free of charge for use,
|
// Notice: This class library and its intellectual design are free of charge for use,
|
||||||
// modification, enhancement, debugging under the following conditions:
|
// modification, enhancement, debugging under the following conditions:
|
||||||
// 1) These classes may only be used as part of the implementation of a
|
// 1) These classes may only be used as part of the implementation of a
|
||||||
// wxWindows-based application
|
// wxWindows-based application
|
||||||
@@ -44,52 +44,38 @@
|
|||||||
#include "wx/version.h"
|
#include "wx/version.h"
|
||||||
|
|
||||||
#if wxMAJOR_VERSION == 2
|
#if wxMAJOR_VERSION == 2
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "db.h"
|
#pragma interface "db.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
|
|
||||||
#if wxMAJOR_VERSION == 2
|
#if wxMAJOR_VERSION == 2
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "wx/isql.h"
|
#include "wx/isql.h"
|
||||||
#include "wx/isqlext.h"
|
#include "wx/isqlext.h"
|
||||||
}
|
}
|
||||||
#else // version == 1
|
#else // version == 1
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "iodbc.h"
|
#include "iodbc.h"
|
||||||
#include "isqlext.h"
|
#include "isqlext.h"
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef float SFLOAT;
|
typedef float SFLOAT;
|
||||||
typedef double SDOUBLE;
|
typedef double SDOUBLE;
|
||||||
typedef unsigned int UINT;
|
typedef unsigned int UINT;
|
||||||
#define ULONG UDWORD
|
#define ULONG UDWORD
|
||||||
/*
|
|
||||||
#ifdef __UNIX__
|
|
||||||
# ifndef strnicmp
|
|
||||||
# define strnicmp strncasecmp
|
|
||||||
# endif
|
|
||||||
# ifndef stricmp
|
|
||||||
# define stricmp strcasecmp
|
|
||||||
# endif
|
|
||||||
#elif defined(__WXMAC__)
|
|
||||||
#else
|
|
||||||
# include <io.h>
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef wxODBC_FWD_ONLY_CURSORS
|
#ifndef wxODBC_FWD_ONLY_CURSORS
|
||||||
#define wxODBC_FWD_ONLY_CURSORS 1
|
#define wxODBC_FWD_ONLY_CURSORS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum enumDummy {enumDum1};
|
||||||
enum enumDummy {enumDum1};
|
|
||||||
|
|
||||||
#define SQL_C_BOOLEAN(datatype) (sizeof(datatype) == 1 ? SQL_C_UTINYINT : (sizeof(datatype) == 2 ? SQL_C_USHORT : SQL_C_ULONG))
|
#define SQL_C_BOOLEAN(datatype) (sizeof(datatype) == 1 ? SQL_C_UTINYINT : (sizeof(datatype) == 2 ? SQL_C_USHORT : SQL_C_ULONG))
|
||||||
// #define SQL_C_BOOLEAN (sizeof(Bool) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
|
// #define SQL_C_BOOLEAN (sizeof(Bool) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
|
||||||
|
|
||||||
#define SQL_C_ENUM (sizeof(enumDummy) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
|
#define SQL_C_ENUM (sizeof(enumDummy) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
|
||||||
|
|
||||||
@@ -101,245 +87,262 @@ enum enumDummy {enumDum1};
|
|||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int DB_PATH_MAX = 254;
|
const int DB_PATH_MAX = 254;
|
||||||
|
|
||||||
|
char * const SQL_LOG_FILENAME = "sqllog.txt";
|
||||||
|
char * const SQL_CATALOG_FILENAME = "catalog.txt";
|
||||||
|
|
||||||
// Database Globals
|
// Database Globals
|
||||||
const int DB_TYPE_NAME_LEN = 40;
|
const int DB_TYPE_NAME_LEN = 40;
|
||||||
const int DB_MAX_STATEMENT_LEN = 2048;
|
const int DB_MAX_STATEMENT_LEN = 2048;
|
||||||
const int DB_MAX_WHERE_CLAUSE_LEN = 1024;
|
const int DB_MAX_WHERE_CLAUSE_LEN = 1024;
|
||||||
const int DB_MAX_ERROR_MSG_LEN = 512;
|
const int DB_MAX_ERROR_MSG_LEN = 512;
|
||||||
const int DB_MAX_ERROR_HISTORY = 5;
|
const int DB_MAX_ERROR_HISTORY = 5;
|
||||||
const int DB_MAX_TABLE_NAME_LEN = 128;
|
const int DB_MAX_TABLE_NAME_LEN = 128;
|
||||||
const int DB_MAX_COLUMN_NAME_LEN = 128;
|
const int DB_MAX_COLUMN_NAME_LEN = 128;
|
||||||
|
|
||||||
const int DB_DATA_TYPE_VARCHAR = 1;
|
const int DB_DATA_TYPE_VARCHAR = 1;
|
||||||
const int DB_DATA_TYPE_INTEGER = 2;
|
const int DB_DATA_TYPE_INTEGER = 2;
|
||||||
const int DB_DATA_TYPE_FLOAT = 3;
|
const int DB_DATA_TYPE_FLOAT = 3;
|
||||||
const int DB_DATA_TYPE_DATE = 4;
|
const int DB_DATA_TYPE_DATE = 4;
|
||||||
|
|
||||||
const int DB_SELECT_KEYFIELDS = 1;
|
const int DB_SELECT_KEYFIELDS = 1;
|
||||||
const int DB_SELECT_WHERE = 2;
|
const int DB_SELECT_WHERE = 2;
|
||||||
const int DB_SELECT_MATCHING = 3;
|
const int DB_SELECT_MATCHING = 3;
|
||||||
const int DB_SELECT_STATEMENT = 4;
|
const int DB_SELECT_STATEMENT = 4;
|
||||||
|
|
||||||
const int DB_UPD_KEYFIELDS = 1;
|
const int DB_UPD_KEYFIELDS = 1;
|
||||||
const int DB_UPD_WHERE = 2;
|
const int DB_UPD_WHERE = 2;
|
||||||
|
|
||||||
const int DB_DEL_KEYFIELDS = 1;
|
const int DB_DEL_KEYFIELDS = 1;
|
||||||
const int DB_DEL_WHERE = 2;
|
const int DB_DEL_WHERE = 2;
|
||||||
const int DB_DEL_MATCHING = 3;
|
const int DB_DEL_MATCHING = 3;
|
||||||
|
|
||||||
const int DB_WHERE_KEYFIELDS = 1;
|
const int DB_WHERE_KEYFIELDS = 1;
|
||||||
const int DB_WHERE_MATCHING = 2;
|
const int DB_WHERE_MATCHING = 2;
|
||||||
|
|
||||||
const int DB_GRANT_SELECT = 1;
|
const int DB_GRANT_SELECT = 1;
|
||||||
const int DB_GRANT_INSERT = 2;
|
const int DB_GRANT_INSERT = 2;
|
||||||
const int DB_GRANT_UPDATE = 4;
|
const int DB_GRANT_UPDATE = 4;
|
||||||
const int DB_GRANT_DELETE = 8;
|
const int DB_GRANT_DELETE = 8;
|
||||||
const int DB_GRANT_ALL = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE;
|
const int DB_GRANT_ALL = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE;
|
||||||
|
|
||||||
// ODBC Error codes (derived from ODBC SqlState codes)
|
// ODBC Error codes (derived from ODBC SqlState codes)
|
||||||
enum ODBC_ERRORS
|
enum ODBC_ERRORS
|
||||||
{
|
{
|
||||||
DB_FAILURE = 0,
|
DB_FAILURE = 0,
|
||||||
DB_SUCCESS = 1,
|
DB_SUCCESS = 1,
|
||||||
DB_ERR_NOT_IN_USE,
|
DB_ERR_NOT_IN_USE,
|
||||||
DB_ERR_GENERAL_WARNING, // SqlState = '01000'
|
DB_ERR_GENERAL_WARNING, // SqlState = '01000'
|
||||||
DB_ERR_DISCONNECT_ERROR, // SqlState = '01002'
|
DB_ERR_DISCONNECT_ERROR, // SqlState = '01002'
|
||||||
DB_ERR_DATA_TRUNCATED, // SqlState = '01004'
|
DB_ERR_DATA_TRUNCATED, // SqlState = '01004'
|
||||||
DB_ERR_PRIV_NOT_REVOKED, // SqlState = '01006'
|
DB_ERR_PRIV_NOT_REVOKED, // SqlState = '01006'
|
||||||
DB_ERR_INVALID_CONN_STR_ATTR, // SqlState = '01S00'
|
DB_ERR_INVALID_CONN_STR_ATTR, // SqlState = '01S00'
|
||||||
DB_ERR_ERROR_IN_ROW, // SqlState = '01S01'
|
DB_ERR_ERROR_IN_ROW, // SqlState = '01S01'
|
||||||
DB_ERR_OPTION_VALUE_CHANGED, // SqlState = '01S02'
|
DB_ERR_OPTION_VALUE_CHANGED, // SqlState = '01S02'
|
||||||
DB_ERR_NO_ROWS_UPD_OR_DEL, // SqlState = '01S03'
|
DB_ERR_NO_ROWS_UPD_OR_DEL, // SqlState = '01S03'
|
||||||
DB_ERR_MULTI_ROWS_UPD_OR_DEL, // SqlState = '01S04'
|
DB_ERR_MULTI_ROWS_UPD_OR_DEL, // SqlState = '01S04'
|
||||||
DB_ERR_WRONG_NO_OF_PARAMS, // SqlState = '07001'
|
DB_ERR_WRONG_NO_OF_PARAMS, // SqlState = '07001'
|
||||||
DB_ERR_DATA_TYPE_ATTR_VIOL, // SqlState = '07006'
|
DB_ERR_DATA_TYPE_ATTR_VIOL, // SqlState = '07006'
|
||||||
DB_ERR_UNABLE_TO_CONNECT, // SqlState = '08001'
|
DB_ERR_UNABLE_TO_CONNECT, // SqlState = '08001'
|
||||||
DB_ERR_CONNECTION_IN_USE, // SqlState = '08002'
|
DB_ERR_CONNECTION_IN_USE, // SqlState = '08002'
|
||||||
DB_ERR_CONNECTION_NOT_OPEN, // SqlState = '08003'
|
DB_ERR_CONNECTION_NOT_OPEN, // SqlState = '08003'
|
||||||
DB_ERR_REJECTED_CONNECTION, // SqlState = '08004'
|
DB_ERR_REJECTED_CONNECTION, // SqlState = '08004'
|
||||||
DB_ERR_CONN_FAIL_IN_TRANS, // SqlState = '08007'
|
DB_ERR_CONN_FAIL_IN_TRANS, // SqlState = '08007'
|
||||||
DB_ERR_COMM_LINK_FAILURE, // SqlState = '08S01'
|
DB_ERR_COMM_LINK_FAILURE, // SqlState = '08S01'
|
||||||
DB_ERR_INSERT_VALUE_LIST_MISMATCH, // SqlState = '21S01'
|
DB_ERR_INSERT_VALUE_LIST_MISMATCH, // SqlState = '21S01'
|
||||||
DB_ERR_DERIVED_TABLE_MISMATCH, // SqlState = '21S02'
|
DB_ERR_DERIVED_TABLE_MISMATCH, // SqlState = '21S02'
|
||||||
DB_ERR_STRING_RIGHT_TRUNC, // SqlState = '22001'
|
DB_ERR_STRING_RIGHT_TRUNC, // SqlState = '22001'
|
||||||
DB_ERR_NUMERIC_VALUE_OUT_OF_RNG, // SqlState = '22003'
|
DB_ERR_NUMERIC_VALUE_OUT_OF_RNG, // SqlState = '22003'
|
||||||
DB_ERR_ERROR_IN_ASSIGNMENT, // SqlState = '22005'
|
DB_ERR_ERROR_IN_ASSIGNMENT, // SqlState = '22005'
|
||||||
DB_ERR_DATETIME_FLD_OVERFLOW, // SqlState = '22008'
|
DB_ERR_DATETIME_FLD_OVERFLOW, // SqlState = '22008'
|
||||||
DB_ERR_DIVIDE_BY_ZERO, // SqlState = '22012'
|
DB_ERR_DIVIDE_BY_ZERO, // SqlState = '22012'
|
||||||
DB_ERR_STR_DATA_LENGTH_MISMATCH, // SqlState = '22026'
|
DB_ERR_STR_DATA_LENGTH_MISMATCH, // SqlState = '22026'
|
||||||
DB_ERR_INTEGRITY_CONSTRAINT_VIOL, // SqlState = '23000'
|
DB_ERR_INTEGRITY_CONSTRAINT_VIOL, // SqlState = '23000'
|
||||||
DB_ERR_INVALID_CURSOR_STATE, // SqlState = '24000'
|
DB_ERR_INVALID_CURSOR_STATE, // SqlState = '24000'
|
||||||
DB_ERR_INVALID_TRANS_STATE, // SqlState = '25000'
|
DB_ERR_INVALID_TRANS_STATE, // SqlState = '25000'
|
||||||
DB_ERR_INVALID_AUTH_SPEC, // SqlState = '28000'
|
DB_ERR_INVALID_AUTH_SPEC, // SqlState = '28000'
|
||||||
DB_ERR_INVALID_CURSOR_NAME, // SqlState = '34000'
|
DB_ERR_INVALID_CURSOR_NAME, // SqlState = '34000'
|
||||||
DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL, // SqlState = '37000'
|
DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL, // SqlState = '37000'
|
||||||
DB_ERR_DUPLICATE_CURSOR_NAME, // SqlState = '3C000'
|
DB_ERR_DUPLICATE_CURSOR_NAME, // SqlState = '3C000'
|
||||||
DB_ERR_SERIALIZATION_FAILURE, // SqlState = '40001'
|
DB_ERR_SERIALIZATION_FAILURE, // SqlState = '40001'
|
||||||
DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2, // SqlState = '42000'
|
DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2, // SqlState = '42000'
|
||||||
DB_ERR_OPERATION_ABORTED, // SqlState = '70100'
|
DB_ERR_OPERATION_ABORTED, // SqlState = '70100'
|
||||||
DB_ERR_UNSUPPORTED_FUNCTION, // SqlState = 'IM001'
|
DB_ERR_UNSUPPORTED_FUNCTION, // SqlState = 'IM001'
|
||||||
DB_ERR_NO_DATA_SOURCE, // SqlState = 'IM002'
|
DB_ERR_NO_DATA_SOURCE, // SqlState = 'IM002'
|
||||||
DB_ERR_DRIVER_LOAD_ERROR, // SqlState = 'IM003'
|
DB_ERR_DRIVER_LOAD_ERROR, // SqlState = 'IM003'
|
||||||
DB_ERR_SQLALLOCENV_FAILED, // SqlState = 'IM004'
|
DB_ERR_SQLALLOCENV_FAILED, // SqlState = 'IM004'
|
||||||
DB_ERR_SQLALLOCCONNECT_FAILED, // SqlState = 'IM005'
|
DB_ERR_SQLALLOCCONNECT_FAILED, // SqlState = 'IM005'
|
||||||
DB_ERR_SQLSETCONNECTOPTION_FAILED, // SqlState = 'IM006'
|
DB_ERR_SQLSETCONNECTOPTION_FAILED, // SqlState = 'IM006'
|
||||||
DB_ERR_NO_DATA_SOURCE_DLG_PROHIB, // SqlState = 'IM007'
|
DB_ERR_NO_DATA_SOURCE_DLG_PROHIB, // SqlState = 'IM007'
|
||||||
DB_ERR_DIALOG_FAILED, // SqlState = 'IM008'
|
DB_ERR_DIALOG_FAILED, // SqlState = 'IM008'
|
||||||
DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL, // SqlState = 'IM009'
|
DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL, // SqlState = 'IM009'
|
||||||
DB_ERR_DATA_SOURCE_NAME_TOO_LONG, // SqlState = 'IM010'
|
DB_ERR_DATA_SOURCE_NAME_TOO_LONG, // SqlState = 'IM010'
|
||||||
DB_ERR_DRIVER_NAME_TOO_LONG, // SqlState = 'IM011'
|
DB_ERR_DRIVER_NAME_TOO_LONG, // SqlState = 'IM011'
|
||||||
DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR, // SqlState = 'IM012'
|
DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR, // SqlState = 'IM012'
|
||||||
DB_ERR_TRACE_FILE_ERROR, // SqlState = 'IM013'
|
DB_ERR_TRACE_FILE_ERROR, // SqlState = 'IM013'
|
||||||
DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS, // SqlState = 'S0001'
|
DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS, // SqlState = 'S0001'
|
||||||
DB_ERR_TABLE_NOT_FOUND, // SqlState = 'S0002'
|
DB_ERR_TABLE_NOT_FOUND, // SqlState = 'S0002'
|
||||||
DB_ERR_INDEX_ALREADY_EXISTS, // SqlState = 'S0011'
|
DB_ERR_INDEX_ALREADY_EXISTS, // SqlState = 'S0011'
|
||||||
DB_ERR_INDEX_NOT_FOUND, // SqlState = 'S0012'
|
DB_ERR_INDEX_NOT_FOUND, // SqlState = 'S0012'
|
||||||
DB_ERR_COLUMN_ALREADY_EXISTS, // SqlState = 'S0021'
|
DB_ERR_COLUMN_ALREADY_EXISTS, // SqlState = 'S0021'
|
||||||
DB_ERR_COLUMN_NOT_FOUND, // SqlState = 'S0022'
|
DB_ERR_COLUMN_NOT_FOUND, // SqlState = 'S0022'
|
||||||
DB_ERR_NO_DEFAULT_FOR_COLUMN, // SqlState = 'S0023'
|
DB_ERR_NO_DEFAULT_FOR_COLUMN, // SqlState = 'S0023'
|
||||||
DB_ERR_GENERAL_ERROR, // SqlState = 'S1000'
|
DB_ERR_GENERAL_ERROR, // SqlState = 'S1000'
|
||||||
DB_ERR_MEMORY_ALLOCATION_FAILURE, // SqlState = 'S1001'
|
DB_ERR_MEMORY_ALLOCATION_FAILURE, // SqlState = 'S1001'
|
||||||
DB_ERR_INVALID_COLUMN_NUMBER, // SqlState = 'S1002'
|
DB_ERR_INVALID_COLUMN_NUMBER, // SqlState = 'S1002'
|
||||||
DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE, // SqlState = 'S1003'
|
DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE, // SqlState = 'S1003'
|
||||||
DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE, // SqlState = 'S1004'
|
DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE, // SqlState = 'S1004'
|
||||||
DB_ERR_OPERATION_CANCELLED, // SqlState = 'S1008'
|
DB_ERR_OPERATION_CANCELLED, // SqlState = 'S1008'
|
||||||
DB_ERR_INVALID_ARGUMENT_VALUE, // SqlState = 'S1009'
|
DB_ERR_INVALID_ARGUMENT_VALUE, // SqlState = 'S1009'
|
||||||
DB_ERR_FUNCTION_SEQUENCE_ERROR, // SqlState = 'S1010'
|
DB_ERR_FUNCTION_SEQUENCE_ERROR, // SqlState = 'S1010'
|
||||||
DB_ERR_OPERATION_INVALID_AT_THIS_TIME, // SqlState = 'S1011'
|
DB_ERR_OPERATION_INVALID_AT_THIS_TIME, // SqlState = 'S1011'
|
||||||
DB_ERR_INVALID_TRANS_OPERATION_CODE, // SqlState = 'S1012'
|
DB_ERR_INVALID_TRANS_OPERATION_CODE, // SqlState = 'S1012'
|
||||||
DB_ERR_NO_CURSOR_NAME_AVAIL, // SqlState = 'S1015'
|
DB_ERR_NO_CURSOR_NAME_AVAIL, // SqlState = 'S1015'
|
||||||
DB_ERR_INVALID_STR_OR_BUF_LEN, // SqlState = 'S1090'
|
DB_ERR_INVALID_STR_OR_BUF_LEN, // SqlState = 'S1090'
|
||||||
DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE, // SqlState = 'S1091'
|
DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE, // SqlState = 'S1091'
|
||||||
DB_ERR_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1092'
|
DB_ERR_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1092'
|
||||||
DB_ERR_INVALID_PARAM_NO, // SqlState = 'S1093'
|
DB_ERR_INVALID_PARAM_NO, // SqlState = 'S1093'
|
||||||
DB_ERR_INVALID_SCALE_VALUE, // SqlState = 'S1094'
|
DB_ERR_INVALID_SCALE_VALUE, // SqlState = 'S1094'
|
||||||
DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1095'
|
DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1095'
|
||||||
DB_ERR_INF_TYPE_OUT_OF_RANGE, // SqlState = 'S1096'
|
DB_ERR_INF_TYPE_OUT_OF_RANGE, // SqlState = 'S1096'
|
||||||
DB_ERR_COLUMN_TYPE_OUT_OF_RANGE, // SqlState = 'S1097'
|
DB_ERR_COLUMN_TYPE_OUT_OF_RANGE, // SqlState = 'S1097'
|
||||||
DB_ERR_SCOPE_TYPE_OUT_OF_RANGE, // SqlState = 'S1098'
|
DB_ERR_SCOPE_TYPE_OUT_OF_RANGE, // SqlState = 'S1098'
|
||||||
DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE, // SqlState = 'S1099'
|
DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE, // SqlState = 'S1099'
|
||||||
DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1100'
|
DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1100'
|
||||||
DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1101'
|
DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1101'
|
||||||
DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE, // SqlState = 'S1103'
|
DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE, // SqlState = 'S1103'
|
||||||
DB_ERR_INVALID_PRECISION_VALUE, // SqlState = 'S1104'
|
DB_ERR_INVALID_PRECISION_VALUE, // SqlState = 'S1104'
|
||||||
DB_ERR_INVALID_PARAM_TYPE, // SqlState = 'S1105'
|
DB_ERR_INVALID_PARAM_TYPE, // SqlState = 'S1105'
|
||||||
DB_ERR_FETCH_TYPE_OUT_OF_RANGE, // SqlState = 'S1106'
|
DB_ERR_FETCH_TYPE_OUT_OF_RANGE, // SqlState = 'S1106'
|
||||||
DB_ERR_ROW_VALUE_OUT_OF_RANGE, // SqlState = 'S1107'
|
DB_ERR_ROW_VALUE_OUT_OF_RANGE, // SqlState = 'S1107'
|
||||||
DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE, // SqlState = 'S1108'
|
DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE, // SqlState = 'S1108'
|
||||||
DB_ERR_INVALID_CURSOR_POSITION, // SqlState = 'S1109'
|
DB_ERR_INVALID_CURSOR_POSITION, // SqlState = 'S1109'
|
||||||
DB_ERR_INVALID_DRIVER_COMPLETION, // SqlState = 'S1110'
|
DB_ERR_INVALID_DRIVER_COMPLETION, // SqlState = 'S1110'
|
||||||
DB_ERR_INVALID_BOOKMARK_VALUE, // SqlState = 'S1111'
|
DB_ERR_INVALID_BOOKMARK_VALUE, // SqlState = 'S1111'
|
||||||
DB_ERR_DRIVER_NOT_CAPABLE, // SqlState = 'S1C00'
|
DB_ERR_DRIVER_NOT_CAPABLE, // SqlState = 'S1C00'
|
||||||
DB_ERR_TIMEOUT_EXPIRED // SqlState = 'S1T00'
|
DB_ERR_TIMEOUT_EXPIRED // SqlState = 'S1T00'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct DbStuff
|
struct DbStuff
|
||||||
{
|
{
|
||||||
HENV Henv;
|
HENV Henv;
|
||||||
char Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name
|
char Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name
|
||||||
char Uid[20+1]; // User ID
|
char Uid[20+1]; // User ID
|
||||||
char AuthStr[20+1]; // Authorization string (password)
|
char AuthStr[20+1]; // Authorization string (password)
|
||||||
|
|
||||||
char description[SQL_MAX_DSN_LENGTH+1]; // Not sure what the max length is
|
char description[SQL_MAX_DSN_LENGTH+1]; // Not sure what the max length is
|
||||||
char fileType[SQL_MAX_DSN_LENGTH+1]; // Not sure what the max length is
|
char fileType[SQL_MAX_DSN_LENGTH+1]; // Not sure what the max length is
|
||||||
|
|
||||||
// Optionals needed for some databases like dBase
|
// Optionals needed for some databases like dBase
|
||||||
char defaultDir[DB_PATH_MAX]; // Directory that db file resides in
|
char defaultDir[DB_PATH_MAX]; // Directory that db file resides in
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char TypeName[DB_TYPE_NAME_LEN];
|
char TypeName[DB_TYPE_NAME_LEN];
|
||||||
int FsqlType;
|
int FsqlType;
|
||||||
long Precision;
|
long Precision;
|
||||||
short CaseSensitive;
|
short CaseSensitive;
|
||||||
// short MinimumScale;
|
// short MinimumScale;
|
||||||
short MaximumScale;
|
short MaximumScale;
|
||||||
} SqlTypeInfo;
|
} SqlTypeInfo;
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxColFor
|
class WXDLLEXPORT wxColFor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxString s_Field; // Formated String for Output
|
wxString s_Field; // Formated String for Output
|
||||||
wxString s_Format[7]; // Formated Objekts - TIMESTAMP has the biggest (7)
|
wxString s_Format[7]; // Formated Objects - TIMESTAMP has the biggest (7)
|
||||||
wxString s_Menge[7]; // Formated Objekts - amount of things that can be formatted
|
wxString s_Menge[7]; // Formated Objects - amount of things that can be formatted
|
||||||
int i_Menge[7]; // Formated Objekts - TT MM YYYY HH MM SS m
|
int i_Menge[7]; // Formated Objects - TT MM YYYY HH MM SS m
|
||||||
int i_Nation; // 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
|
int i_Nation; // 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
|
||||||
int i_dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes
|
int i_dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes
|
||||||
SWORD i_sqlDataType;
|
SWORD i_sqlDataType;
|
||||||
|
|
||||||
wxColFor();
|
wxColFor();
|
||||||
~wxColFor();
|
~wxColFor();
|
||||||
int Format(int Nation, int dbDataType,SWORD sqlDataType,short columnSize,short decimalDigits);
|
|
||||||
|
int Format(int Nation, int dbDataType, SWORD sqlDataType, short columnSize, short decimalDigits);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxColInf
|
class WXDLLEXPORT wxColInf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
char catalog[128+1];
|
char catalog[128+1];
|
||||||
char schema[128+1];
|
char schema[128+1];
|
||||||
char tableName[DB_MAX_TABLE_NAME_LEN+1];
|
char tableName[DB_MAX_TABLE_NAME_LEN+1];
|
||||||
char colName[DB_MAX_COLUMN_NAME_LEN+1];
|
char colName[DB_MAX_COLUMN_NAME_LEN+1];
|
||||||
SWORD sqlDataType;
|
SWORD sqlDataType;
|
||||||
char typeName[128+1];
|
char typeName[128+1];
|
||||||
SWORD columnSize;
|
SWORD columnSize;
|
||||||
SWORD bufferLength;
|
SWORD bufferLength;
|
||||||
short decimalDigits;
|
short decimalDigits;
|
||||||
short numPrecRadix;
|
short numPrecRadix;
|
||||||
short nullable;
|
short nullable;
|
||||||
char remarks[254+1];
|
char remarks[254+1];
|
||||||
int dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes
|
int dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes
|
||||||
// mj10777.19991224 : new
|
// mj10777.19991224 : new
|
||||||
int PkCol; // Primary key column 0=No; 1= First Key, 2 = Second Key etc.
|
int PkCol; // Primary key column 0=No; 1= First Key, 2 = Second Key etc.
|
||||||
char PkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Tables that use this PKey as a FKey
|
char PkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Tables that use this PKey as a FKey
|
||||||
int FkCol; // Foreign key column 0=No; 1= First Key, 2 = Second Key etc.
|
int FkCol; // Foreign key column 0=No; 1= First Key, 2 = Second Key etc.
|
||||||
char FkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Foreign key table name
|
char FkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Foreign key table name
|
||||||
wxColFor *pColFor; // How should this columns be formatted
|
wxColFor *pColFor; // How should this columns be formatted
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxTableInf // Description of a Table
|
class WXDLLEXPORT wxTableInf // Description of a Table
|
||||||
{ // mj10777 : used in wxDbInf and GetCatalog(..)
|
{
|
||||||
public:
|
public:
|
||||||
char tableName[DB_MAX_TABLE_NAME_LEN+1];
|
char tableName[DB_MAX_TABLE_NAME_LEN+1];
|
||||||
char tableType[254+1]; // "TABLE" or "SYSTEM TABLE" etc.
|
char tableType[254+1]; // "TABLE" or "SYSTEM TABLE" etc.
|
||||||
char tableRemarks[254+1];
|
char tableRemarks[254+1];
|
||||||
int numCols; // How many Columns does this Table have: GetColumnCount(..);
|
int numCols; // How many Columns does this Table have: GetColumnCount(..);
|
||||||
wxColInf *pColInf; // pColInf = NULL ; User can later call GetColumns(..);
|
wxColInf *pColInf; // pColInf = NULL ; User can later call GetColumns(..);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxDbInf // Description of a Database
|
class WXDLLEXPORT wxDbInf // Description of a Database
|
||||||
{ // mj10777 : used in GetCatalog(..)
|
{
|
||||||
public:
|
public:
|
||||||
char catalog[128+1];
|
char catalog[128+1];
|
||||||
char schema[128+1];
|
char schema[128+1];
|
||||||
int numTables; // How many tables does this database have
|
int numTables; // How many tables does this database have
|
||||||
wxTableInf *pTableInf; // pTableInf = new wxTableInf[numTables];
|
wxTableInf *pTableInf; // pTableInf = new wxTableInf[numTables];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum sqlLog
|
enum sqlLog
|
||||||
{
|
{
|
||||||
sqlLogOFF,
|
sqlLogOFF,
|
||||||
sqlLogON
|
sqlLogON
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// These are the databases currently tested and working with these classes
|
||||||
|
// See the comments in wxDB::Dbms() for exceptions/issues with
|
||||||
|
// each of these database engines
|
||||||
enum dbms
|
enum dbms
|
||||||
{
|
{
|
||||||
dbmsUNIDENTIFIED,
|
dbmsUNIDENTIFIED,
|
||||||
dbmsORACLE,
|
dbmsORACLE,
|
||||||
dbmsSYBASE_ASA, // Adaptive Server Anywhere
|
dbmsSYBASE_ASA, // Adaptive Server Anywhere
|
||||||
dbmsSYBASE_ASE, // Adaptive Server Enterprise
|
dbmsSYBASE_ASE, // Adaptive Server Enterprise
|
||||||
dbmsMS_SQL_SERVER,
|
dbmsMS_SQL_SERVER,
|
||||||
dbmsMY_SQL,
|
dbmsMY_SQL,
|
||||||
dbmsPOSTGRES,
|
dbmsPOSTGRES,
|
||||||
dbmsACCESS,
|
dbmsACCESS,
|
||||||
dbmsDBASE,
|
dbmsDBASE,
|
||||||
dbmsINFORMIX
|
dbmsINFORMIX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef enum dbms DBMS;
|
typedef enum dbms DBMS;
|
||||||
|
|
||||||
|
|
||||||
// The wxDB::errorList is copied to this variable when the wxDB object
|
// The wxDB::errorList is copied to this variable when the wxDB object
|
||||||
// is closed. This way, the error list is still available after the
|
// is closed. This way, the error list is still available after the
|
||||||
// database object is closed. This is necessary if the database
|
// database object is closed. This is necessary if the database
|
||||||
@@ -349,132 +352,131 @@ typedef enum dbms DBMS;
|
|||||||
// this variable.
|
// this variable.
|
||||||
extern char DBerrorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN];
|
extern char DBerrorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN];
|
||||||
|
|
||||||
|
|
||||||
// Backward compability for Remstar classes. This
|
// Backward compability for Remstar classes. This
|
||||||
// will eventually go away, so the wxColXxxx classes
|
// will eventually go away, so the wxColXxxx classes
|
||||||
// should be used
|
// should be used
|
||||||
typedef wxColInf CcolInf;
|
typedef wxColInf CcolInf;
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxDB
|
class WXDLLEXPORT wxDB
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
bool dbIsOpen;
|
bool dbIsOpen;
|
||||||
char *dsn; // Data source name
|
char *dsn; // Data source name
|
||||||
char *uid; // User ID
|
char *uid; // User ID
|
||||||
char *authStr; // Authorization string (password)
|
char *authStr; // Authorization string (password)
|
||||||
FILE *fpSqlLog; // Sql Log file pointer
|
FILE *fpSqlLog; // Sql Log file pointer
|
||||||
enum sqlLog sqlLogState; // On or Off
|
enum sqlLog sqlLogState; // On or Off
|
||||||
|
bool fwdOnlyCursors;
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
bool getDbInfo(void);
|
bool getDbInfo(void);
|
||||||
bool getDataTypeInfo(SWORD fSqlType, SqlTypeInfo &structSQLTypeInfo);
|
bool getDataTypeInfo(SWORD fSqlType, SqlTypeInfo &structSQLTypeInfo);
|
||||||
bool setConnectionOptions(void);
|
bool setConnectionOptions(void);
|
||||||
void logError(const char *errMsg, const char *SQLState);
|
void logError(const char *errMsg, const char *SQLState);
|
||||||
|
|
||||||
bool fwdOnlyCursors;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// The following structure contains database information gathered from the
|
||||||
|
// datasource when the datasource is first opened.
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char dbmsName[40]; // Name of the dbms product
|
||||||
|
char dbmsVer[64]; // Version # of the dbms product
|
||||||
|
char driverName[40]; // Driver name
|
||||||
|
char odbcVer[60]; // ODBC version of the driver
|
||||||
|
char drvMgrOdbcVer[60]; // ODBC version of the driver manager
|
||||||
|
char driverVer[60]; // Driver version
|
||||||
|
char serverName[80]; // Server Name, typically a connect string
|
||||||
|
char databaseName[128]; // Database filename
|
||||||
|
char outerJoins[2]; // Indicates whether the data source supports outer joins
|
||||||
|
char procedureSupport[2]; // Indicates whether the data source supports stored procedures
|
||||||
|
UWORD maxConnections; // Maximum # of connections the data source supports
|
||||||
|
UWORD maxStmts; // Maximum # of HSTMTs per HDBC
|
||||||
|
UWORD apiConfLvl; // ODBC API conformance level
|
||||||
|
UWORD cliConfLvl; // Indicates whether the data source is SAG compliant
|
||||||
|
UWORD sqlConfLvl; // SQL conformance level
|
||||||
|
UWORD cursorCommitBehavior; // Indicates how cursors are affected by a db commit
|
||||||
|
UWORD cursorRollbackBehavior; // Indicates how cursors are affected by a db rollback
|
||||||
|
UWORD supportNotNullClause; // Indicates if data source supports NOT NULL clause
|
||||||
|
char supportIEF[2]; // Integrity Enhancement Facility (Referential Integrity)
|
||||||
|
UDWORD txnIsolation; // Default transaction isolation level supported by the driver
|
||||||
|
UDWORD txnIsolationOptions; // Transaction isolation level options available
|
||||||
|
UDWORD fetchDirections; // Fetch directions supported
|
||||||
|
UDWORD lockTypes; // Lock types supported in SQLSetPos
|
||||||
|
UDWORD posOperations; // Position operations supported in SQLSetPos
|
||||||
|
UDWORD posStmts; // Position statements supported
|
||||||
|
UDWORD scrollConcurrency; // Concurrency control options supported for scrollable cursors
|
||||||
|
UDWORD scrollOptions; // Scroll Options supported for scrollable cursors
|
||||||
|
UDWORD staticSensitivity; // Indicates if additions, deletions and updates can be detected
|
||||||
|
UWORD txnCapable; // Indicates if the data source supports transactions
|
||||||
|
UDWORD loginTimeout; // Number seconds to wait for a login request
|
||||||
|
} dbInf;
|
||||||
|
|
||||||
// The following structure contains database information gathered from the
|
// ODBC handles
|
||||||
// datasource when the datasource is first opened.
|
HENV henv; // ODBC Environment handle
|
||||||
struct
|
HDBC hdbc; // ODBC DB Connection handle
|
||||||
{
|
HSTMT hstmt; // ODBC Statement handle
|
||||||
char dbmsName[40]; // Name of the dbms product
|
|
||||||
char dbmsVer[64]; // Version # of the dbms product
|
|
||||||
char driverName[40]; // Driver name
|
|
||||||
char odbcVer[60]; // ODBC version of the driver
|
|
||||||
char drvMgrOdbcVer[60]; // ODBC version of the driver manager
|
|
||||||
char driverVer[60]; // Driver version
|
|
||||||
char serverName[80]; // Server Name, typically a connect string
|
|
||||||
char databaseName[128]; // Database filename
|
|
||||||
char outerJoins[2]; // Indicates whether the data source supports outer joins
|
|
||||||
char procedureSupport[2]; // Indicates whether the data source supports stored procedures
|
|
||||||
UWORD maxConnections; // Maximum # of connections the data source supports
|
|
||||||
UWORD maxStmts; // Maximum # of HSTMTs per HDBC
|
|
||||||
UWORD apiConfLvl; // ODBC API conformance level
|
|
||||||
UWORD cliConfLvl; // Indicates whether the data source is SAG compliant
|
|
||||||
UWORD sqlConfLvl; // SQL conformance level
|
|
||||||
UWORD cursorCommitBehavior; // Indicates how cursors are affected by a db commit
|
|
||||||
UWORD cursorRollbackBehavior; // Indicates how cursors are affected by a db rollback
|
|
||||||
UWORD supportNotNullClause; // Indicates if data source supports NOT NULL clause
|
|
||||||
char supportIEF[2]; // Integrity Enhancement Facility (Referential Integrity)
|
|
||||||
UDWORD txnIsolation; // Default transaction isolation level supported by the driver
|
|
||||||
UDWORD txnIsolationOptions; // Transaction isolation level options available
|
|
||||||
UDWORD fetchDirections; // Fetch directions supported
|
|
||||||
UDWORD lockTypes; // Lock types supported in SQLSetPos
|
|
||||||
UDWORD posOperations; // Position operations supported in SQLSetPos
|
|
||||||
UDWORD posStmts; // Position statements supported
|
|
||||||
UDWORD scrollConcurrency; // Concurrency control options supported for scrollable cursors
|
|
||||||
UDWORD scrollOptions; // Scroll Options supported for scrollable cursors
|
|
||||||
UDWORD staticSensitivity; // Indicates if additions, deletions and updates can be detected
|
|
||||||
UWORD txnCapable; // Indicates if the data source supports transactions
|
|
||||||
UDWORD loginTimeout; // Number seconds to wait for a login request
|
|
||||||
} dbInf;
|
|
||||||
|
|
||||||
// ODBC handles
|
// ODBC Error Inf.
|
||||||
HENV henv; // ODBC Environment handle
|
char sqlState[20];
|
||||||
HDBC hdbc; // ODBC DB Connection handle
|
SDWORD nativeError;
|
||||||
HSTMT hstmt; // ODBC Statement handle
|
char errorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||||
|
SWORD cbErrorMsg;
|
||||||
|
char errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN];
|
||||||
|
int DB_STATUS;
|
||||||
|
|
||||||
// ODBC Error Inf.
|
//Error reporting mode
|
||||||
char sqlState[20];
|
bool silent;
|
||||||
SDWORD nativeError;
|
|
||||||
char errorMsg[SQL_MAX_MESSAGE_LENGTH];
|
|
||||||
SWORD cbErrorMsg;
|
|
||||||
char errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN];
|
|
||||||
int DB_STATUS;
|
|
||||||
|
|
||||||
//Error reporting mode
|
// Number of Ctable objects connected to this db object
|
||||||
bool silent;
|
unsigned int nTables;
|
||||||
|
|
||||||
// Number of Ctable objects connected to this db object
|
// Inf. about logical data types VARCHAR, INTEGER, FLOAT and DATE.
|
||||||
unsigned int nTables;
|
// This inf. is obtained from the ODBC driver by use of the
|
||||||
|
// SQLGetTypeInfo() function. The key piece of inf. is the
|
||||||
// Inf. about logical data types VARCHAR, INTEGER, FLOAT and DATE.
|
// type name the data source uses for each logical data type.
|
||||||
// This inf. is obtained from the ODBC driver by use of the
|
// e.g. VARCHAR; Oracle calls it VARCHAR2.
|
||||||
// SQLGetTypeInfo() function. The key piece of inf. is the
|
SqlTypeInfo typeInfVarchar, typeInfInteger, typeInfFloat, typeInfDate;
|
||||||
// type name the data source uses for each logical data type.
|
|
||||||
// e.g. VARCHAR; Oracle calls it VARCHAR2.
|
// Public member functions
|
||||||
SqlTypeInfo typeInfVarchar, typeInfInteger, typeInfFloat, typeInfDate;
|
wxDB(HENV &aHenv, bool FwdOnlyCursors=(bool)TRUE);
|
||||||
|
bool Open(char *Dsn, char *Uid, char *AuthStr); // Data Source Name, User ID, Password
|
||||||
// Public member functions
|
void Close(void);
|
||||||
wxDB(HENV &aHenv, bool FwdOnlyCursors=(bool)TRUE);
|
bool CommitTrans(void);
|
||||||
bool Open(char *Dsn, char *Uid, char *AuthStr); // Data Source Name, User ID, Password
|
bool RollbackTrans(void);
|
||||||
void Close(void);
|
bool DispAllErrors(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT);
|
||||||
bool CommitTrans(void);
|
bool GetNextError(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT);
|
||||||
bool RollbackTrans(void);
|
void DispNextError(void);
|
||||||
bool DispAllErrors(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT);
|
bool CreateView(const char *viewName, const char *colList, const char *pSqlStmt, bool attemptDrop=TRUE);
|
||||||
bool GetNextError(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT);
|
bool DropView(const char *viewName);
|
||||||
void DispNextError(void);
|
bool ExecSql(const char *pSqlStmt);
|
||||||
bool CreateView(const char *viewName, const char *colList, const char *pSqlStmt, bool attemptDrop=TRUE);
|
bool GetNext(void);
|
||||||
bool DropView(const char *viewName);
|
bool GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned);
|
||||||
bool ExecSql(const char *pSqlStmt);
|
bool Grant(int privileges, const char *tableName, const char *userList = "PUBLIC");
|
||||||
bool GetNext(void);
|
int TranslateSqlState(const char *SQLState);
|
||||||
bool GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned);
|
wxDbInf *GetCatalog(char *userID);
|
||||||
bool Grant(int privileges, const char *tableName, const char *userList = "PUBLIC");
|
bool Catalog(const char *userID=NULL, const char *fileName = SQL_CATALOG_FILENAME);
|
||||||
int TranslateSqlState(const char *SQLState);
|
|
||||||
wxDbInf *GetCatalog(char *userID);
|
|
||||||
bool Catalog(const char *userID=NULL, const char *fileName = "Catalog.txt");
|
|
||||||
int GetKeyFields(char *tableName, wxColInf* colInf,int nocols);
|
int GetKeyFields(char *tableName, wxColInf* colInf,int nocols);
|
||||||
wxColInf *GetColumns(char *tableName[], const char *userID=NULL);
|
wxColInf *GetColumns(char *tableName[], const char *userID=NULL);
|
||||||
wxColInf *GetColumns(char *tableName, int *numCols, const char *userID=NULL);
|
wxColInf *GetColumns(char *tableName, int *numCols, const char *userID=NULL);
|
||||||
int GetColumnCount(char *tableName, const char *userID=NULL);
|
int GetColumnCount(char *tableName, const char *userID=NULL);
|
||||||
char *GetDatabaseName(void) {return dbInf.dbmsName;}
|
char *GetDatabaseName(void) {return dbInf.dbmsName;}
|
||||||
char *GetDataSource(void) {return dsn;}
|
char *GetDataSource(void) {return dsn;}
|
||||||
char *GetUsername(void) {return uid;}
|
char *GetUsername(void) {return uid;}
|
||||||
char *GetPassword(void) {return authStr;}
|
char *GetPassword(void) {return authStr;}
|
||||||
bool IsOpen(void) {return dbIsOpen;}
|
bool IsOpen(void) {return dbIsOpen;}
|
||||||
HENV GetHENV(void) {return henv;}
|
HENV GetHENV(void) {return henv;}
|
||||||
HDBC GetHDBC(void) {return hdbc;}
|
HDBC GetHDBC(void) {return hdbc;}
|
||||||
HSTMT GetHSTMT(void) {return hstmt;}
|
HSTMT GetHSTMT(void) {return hstmt;}
|
||||||
bool TableExists(const char *tableName, const char *userID=NULL, const char *path=NULL); // Table name can refer to a table, view, alias or synonym
|
bool TableExists(const char *tableName, const char *userID=NULL, const char *path=NULL); // Table name can refer to a table, view, alias or synonym
|
||||||
void LogError(const char *errMsg, const char *SQLState = 0) {logError(errMsg, SQLState);}
|
void LogError(const char *errMsg, const char *SQLState = 0) {logError(errMsg, SQLState);}
|
||||||
bool SqlLog(enum sqlLog state, const char *filename = "sqllog.txt", bool append = FALSE);
|
bool SqlLog(enum sqlLog state, const char *filename = SQL_LOG_FILENAME, bool append = FALSE);
|
||||||
bool WriteSqlLog(const char *logMsg);
|
bool WriteSqlLog(const char *logMsg);
|
||||||
DBMS Dbms(void);
|
DBMS Dbms(void);
|
||||||
bool FwdOnlyCursors(void) {return fwdOnlyCursors;}
|
bool FwdOnlyCursors(void) {return fwdOnlyCursors;}
|
||||||
|
|
||||||
}; // wxDB
|
}; // wxDB
|
||||||
|
|
||||||
// This structure forms a node in a linked list. The linked list of "DbList" objects
|
// This structure forms a node in a linked list. The linked list of "DbList" objects
|
||||||
@@ -484,11 +486,11 @@ public:
|
|||||||
|
|
||||||
struct DbList
|
struct DbList
|
||||||
{
|
{
|
||||||
DbList *PtrPrev; // Pointer to previous item in the list
|
DbList *PtrPrev; // Pointer to previous item in the list
|
||||||
char Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name
|
char Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name
|
||||||
wxDB *PtrDb; // Pointer to the wxDB object
|
wxDB *PtrDb; // Pointer to the wxDB object
|
||||||
bool Free; // Is item free or in use?
|
bool Free; // Is item free or in use?
|
||||||
DbList *PtrNext; // Pointer to next item in the list
|
DbList *PtrNext; // Pointer to next item in the list
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -496,10 +498,10 @@ struct DbList
|
|||||||
#include "wx/object.h"
|
#include "wx/object.h"
|
||||||
class CstructTablesInUse : public wxObject
|
class CstructTablesInUse : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const char *tableName;
|
const char *tableName;
|
||||||
ULONG tableID;
|
ULONG tableID;
|
||||||
class wxDB *pDb;
|
class wxDB *pDb;
|
||||||
}; // CstructTablesInUse
|
}; // CstructTablesInUse
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -507,19 +509,21 @@ class CstructTablesInUse : public wxObject
|
|||||||
// for other code segments to use, or close all of them when the application has
|
// for other code segments to use, or close all of them when the application has
|
||||||
// completed.
|
// completed.
|
||||||
|
|
||||||
wxDB WXDLLEXPORT *GetDbConnection(DbStuff *pDbStuff, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS);
|
wxDB WXDLLEXPORT *GetDbConnection(DbStuff *pDbStuff, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS);
|
||||||
bool WXDLLEXPORT FreeDbConnection(wxDB *pDb);
|
bool WXDLLEXPORT FreeDbConnection(wxDB *pDb);
|
||||||
void WXDLLEXPORT CloseDbConnections(void);
|
void WXDLLEXPORT CloseDbConnections(void);
|
||||||
int WXDLLEXPORT NumberDbConnectionsInUse(void);
|
int WXDLLEXPORT NumberDbConnectionsInUse(void);
|
||||||
|
|
||||||
|
|
||||||
// This function sets the sql log state for all open wxDB objects
|
// This function sets the sql log state for all open wxDB objects
|
||||||
bool SqlLog(enum sqlLog state, const char *filename = "sqllog.txt");
|
bool SqlLog(enum sqlLog state, const char *filename = SQL_LOG_FILENAME);
|
||||||
|
|
||||||
|
|
||||||
// This routine allows you to query a driver manager
|
// This routine allows you to query a driver manager
|
||||||
// for a list of available datasources. Call this routine
|
// for a list of available datasources. Call this routine
|
||||||
// the first time using SQL_FETCH_FIRST. Continue to call it
|
// the first time using SQL_FETCH_FIRST. Continue to call it
|
||||||
// using SQL_FETCH_NEXT until you've exhausted the list.
|
// using SQL_FETCH_NEXT until you've exhausted the list.
|
||||||
bool WXDLLEXPORT GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDescMax,
|
bool WXDLLEXPORT GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDescMax,
|
||||||
UWORD direction = SQL_FETCH_NEXT);
|
UWORD direction = SQL_FETCH_NEXT);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1996 Remstar International, Inc.
|
// Copyright: (c) 1996 Remstar International, Inc.
|
||||||
// Licence: wxWindows licence, plus:
|
// Licence: wxWindows licence, plus:
|
||||||
// Notice: This class library and its intellectual design are free of charge for use,
|
// Notice: This class library and its intellectual design are free of charge for use,
|
||||||
// modification, enhancement, debugging under the following conditions:
|
// modification, enhancement, debugging under the following conditions:
|
||||||
// 1) These classes may only be used as part of the implementation of a
|
// 1) These classes may only be used as part of the implementation of a
|
||||||
// wxWindows-based application
|
// wxWindows-based application
|
||||||
@@ -32,21 +32,21 @@
|
|||||||
#include "wx/version.h"
|
#include "wx/version.h"
|
||||||
|
|
||||||
#if wxMAJOR_VERSION == 2
|
#if wxMAJOR_VERSION == 2
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "dbtable.h"
|
#pragma interface "dbtable.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxMAJOR_VERSION == 2
|
#if wxMAJOR_VERSION == 2
|
||||||
#include "wx/db.h"
|
#include "wx/db.h"
|
||||||
#else
|
#else
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger
|
const int ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger
|
||||||
const int DEFAULT_CURSOR = 0;
|
const int DEFAULT_CURSOR = 0;
|
||||||
const bool QUERY_ONLY = TRUE;
|
const bool QUERY_ONLY = TRUE;
|
||||||
const bool DISABLE_VIEW = TRUE;
|
const bool DISABLE_VIEW = TRUE;
|
||||||
|
|
||||||
// The following class is used to define a column of a table.
|
// The following class is used to define a column of a table.
|
||||||
// The wxTable constructor will dynamically allocate as many of
|
// The wxTable constructor will dynamically allocate as many of
|
||||||
@@ -59,157 +59,155 @@ const bool DISABLE_VIEW = TRUE;
|
|||||||
class WXDLLEXPORT wxColDef
|
class WXDLLEXPORT wxColDef
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
char ColName[DB_MAX_COLUMN_NAME_LEN+1]; // Column Name
|
char ColName[DB_MAX_COLUMN_NAME_LEN+1]; // Column Name
|
||||||
int DbDataType; // Logical Data Type; e.g. DB_DATA_TYPE_INTEGER
|
int DbDataType; // Logical Data Type; e.g. DB_DATA_TYPE_INTEGER
|
||||||
int SqlCtype; // C data type; e.g. SQL_C_LONG
|
int SqlCtype; // C data type; e.g. SQL_C_LONG
|
||||||
void *PtrDataObj; // Address of the data object
|
void *PtrDataObj; // Address of the data object
|
||||||
int SzDataObj; // Size, in bytes, of the data object
|
int SzDataObj; // Size, in bytes, of the data object
|
||||||
bool KeyField; // TRUE if this column is part of the PRIMARY KEY to the table; Date fields should NOT be KeyFields.
|
bool KeyField; // TRUE if this column is part of the PRIMARY KEY to the table; Date fields should NOT be KeyFields.
|
||||||
bool Updateable; // Specifies whether this column is updateable
|
bool Updateable; // Specifies whether this column is updateable
|
||||||
bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement
|
bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement
|
||||||
bool DerivedCol; // Specifies whether this column is a derived value
|
bool DerivedCol; // Specifies whether this column is a derived value
|
||||||
SDWORD CbValue; // Internal use only!!!
|
SDWORD CbValue; // Internal use only!!!
|
||||||
bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates
|
bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates
|
||||||
}; // wxColDef
|
}; // wxColDef
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxColDataPtr
|
class WXDLLEXPORT wxColDataPtr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void *PtrDataObj;
|
void *PtrDataObj;
|
||||||
int SzDataObj;
|
int SzDataObj;
|
||||||
int SqlCtype;
|
int SqlCtype;
|
||||||
}; // wxColDataPtr
|
}; // wxColDataPtr
|
||||||
|
|
||||||
|
|
||||||
// Backward compability for Remstar classes. These
|
// Backward compability for Remstar classes. These
|
||||||
// will eventually go away, so the wxColXxxx classes
|
// will eventually go away, so the wxColXxxx classes
|
||||||
// should be used
|
// should be used
|
||||||
typedef wxColDef CcolDef;
|
typedef wxColDef CcolDef;
|
||||||
typedef wxColDataPtr CcolDataPtr;
|
typedef wxColDataPtr CcolDataPtr;
|
||||||
|
|
||||||
|
|
||||||
// This structure is used when creating secondary indexes.
|
// This structure is used when creating secondary indexes.
|
||||||
class WXDLLEXPORT CidxDef
|
class WXDLLEXPORT CidxDef
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
char ColName[DB_MAX_COLUMN_NAME_LEN+1];
|
char ColName[DB_MAX_COLUMN_NAME_LEN+1];
|
||||||
bool Ascending;
|
bool Ascending;
|
||||||
}; // CidxDef
|
}; // CidxDef
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxTable
|
class WXDLLEXPORT wxTable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
ULONG tableID; // Used for debugging. This can help to match up mismatched constructors/destructors
|
||||||
|
|
||||||
ULONG tableID; // Used for debugging. This can help to match up mismatched constructors/destructors
|
// Private member variables
|
||||||
|
UDWORD cursorType;
|
||||||
|
|
||||||
// Private member variables
|
// Private member functions
|
||||||
UDWORD cursorType;
|
bool bindInsertParams(void);
|
||||||
|
bool bindUpdateParams(void);
|
||||||
// Private member functions
|
bool bindCols(HSTMT cursor);
|
||||||
bool bindInsertParams(void);
|
bool getRec(UWORD fetchType);
|
||||||
bool bindUpdateParams(void);
|
bool execDelete(const char *pSqlStmt);
|
||||||
bool bindCols(HSTMT cursor);
|
bool execUpdate(const char *pSqlStmt);
|
||||||
bool getRec(UWORD fetchType);
|
bool query(int queryType, bool forUpdate, bool distinct, char *pSqlStmt = 0);
|
||||||
bool execDelete(const char *pSqlStmt);
|
|
||||||
bool execUpdate(const char *pSqlStmt);
|
|
||||||
bool query(int queryType, bool forUpdate, bool distinct, char *pSqlStmt = 0);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Pointer to the database object this table belongs to
|
||||||
|
wxDB *pDb;
|
||||||
|
|
||||||
// Pointer to the database object this table belongs to
|
// ODBC Handles
|
||||||
wxDB *pDb;
|
HENV henv; // ODBC Environment handle
|
||||||
|
HDBC hdbc; // ODBC DB Connection handle
|
||||||
|
HSTMT hstmt; // ODBC Statement handle
|
||||||
|
HSTMT *hstmtDefault; // Default cursor
|
||||||
|
HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts
|
||||||
|
HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes
|
||||||
|
HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates
|
||||||
|
HSTMT hstmtInternal; // ODBC Statement handle used internally only
|
||||||
|
HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns)
|
||||||
|
|
||||||
// ODBC Handles
|
// Table Inf.
|
||||||
HENV henv; // ODBC Environment handle
|
char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name
|
||||||
HDBC hdbc; // ODBC DB Connection handle
|
char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name
|
||||||
HSTMT hstmt; // ODBC Statement handle
|
int noCols; // # of columns in the table
|
||||||
HSTMT *hstmtDefault; // Default cursor
|
bool queryOnly; // Query Only, no inserts, updates or deletes
|
||||||
HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts
|
|
||||||
HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes
|
|
||||||
HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates
|
|
||||||
HSTMT hstmtInternal; // ODBC Statement handle used internally only
|
|
||||||
HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns)
|
|
||||||
|
|
||||||
// Table Inf.
|
char tablePath[DB_PATH_MAX]; // needed for dBase tables
|
||||||
char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name
|
|
||||||
char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name
|
|
||||||
int noCols; // # of columns in the table
|
|
||||||
bool queryOnly; // Query Only, no inserts, updates or deletes
|
|
||||||
|
|
||||||
char tablePath[DB_PATH_MAX]; // needed for dBase tables
|
// Column Definitions
|
||||||
|
wxColDef *colDefs; // Array of wxColDef structures
|
||||||
|
|
||||||
// Column Definitions
|
// Where, Order By and From clauses
|
||||||
wxColDef *colDefs; // Array of wxColDef structures
|
char *where; // Standard SQL where clause, minus the word WHERE
|
||||||
|
char *orderBy; // Standard SQL order by clause, minus the ORDER BY
|
||||||
|
char *from; // Allows for joins in a wxTable::Query(). Format: ",tbl,tbl..."
|
||||||
|
|
||||||
// Where, Order By and From clauses
|
// Flags
|
||||||
char *where; // Standard SQL where clause, minus the word WHERE
|
bool selectForUpdate;
|
||||||
char *orderBy; // Standard SQL order by clause, minus the ORDER BY
|
|
||||||
char *from; // Allows for joins in a wxTable::Query(). Format: ",tbl,tbl..."
|
|
||||||
|
|
||||||
// Flags
|
// Public member functions
|
||||||
bool selectForUpdate;
|
wxTable(wxDB *pwxDB, const char *tblName, const int nCols,
|
||||||
|
const char *qryTblName = 0, bool qryOnly = !QUERY_ONLY, const char *tblPath=NULL);
|
||||||
|
virtual ~wxTable();
|
||||||
|
bool Open(void);
|
||||||
|
bool CreateTable(bool attemptDrop=TRUE);
|
||||||
|
bool DropTable(void);
|
||||||
|
bool CreateIndex(const char * idxName, bool unique, int noIdxCols, CidxDef *pIdxDefs, bool attemptDrop=TRUE);
|
||||||
|
bool DropIndex(const char * idxName);
|
||||||
|
bool CloseCursor(HSTMT cursor);
|
||||||
|
int Insert(void);
|
||||||
|
bool Update(void);
|
||||||
|
bool Update(const char *pSqlStmt);
|
||||||
|
bool UpdateWhere(const char *pWhereClause);
|
||||||
|
bool Delete(void);
|
||||||
|
bool DeleteWhere(const char *pWhereClause);
|
||||||
|
bool DeleteMatching(void);
|
||||||
|
virtual bool Query(bool forUpdate = FALSE, bool distinct = FALSE);
|
||||||
|
bool QueryBySqlStmt(char *pSqlStmt);
|
||||||
|
bool QueryMatching(bool forUpdate = FALSE, bool distinct = FALSE);
|
||||||
|
bool QueryOnKeyFields(bool forUpdate = FALSE, bool distinct = FALSE);
|
||||||
|
bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); }
|
||||||
|
bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); }
|
||||||
|
|
||||||
// Public member functions
|
/***** These four functions only work with wxDB instances that are defined *****
|
||||||
wxTable(wxDB *pwxDB, const char *tblName, const int nCols,
|
***** as not being FwdOnlyCursors *****/
|
||||||
const char *qryTblName = 0, bool qryOnly = !QUERY_ONLY, const char *tblPath=NULL);
|
bool GetPrev(void);
|
||||||
virtual ~wxTable();
|
bool operator--(int);
|
||||||
bool Open(void);
|
bool GetFirst(void);
|
||||||
bool CreateTable(bool attemptDrop=TRUE);
|
bool GetLast(void);
|
||||||
bool DropTable(void);
|
|
||||||
bool CreateIndex(const char * idxName, bool unique, int noIdxCols, CidxDef *pIdxDefs, bool attemptDrop=TRUE);
|
|
||||||
bool DropIndex(const char * idxName);
|
|
||||||
bool CloseCursor(HSTMT cursor);
|
|
||||||
int Insert(void);
|
|
||||||
bool Update(void);
|
|
||||||
bool Update(const char *pSqlStmt);
|
|
||||||
bool UpdateWhere(const char *pWhereClause);
|
|
||||||
bool Delete(void);
|
|
||||||
bool DeleteWhere(const char *pWhereClause);
|
|
||||||
bool DeleteMatching(void);
|
|
||||||
virtual bool Query(bool forUpdate = FALSE, bool distinct = FALSE);
|
|
||||||
bool QueryBySqlStmt(char *pSqlStmt);
|
|
||||||
bool QueryMatching(bool forUpdate = FALSE, bool distinct = FALSE);
|
|
||||||
bool QueryOnKeyFields(bool forUpdate = FALSE, bool distinct = FALSE);
|
|
||||||
bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); }
|
|
||||||
bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); }
|
|
||||||
|
|
||||||
/***** These four functions only work with wxDB instances that are defined *****
|
bool IsCursorClosedOnCommit(void);
|
||||||
***** as not being FwdOnlyCursors *****/
|
bool IsColNull(int colNo);
|
||||||
bool GetPrev(void);
|
UWORD GetRowNum(void);
|
||||||
bool operator--(int);
|
void GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct);
|
||||||
bool GetFirst(void);
|
void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = 0);
|
||||||
bool GetLast(void);
|
void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = 0);
|
||||||
|
void GetWhereClause(char *pWhereClause, int typeOfWhere, const char *qualTableName = 0);
|
||||||
|
bool CanSelectForUpdate(void);
|
||||||
|
bool CanUpdByROWID(void);
|
||||||
|
void ClearMemberVars(void);
|
||||||
|
bool SetQueryTimeout(UDWORD nSeconds);
|
||||||
|
void SetColDefs (int index, const char *fieldName, int dataType, void *pData, int cType,
|
||||||
|
int size, bool keyField = FALSE, bool upd = TRUE,
|
||||||
|
bool insAllow = TRUE, bool derivedCol = FALSE);
|
||||||
|
wxColDataPtr* SetColDefs (wxColInf *colInfs, ULONG numCols);
|
||||||
|
|
||||||
bool IsCursorClosedOnCommit(void);
|
HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE);
|
||||||
bool IsColNull(int colNo);
|
bool DeleteCursor(HSTMT *hstmtDel);
|
||||||
UWORD GetRowNum(void);
|
void SetCursor(HSTMT *hstmtActivate = (void **) DEFAULT_CURSOR);
|
||||||
void GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct);
|
HSTMT GetCursor(void) { return(hstmt); }
|
||||||
void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = 0);
|
ULONG Count(const char *args="*");
|
||||||
void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = 0);
|
int DB_STATUS(void) { return(pDb->DB_STATUS); }
|
||||||
void GetWhereClause(char *pWhereClause, int typeOfWhere, const char *qualTableName = 0);
|
bool Refresh(void);
|
||||||
bool CanSelectForUpdate(void);
|
bool SetNull(int colNo);
|
||||||
bool CanUpdByROWID(void);
|
bool SetNull(const char *colName);
|
||||||
void ClearMemberVars(void);
|
|
||||||
bool SetQueryTimeout(UDWORD nSeconds);
|
|
||||||
void SetColDefs (int index, const char *fieldName, int dataType, void *pData, int cType,
|
|
||||||
int size, bool keyField = FALSE, bool upd = TRUE,
|
|
||||||
bool insAllow = TRUE, bool derivedCol = FALSE);
|
|
||||||
// BJO20000121 : new prototype
|
|
||||||
// bool SetColDefs (wxColInf *colInfs, ULONG numCols, wxColDataPtr *pColDataPtrs);
|
|
||||||
wxColDataPtr* SetColDefs (wxColInf *colInfs, ULONG numCols);
|
|
||||||
|
|
||||||
HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE);
|
|
||||||
bool DeleteCursor(HSTMT *hstmtDel);
|
|
||||||
void SetCursor(HSTMT *hstmtActivate = (void **) DEFAULT_CURSOR);
|
|
||||||
HSTMT GetCursor(void) { return(hstmt); }
|
|
||||||
ULONG Count(const char *args="*");
|
|
||||||
int DB_STATUS(void) { return(pDb->DB_STATUS); }
|
|
||||||
bool Refresh(void);
|
|
||||||
bool SetNull(int colNo);
|
|
||||||
bool SetNull(const char *colName);
|
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
ULONG GetTableID() { return tableID; };
|
ULONG GetTableID() { return tableID; };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}; // wxTable
|
}; // wxTable
|
||||||
|
Reference in New Issue
Block a user