Unicode support
Several error conditions when connecting to databases are corrected git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -83,6 +83,11 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
#define SQL_C_WXCHAR SQL_C_WCHAR
|
||||||
|
#else
|
||||||
|
#define SQL_C_WXCHAR SQL_C_CHAR
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef float SFLOAT;
|
typedef float SFLOAT;
|
||||||
typedef double SDOUBLE;
|
typedef double SDOUBLE;
|
||||||
@@ -365,7 +370,7 @@ public:
|
|||||||
~wxDbColFor(){}
|
~wxDbColFor(){}
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
int Format(int Nation, int dbDataType, SWORD sqlDataType, short columnSize, short decimalDigits);
|
int Format(int Nation, int dbDataType, SWORD sqlDataType, short columnLength, short decimalDigits);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -378,8 +383,8 @@ public:
|
|||||||
wxChar colName[DB_MAX_COLUMN_NAME_LEN+1];
|
wxChar colName[DB_MAX_COLUMN_NAME_LEN+1];
|
||||||
SWORD sqlDataType;
|
SWORD sqlDataType;
|
||||||
wxChar typeName[128+1];
|
wxChar typeName[128+1];
|
||||||
SWORD columnSize;
|
SWORD columnLength;
|
||||||
SWORD bufferLength;
|
SWORD bufferSize;
|
||||||
short decimalDigits;
|
short decimalDigits;
|
||||||
short numPrecRadix;
|
short numPrecRadix;
|
||||||
short nullable;
|
short nullable;
|
||||||
@@ -750,8 +755,8 @@ int WXDLLEXPORT wxDbCreateDataSource(const wxString &driverName, const wxString
|
|||||||
// 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 WXDLLIMPEXP_ODBC
|
bool WXDLLIMPEXP_ODBC
|
||||||
wxDbGetDataSource(HENV henv, wxChar *Dsn, SWORD DsnMax, wxChar *DsDesc,
|
wxDbGetDataSource(HENV henv, wxChar *Dsn, SWORD DsnMaxLength, wxChar *DsDesc,
|
||||||
SWORD DsDescMax, UWORD direction = SQL_FETCH_NEXT);
|
SWORD DsDescMaxLength, UWORD direction = SQL_FETCH_NEXT);
|
||||||
|
|
||||||
|
|
||||||
// Change this to 0 to remove use of all deprecated functions
|
// Change this to 0 to remove use of all deprecated functions
|
||||||
@@ -791,7 +796,7 @@ int WXDLLIMPEXP_ODBC NumberDbConnectionsInUse(void);
|
|||||||
bool SqlLog(sqlLog state, const wxChar *filename = SQL_LOG_FILENAME);
|
bool SqlLog(sqlLog state, const wxChar *filename = SQL_LOG_FILENAME);
|
||||||
|
|
||||||
bool WXDLLIMPEXP_ODBC
|
bool WXDLLIMPEXP_ODBC
|
||||||
GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDescMax,
|
GetDataSource(HENV henv, char *Dsn, SWORD DsnMaxLength, char *DsDesc, SWORD DsDescMaxLength,
|
||||||
UWORD direction = SQL_FETCH_NEXT);
|
UWORD direction = SQL_FETCH_NEXT);
|
||||||
|
|
||||||
#endif // Deprecated structures/classes/functions
|
#endif // Deprecated structures/classes/functions
|
||||||
|
@@ -261,7 +261,7 @@ void wxDbColFor::Initialize()
|
|||||||
|
|
||||||
/********** wxDbColFor::Format() **********/
|
/********** wxDbColFor::Format() **********/
|
||||||
int wxDbColFor::Format(int Nation, int dbDataType, SWORD sqlDataType,
|
int wxDbColFor::Format(int Nation, int dbDataType, SWORD sqlDataType,
|
||||||
short columnSize, short decimalDigits)
|
short columnLength, short decimalDigits)
|
||||||
{
|
{
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
// -- 19991224 : mj10777 : Create
|
// -- 19991224 : mj10777 : Create
|
||||||
@@ -314,8 +314,8 @@ int wxDbColFor::Format(int Nation, int dbDataType, SWORD sqlDataType,
|
|||||||
if (decimalDigits == 0)
|
if (decimalDigits == 0)
|
||||||
decimalDigits = 2;
|
decimalDigits = 2;
|
||||||
tempStr = wxT("%");
|
tempStr = wxT("%");
|
||||||
tempStr.Printf(wxT("%s%d.%d"),tempStr.c_str(),columnSize,decimalDigits);
|
tempStr.Printf(wxT("%s%d.%d"), tempStr.c_str(),columnLength, decimalDigits);
|
||||||
s_Field.Printf(wxT("%sf"),tempStr.c_str());
|
s_Field.Printf(wxT("%sf"), tempStr.c_str());
|
||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_DATE:
|
case DB_DATA_TYPE_DATE:
|
||||||
if (i_Nation == 0) // timestamp YYYY-MM-DD HH:MM:SS.SSS (tested for SYBASE)
|
if (i_Nation == 0) // timestamp YYYY-MM-DD HH:MM:SS.SSS (tested for SYBASE)
|
||||||
@@ -340,17 +340,16 @@ int wxDbColFor::Format(int Nation, int dbDataType, SWORD sqlDataType,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_BLOB:
|
case DB_DATA_TYPE_BLOB:
|
||||||
s_Field.Printf(wxT("Unable to format(%d)-SQL(%d)"),dbDataType,sqlDataType); //
|
s_Field.Printf(wxT("Unable to format(%d)-SQL(%d)"), dbDataType,sqlDataType); //
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
s_Field.Printf(wxT("Unknown Format(%d)-SQL(%d)"),dbDataType,sqlDataType); //
|
s_Field.Printf(wxT("Unknown Format(%d)-SQL(%d)"), dbDataType,sqlDataType); //
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // wxDbColFor::Format()
|
} // wxDbColFor::Format()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/********** wxDbColInf Constructor **********/
|
/********** wxDbColInf Constructor **********/
|
||||||
wxDbColInf::wxDbColInf()
|
wxDbColInf::wxDbColInf()
|
||||||
{
|
{
|
||||||
@@ -375,8 +374,8 @@ bool wxDbColInf::Initialize()
|
|||||||
colName[0] = 0;
|
colName[0] = 0;
|
||||||
sqlDataType = 0;
|
sqlDataType = 0;
|
||||||
typeName[0] = 0;
|
typeName[0] = 0;
|
||||||
columnSize = 0;
|
columnLength = 0;
|
||||||
bufferLength = 0;
|
bufferSize = 0;
|
||||||
decimalDigits = 0;
|
decimalDigits = 0;
|
||||||
numPrecRadix = 0;
|
numPrecRadix = 0;
|
||||||
nullable = 0;
|
nullable = 0;
|
||||||
@@ -1008,11 +1007,14 @@ bool wxDb::setConnectionOptions(void)
|
|||||||
|
|
||||||
// I need to get the DBMS name here, because some of the connection options
|
// I need to get the DBMS name here, because some of the connection options
|
||||||
// are database specific and need to call the Dbms() function.
|
// are database specific and need to call the Dbms() function.
|
||||||
if (SQLGetInfo(hdbc, SQL_DBMS_NAME, (UCHAR*) dbInf.dbmsName, 40, &cb) != SQL_SUCCESS)
|
RETCODE retcode;
|
||||||
|
|
||||||
|
retcode = SQLGetInfo(hdbc, SQL_DBMS_NAME, (UCHAR *) dbInf.dbmsName, sizeof(dbInf.dbmsName), &cb);
|
||||||
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
|
|
||||||
SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
|
retcode = SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
|
||||||
SQLSetConnectOption(hdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
|
retcode = SQLSetConnectOption(hdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
|
||||||
// SQLSetConnectOption(hdbc, SQL_TXN_ISOLATION, SQL_TXN_READ_COMMITTED); // No dirty reads
|
// SQLSetConnectOption(hdbc, SQL_TXN_ISOLATION, SQL_TXN_READ_COMMITTED); // No dirty reads
|
||||||
|
|
||||||
// By default, MS Sql Server closes cursors on commit and rollback. The following
|
// By default, MS Sql Server closes cursors on commit and rollback. The following
|
||||||
@@ -1024,7 +1026,7 @@ bool wxDb::setConnectionOptions(void)
|
|||||||
{
|
{
|
||||||
const long SQL_PRESERVE_CURSORS = 1204L;
|
const long SQL_PRESERVE_CURSORS = 1204L;
|
||||||
const long SQL_PC_ON = 1L;
|
const long SQL_PC_ON = 1L;
|
||||||
SQLSetConnectOption(hdbc, SQL_PRESERVE_CURSORS, SQL_PC_ON);
|
retcode = SQLSetConnectOption(hdbc, SQL_PRESERVE_CURSORS, SQL_PC_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display the connection options to verify them
|
// Display the connection options to verify them
|
||||||
@@ -1032,15 +1034,17 @@ bool wxDb::setConnectionOptions(void)
|
|||||||
long l;
|
long l;
|
||||||
cout << wxT("****** CONNECTION OPTIONS ******") << endl;
|
cout << wxT("****** CONNECTION OPTIONS ******") << endl;
|
||||||
|
|
||||||
if (SQLGetConnectOption(hdbc, SQL_AUTOCOMMIT, &l) != SQL_SUCCESS)
|
retcode = SQLGetConnectOption(hdbc, SQL_AUTOCOMMIT, &l);
|
||||||
|
if (retcode != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
cout << wxT("AUTOCOMMIT: ") << (l == SQL_AUTOCOMMIT_OFF ? "OFF" : "ON") << endl;
|
cout << wxT("AUTOCOMMIT: ") << (l == SQL_AUTOCOMMIT_OFF ? "OFF" : "ON") << endl;
|
||||||
|
|
||||||
if (SQLGetConnectOption(hdbc, SQL_ODBC_CURSORS, &l) != SQL_SUCCESS)
|
retcode = SQLGetConnectOption(hdbc, SQL_ODBC_CURSORS, &l);
|
||||||
|
if (retcode != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
cout << wxT("ODBC CURSORS: ");
|
cout << wxT("ODBC CURSORS: ");
|
||||||
switch(l)
|
switch(l)
|
||||||
{
|
{
|
||||||
case(SQL_CUR_USE_IF_NEEDED):
|
case(SQL_CUR_USE_IF_NEEDED):
|
||||||
cout << wxT("SQL_CUR_USE_IF_NEEDED");
|
cout << wxT("SQL_CUR_USE_IF_NEEDED");
|
||||||
break;
|
break;
|
||||||
@@ -1050,10 +1054,11 @@ bool wxDb::setConnectionOptions(void)
|
|||||||
case(SQL_CUR_USE_DRIVER):
|
case(SQL_CUR_USE_DRIVER):
|
||||||
cout << wxT("SQL_CUR_USE_DRIVER");
|
cout << wxT("SQL_CUR_USE_DRIVER");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
if (SQLGetConnectOption(hdbc, SQL_OPT_TRACE, &l) != SQL_SUCCESS)
|
retcode = SQLGetConnectOption(hdbc, SQL_OPT_TRACE, &l)
|
||||||
|
if (retcode != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc));
|
return(DispAllErrors(henv, hdbc));
|
||||||
cout << wxT("TRACING: ") << (l == SQL_OPT_TRACE_OFF ? wxT("OFF") : wxT("ON")) << endl;
|
cout << wxT("TRACING: ") << (l == SQL_OPT_TRACE_OFF ? wxT("OFF") : wxT("ON")) << endl;
|
||||||
|
|
||||||
@@ -1072,7 +1077,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
SWORD cb;
|
SWORD cb;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_SERVER_NAME, (UCHAR*) dbInf.serverName, 80, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_SERVER_NAME, (UCHAR*) dbInf.serverName, sizeof(dbInf.serverName), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1080,7 +1085,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_DATABASE_NAME, (UCHAR*) dbInf.databaseName, 128, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_DATABASE_NAME, (UCHAR*) dbInf.databaseName, sizeof(dbInf.databaseName), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1088,7 +1093,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_DBMS_NAME, (UCHAR*) dbInf.dbmsName, 40, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_DBMS_NAME, (UCHAR*) dbInf.dbmsName, sizeof(dbInf.dbmsName), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1099,7 +1104,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
// 16-Mar-1999
|
// 16-Mar-1999
|
||||||
// After upgrading to MSVC6, the original 20 char buffer below was insufficient,
|
// After upgrading to MSVC6, the original 20 char buffer below was insufficient,
|
||||||
// causing database connectivity to fail in some cases.
|
// causing database connectivity to fail in some cases.
|
||||||
retcode = SQLGetInfo(hdbc, SQL_DBMS_VER, (UCHAR*) dbInf.dbmsVer, 64, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_DBMS_VER, (UCHAR*) dbInf.dbmsVer, sizeof(dbInf.dbmsVer), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1123,7 +1128,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_DRIVER_NAME, (UCHAR*) dbInf.driverName, 40, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_DRIVER_NAME, (UCHAR*) dbInf.driverName, sizeof(dbInf.driverName), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1131,7 +1136,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_DRIVER_ODBC_VER, (UCHAR*) dbInf.odbcVer, 60, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_DRIVER_ODBC_VER, (UCHAR*) dbInf.odbcVer, sizeof(dbInf.odbcVer), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1139,7 +1144,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_ODBC_VER, (UCHAR*) dbInf.drvMgrOdbcVer, 60, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_ODBC_VER, (UCHAR*) dbInf.drvMgrOdbcVer, sizeof(dbInf.drvMgrOdbcVer), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1147,7 +1152,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_DRIVER_VER, (UCHAR*) dbInf.driverVer, 60, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_DRIVER_VER, (UCHAR*) dbInf.driverVer, sizeof(dbInf.driverVer), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1181,7 +1186,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_OUTER_JOINS, (UCHAR*) dbInf.outerJoins, 2, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_OUTER_JOINS, (UCHAR*) dbInf.outerJoins, sizeof(dbInf.outerJoins), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1189,7 +1194,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_PROCEDURES, (UCHAR*) dbInf.procedureSupport, 2, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_PROCEDURES, (UCHAR*) dbInf.procedureSupport, sizeof(dbInf.procedureSupport), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1197,7 +1202,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_ACCESSIBLE_TABLES, (UCHAR*) dbInf.accessibleTables, 2, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_ACCESSIBLE_TABLES, (UCHAR*) dbInf.accessibleTables, sizeof(dbInf.accessibleTables), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1229,7 +1234,7 @@ bool wxDb::getDbInfo(bool failOnDataTypeUnsupported)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
retcode = SQLGetInfo(hdbc, SQL_ODBC_SQL_OPT_IEF, (UCHAR*) dbInf.supportIEF, 2, &cb);
|
retcode = SQLGetInfo(hdbc, SQL_ODBC_SQL_OPT_IEF, (UCHAR*) dbInf.supportIEF, sizeof(dbInf.supportIEF), &cb);
|
||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc);
|
DispAllErrors(henv, hdbc);
|
||||||
@@ -1558,7 +1563,7 @@ bool wxDb::getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo)
|
|||||||
wxChar typeName[DB_TYPE_NAME_LEN+1];
|
wxChar typeName[DB_TYPE_NAME_LEN+1];
|
||||||
|
|
||||||
// Obtain columns from the record
|
// Obtain columns from the record
|
||||||
if (SQLGetData(hstmt, 1, SQL_C_CHAR, (UCHAR*) typeName, DB_TYPE_NAME_LEN, &cbRet) != SQL_SUCCESS)
|
if (SQLGetData(hstmt, 1, SQL_C_WXCHAR, typeName, sizeof(typeName), &cbRet) != SQL_SUCCESS)
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
return(DispAllErrors(henv, hdbc, hstmt));
|
||||||
|
|
||||||
structSQLTypeInfo.TypeName = typeName;
|
structSQLTypeInfo.TypeName = typeName;
|
||||||
@@ -2178,7 +2183,12 @@ bool wxDb::GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FA
|
|||||||
wxASSERT(pData);
|
wxASSERT(pData);
|
||||||
wxASSERT(cbReturned);
|
wxASSERT(cbReturned);
|
||||||
|
|
||||||
if (SQLGetData(hstmt, colNo, cType, pData, maxLen, cbReturned) == SQL_SUCCESS)
|
long bufferSize = maxLen;
|
||||||
|
|
||||||
|
if (cType == SQL_C_WXCHAR)
|
||||||
|
bufferSize = maxLen * sizeof(wxChar);
|
||||||
|
|
||||||
|
if (SQLGetData(hstmt, colNo, cType, pData, bufferSize, cbReturned) == SQL_SUCCESS)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2232,7 +2242,7 @@ int wxDb::GetKeyFields(const wxString &tableName, wxDbColInf* colInf, UWORD noCo
|
|||||||
retcode = SQLFetch(hstmt);
|
retcode = SQLFetch(hstmt);
|
||||||
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
||||||
{
|
{
|
||||||
GetData( 4, SQL_C_CHAR, szPkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
GetData( 4, SQL_C_WXCHAR, szPkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
||||||
GetData( 5, SQL_C_SSHORT, &iKeySeq, 0, &cb);
|
GetData( 5, SQL_C_SSHORT, &iKeySeq, 0, &cb);
|
||||||
//-------
|
//-------
|
||||||
for (i=0;i<noCols;i++) // Find the Column name
|
for (i=0;i<noCols;i++) // Find the Column name
|
||||||
@@ -2264,11 +2274,11 @@ int wxDb::GetKeyFields(const wxString &tableName, wxDbColInf* colInf, UWORD noCo
|
|||||||
retcode = SQLFetch(hstmt);
|
retcode = SQLFetch(hstmt);
|
||||||
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
||||||
{
|
{
|
||||||
GetData( 3, SQL_C_CHAR, szPkTable, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
GetData( 3, SQL_C_WXCHAR, szPkTable, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
GetData( 4, SQL_C_CHAR, szPkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
GetData( 4, SQL_C_WXCHAR, szPkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
||||||
GetData( 5, SQL_C_SSHORT, &iKeySeq, 0, &cb);
|
GetData( 5, SQL_C_SSHORT, &iKeySeq, 0, &cb);
|
||||||
GetData( 7, SQL_C_CHAR, szFkTable, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
GetData( 7, SQL_C_WXCHAR, szFkTable, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
GetData( 8, SQL_C_CHAR, szFkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
GetData( 8, SQL_C_WXCHAR, szFkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
||||||
tempStr.Printf(wxT("%s[%s] "),tempStr.c_str(),szFkTable); // [ ] in case there is a blank in the Table name
|
tempStr.Printf(wxT("%s[%s] "),tempStr.c_str(),szFkTable); // [ ] in case there is a blank in the Table name
|
||||||
} // if
|
} // if
|
||||||
} // while
|
} // while
|
||||||
@@ -2306,9 +2316,9 @@ int wxDb::GetKeyFields(const wxString &tableName, wxDbColInf* colInf, UWORD noCo
|
|||||||
retcode = SQLFetch(hstmt);
|
retcode = SQLFetch(hstmt);
|
||||||
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
||||||
{
|
{
|
||||||
GetData( 3, SQL_C_CHAR, szPkTable, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
GetData( 3, SQL_C_WXCHAR, szPkTable, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
GetData( 5, SQL_C_SSHORT, &iKeySeq, 0, &cb);
|
GetData( 5, SQL_C_SSHORT, &iKeySeq, 0, &cb);
|
||||||
GetData( 8, SQL_C_CHAR, szFkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
GetData( 8, SQL_C_WXCHAR, szFkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
||||||
//-------
|
//-------
|
||||||
for (i=0; i<noCols; i++) // Find the Column name
|
for (i=0; i<noCols; i++) // Find the Column name
|
||||||
{
|
{
|
||||||
@@ -2440,30 +2450,30 @@ wxDbColInf *wxDb::GetColumns(wxChar *tableName[], const wxChar *userID)
|
|||||||
if (colNo < noCols) // Some extra error checking to prevent memory overwrites
|
if (colNo < noCols) // Some extra error checking to prevent memory overwrites
|
||||||
{
|
{
|
||||||
// NOTE: Only the ODBC 1.x fields are retrieved
|
// NOTE: Only the ODBC 1.x fields are retrieved
|
||||||
GetData( 1, SQL_C_CHAR, (UCHAR*) colInf[colNo].catalog, 128+1, &cb);
|
GetData( 1, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].catalog, 128+1, &cb);
|
||||||
GetData( 2, SQL_C_CHAR, (UCHAR*) colInf[colNo].schema, 128+1, &cb);
|
GetData( 2, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].schema, 128+1, &cb);
|
||||||
GetData( 3, SQL_C_CHAR, (UCHAR*) colInf[colNo].tableName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
GetData( 3, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].tableName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
GetData( 4, SQL_C_CHAR, (UCHAR*) colInf[colNo].colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
GetData( 4, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
||||||
GetData( 5, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].sqlDataType, 0, &cb);
|
GetData( 5, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].sqlDataType, 0, &cb);
|
||||||
GetData( 6, SQL_C_CHAR, (UCHAR*) colInf[colNo].typeName, 128+1, &cb);
|
GetData( 6, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].typeName, 128+1, &cb);
|
||||||
GetData( 7, SQL_C_SLONG, (UCHAR*) &colInf[colNo].columnSize, 0, &cb);
|
GetData( 7, SQL_C_SLONG, (UCHAR*) &colInf[colNo].columnLength, 0, &cb);
|
||||||
GetData( 8, SQL_C_SLONG, (UCHAR*) &colInf[colNo].bufferLength, 0, &cb);
|
GetData( 8, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].bufferSize, 0, &cb);
|
||||||
GetData( 9, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].decimalDigits,0, &cb);
|
GetData( 9, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].decimalDigits,0, &cb);
|
||||||
GetData(10, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].numPrecRadix, 0, &cb);
|
GetData(10, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].numPrecRadix, 0, &cb);
|
||||||
GetData(11, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].nullable, 0, &cb);
|
GetData(11, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].nullable, 0, &cb);
|
||||||
GetData(12, SQL_C_CHAR, (UCHAR*) colInf[colNo].remarks, 254+1, &cb);
|
GetData(12, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].remarks, 254+1, &cb);
|
||||||
|
|
||||||
// Determine the wxDb data type that is used to represent the native data type of this data source
|
// Determine the wxDb data type that is used to represent the native data type of this data source
|
||||||
colInf[colNo].dbDataType = 0;
|
colInf[colNo].dbDataType = 0;
|
||||||
if (!wxStricmp(typeInfVarchar.TypeName,colInf[colNo].typeName))
|
if (!wxStricmp(typeInfVarchar.TypeName,colInf[colNo].typeName))
|
||||||
{
|
{
|
||||||
#ifdef _IODBC_
|
#ifdef _IODBC_
|
||||||
// IODBC does not return a correct columnSize, so we set
|
// IODBC does not return a correct columnLength, so we set
|
||||||
// columnSize = bufferLength if no column size was returned
|
// columnLength = bufferSize if no column length was returned
|
||||||
// IODBC returns the columnSize in bufferLength.. (bug)
|
// IODBC returns the columnLength in bufferSize. (bug)
|
||||||
if (colInf[colNo].columnSize < 1)
|
if (colInf[colNo].columnLength < 1)
|
||||||
{
|
{
|
||||||
colInf[colNo].columnSize = colInf[colNo].bufferLength;
|
colInf[colNo].columnLength = colInf[colNo].bufferSize;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
colInf[colNo].dbDataType = DB_DATA_TYPE_VARCHAR;
|
colInf[colNo].dbDataType = DB_DATA_TYPE_VARCHAR;
|
||||||
@@ -2597,19 +2607,19 @@ wxDbColInf *wxDb::GetColumns(const wxString &tableName, UWORD *numCols, const wx
|
|||||||
if (colNo < noCols) // Some extra error checking to prevent memory overwrites
|
if (colNo < noCols) // Some extra error checking to prevent memory overwrites
|
||||||
{
|
{
|
||||||
// NOTE: Only the ODBC 1.x fields are retrieved
|
// NOTE: Only the ODBC 1.x fields are retrieved
|
||||||
GetData( 1, SQL_C_CHAR, (UCHAR*) colInf[colNo].catalog, 128+1, &cb);
|
GetData( 1, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].catalog, 128+1, &cb);
|
||||||
GetData( 2, SQL_C_CHAR, (UCHAR*) colInf[colNo].schema, 128+1, &cb);
|
GetData( 2, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].schema, 128+1, &cb);
|
||||||
GetData( 3, SQL_C_CHAR, (UCHAR*) colInf[colNo].tableName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
GetData( 3, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].tableName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
GetData( 4, SQL_C_CHAR, (UCHAR*) colInf[colNo].colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
GetData( 4, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
||||||
GetData( 5, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].sqlDataType, 0, &cb);
|
GetData( 5, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].sqlDataType, 0, &cb);
|
||||||
GetData( 6, SQL_C_CHAR, (UCHAR*) colInf[colNo].typeName, 128+1, &cb);
|
GetData( 6, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].typeName, 128+1, &cb);
|
||||||
GetData( 7, SQL_C_SLONG, (UCHAR*) &colInf[colNo].columnSize, 0, &cb);
|
GetData( 7, SQL_C_SLONG, (UCHAR*) &colInf[colNo].columnLength, 0, &cb);
|
||||||
// BJO 991214 : SQL_C_SSHORT instead of SQL_C_SLONG, otherwise fails on Sparc (probably all 64 bit architectures)
|
// BJO 991214 : SQL_C_SSHORT instead of SQL_C_SLONG, otherwise fails on Sparc (probably all 64 bit architectures)
|
||||||
GetData( 8, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].bufferLength, 0, &cb);
|
GetData( 8, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].bufferSize, 0, &cb);
|
||||||
GetData( 9, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].decimalDigits,0, &cb);
|
GetData( 9, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].decimalDigits,0, &cb);
|
||||||
GetData(10, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].numPrecRadix, 0, &cb);
|
GetData(10, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].numPrecRadix, 0, &cb);
|
||||||
GetData(11, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].nullable, 0, &cb);
|
GetData(11, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].nullable, 0, &cb);
|
||||||
GetData(12, SQL_C_CHAR, (UCHAR*) colInf[colNo].remarks, 254+1, &cb);
|
GetData(12, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].remarks, 254+1, &cb);
|
||||||
// Start Values for Primary/Foriegn Key (=No)
|
// Start Values for Primary/Foriegn Key (=No)
|
||||||
colInf[colNo].PkCol = 0; // Primary key column 0=No; 1= First Key, 2 = Second Key etc.
|
colInf[colNo].PkCol = 0; // Primary key column 0=No; 1= First Key, 2 = Second Key etc.
|
||||||
colInf[colNo].PkTableName[0] = 0; // Tablenames where Primary Key is used as a Foreign Key
|
colInf[colNo].PkTableName[0] = 0; // Tablenames where Primary Key is used as a Foreign Key
|
||||||
@@ -2629,12 +2639,12 @@ wxDbColInf *wxDb::GetColumns(const wxString &tableName, UWORD *numCols, const wx
|
|||||||
if (!wxStricmp(typeInfVarchar.TypeName, colInf[colNo].typeName))
|
if (!wxStricmp(typeInfVarchar.TypeName, colInf[colNo].typeName))
|
||||||
{
|
{
|
||||||
#ifdef _IODBC_
|
#ifdef _IODBC_
|
||||||
// IODBC does not return a correct columnSize, so we set
|
// IODBC does not return a correct columnLength, so we set
|
||||||
// columnSize = bufferLength if no column size was returned
|
// columnLength = bufferSize if no column length was returned
|
||||||
// IODBC returns the columnSize in bufferLength.. (bug)
|
// IODBC returns the columnLength in bufferSize. (bug)
|
||||||
if (colInf[colNo].columnSize < 1)
|
if (colInf[colNo].columnLength < 1)
|
||||||
{
|
{
|
||||||
colInf[colNo].columnSize = colInf[colNo].bufferLength;
|
colInf[colNo].columnLength = colInf[colNo].bufferSize;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2852,18 +2862,18 @@ wxDbColInf *wxDb::GetColumns(const wxString &tableName, int *numCols, const wxCh
|
|||||||
if (colNo < noCols) // Some extra error checking to prevent memory overwrites
|
if (colNo < noCols) // Some extra error checking to prevent memory overwrites
|
||||||
{
|
{
|
||||||
// NOTE: Only the ODBC 1.x fields are retrieved
|
// NOTE: Only the ODBC 1.x fields are retrieved
|
||||||
GetData( 1, SQL_C_CHAR, (UCHAR*) colInf[colNo].catalog, 128+1, &cb);
|
GetData( 1, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].catalog, 128+1, &cb);
|
||||||
GetData( 2, SQL_C_CHAR, (UCHAR*) colInf[colNo].schema, 128+1, &cb);
|
GetData( 2, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].schema, 128+1, &cb);
|
||||||
GetData( 3, SQL_C_CHAR, (UCHAR*) colInf[colNo].tableName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
GetData( 3, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].tableName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
GetData( 4, SQL_C_CHAR, (UCHAR*) colInf[colNo].colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
GetData( 4, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].colName, DB_MAX_COLUMN_NAME_LEN+1, &cb);
|
||||||
GetData( 5, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].sqlDataType, 0, &cb);
|
GetData( 5, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].sqlDataType, 0, &cb);
|
||||||
GetData( 6, SQL_C_CHAR, (UCHAR*) colInf[colNo].typeName, 128+1, &cb);
|
GetData( 6, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].typeName, 128+1, &cb);
|
||||||
GetData( 7, SQL_C_SLONG, (UCHAR*) &colInf[colNo].columnSize, 0, &cb);
|
GetData( 7, SQL_C_SLONG, (UCHAR*) &colInf[colNo].columnLength, 0, &cb);
|
||||||
GetData( 8, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].bufferLength, 0, &cb);
|
GetData( 8, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].bufferSize, 0, &cb);
|
||||||
GetData( 9, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].decimalDigits,0, &cb);
|
GetData( 9, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].decimalDigits,0, &cb);
|
||||||
GetData(10, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].numPrecRadix, 0, &cb);
|
GetData(10, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].numPrecRadix, 0, &cb);
|
||||||
GetData(11, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].nullable, 0, &cb);
|
GetData(11, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].nullable, 0, &cb);
|
||||||
GetData(12, SQL_C_CHAR, (UCHAR*) colInf[colNo].remarks, 254+1, &cb);
|
GetData(12, SQL_C_WXCHAR, (UCHAR*) colInf[colNo].remarks, 254+1, &cb);
|
||||||
// Start Values for Primary/Foriegn Key (=No)
|
// Start Values for Primary/Foriegn Key (=No)
|
||||||
colInf[colNo].PkCol = 0; // Primary key column 0=No; 1= First Key, 2 = Second Key etc.
|
colInf[colNo].PkCol = 0; // Primary key column 0=No; 1= First Key, 2 = Second Key etc.
|
||||||
colInf[colNo].PkTableName[0] = 0; // Tablenames where Primary Key is used as a Foreign Key
|
colInf[colNo].PkTableName[0] = 0; // Tablenames where Primary Key is used as a Foreign Key
|
||||||
@@ -2871,12 +2881,12 @@ wxDbColInf *wxDb::GetColumns(const wxString &tableName, int *numCols, const wxCh
|
|||||||
colInf[colNo].FkTableName[0] = 0; // Foreign key table name
|
colInf[colNo].FkTableName[0] = 0; // Foreign key table name
|
||||||
|
|
||||||
#ifdef _IODBC_
|
#ifdef _IODBC_
|
||||||
// IODBC does not return a correct columnSize, so we set
|
// IODBC does not return a correct columnLength, so we set
|
||||||
// columnSize = bufferLength if no column size was returned
|
// columnLength = bufferSize if no column length was returned
|
||||||
// IODBC returns the columnSize in bufferLength.. (bug)
|
// IODBC returns the columnLength in bufferSize. (bug)
|
||||||
if (colInf[colNo].columnSize < 1)
|
if (colInf[colNo].columnLength < 1)
|
||||||
{
|
{
|
||||||
colInf[colNo].columnSize = colInf[colNo].bufferLength;
|
colInf[colNo].columnLength = colInf[colNo].bufferSize;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3178,8 +3188,8 @@ wxDbInf *wxDb::GetCatalog(const wxChar *userID)
|
|||||||
{
|
{
|
||||||
if (pDbInf->numTables == 0)
|
if (pDbInf->numTables == 0)
|
||||||
{
|
{
|
||||||
GetData( 1, SQL_C_CHAR, (UCHAR*) pDbInf->catalog, 128+1, &cb);
|
GetData( 1, SQL_C_WXCHAR, (UCHAR*) pDbInf->catalog, 128+1, &cb);
|
||||||
GetData( 2, SQL_C_CHAR, (UCHAR*) pDbInf->schema, 128+1, &cb);
|
GetData( 2, SQL_C_WXCHAR, (UCHAR*) pDbInf->schema, 128+1, &cb);
|
||||||
}
|
}
|
||||||
pDbInf->numTables++; // Counter for Tables
|
pDbInf->numTables++; // Counter for Tables
|
||||||
} // if (pass == 1)
|
} // if (pass == 1)
|
||||||
@@ -3191,9 +3201,9 @@ wxDbInf *wxDb::GetCatalog(const wxChar *userID)
|
|||||||
noTab = 0;
|
noTab = 0;
|
||||||
} // if (pDbInf->pTableInf == NULL) // Has the Table Array been created
|
} // if (pDbInf->pTableInf == NULL) // Has the Table Array been created
|
||||||
|
|
||||||
GetData( 3, SQL_C_CHAR, (UCHAR*) (pDbInf->pTableInf+noTab)->tableName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
GetData( 3, SQL_C_WXCHAR, (UCHAR*) (pDbInf->pTableInf+noTab)->tableName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
GetData( 4, SQL_C_CHAR, (UCHAR*) (pDbInf->pTableInf+noTab)->tableType, 30+1, &cb);
|
GetData( 4, SQL_C_WXCHAR, (UCHAR*) (pDbInf->pTableInf+noTab)->tableType, 30+1, &cb);
|
||||||
GetData( 5, SQL_C_CHAR, (UCHAR*) (pDbInf->pTableInf+noTab)->tableRemarks, 254+1, &cb);
|
GetData( 5, SQL_C_WXCHAR, (UCHAR*) (pDbInf->pTableInf+noTab)->tableRemarks, 254+1, &cb);
|
||||||
|
|
||||||
noTab++;
|
noTab++;
|
||||||
} // if
|
} // if
|
||||||
@@ -3286,12 +3296,12 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
|
|||||||
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
GetData(3,SQL_C_CHAR, (UCHAR *) tblName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
GetData(3,SQL_C_WXCHAR, (UCHAR *) tblName, DB_MAX_TABLE_NAME_LEN+1, &cb);
|
||||||
GetData(4,SQL_C_CHAR, (UCHAR *) colName, DB_MAX_COLUMN_NAME_LEN+1,&cb);
|
GetData(4,SQL_C_WXCHAR, (UCHAR *) colName, DB_MAX_COLUMN_NAME_LEN+1,&cb);
|
||||||
GetData(5,SQL_C_SSHORT,(UCHAR *)&sqlDataType, 0, &cb);
|
GetData(5,SQL_C_SSHORT, (UCHAR *)&sqlDataType, 0, &cb);
|
||||||
GetData(6,SQL_C_CHAR, (UCHAR *) typeName, sizeof(typeName), &cb);
|
GetData(6,SQL_C_WXCHAR, (UCHAR *) typeName, sizeof(typeName), &cb);
|
||||||
GetData(7,SQL_C_SLONG, (UCHAR *)&precision, 0, &cb);
|
GetData(7,SQL_C_SLONG, (UCHAR *)&precision, 0, &cb);
|
||||||
GetData(8,SQL_C_SLONG, (UCHAR *)&length, 0, &cb);
|
GetData(8,SQL_C_SLONG, (UCHAR *)&length, 0, &cb);
|
||||||
|
|
||||||
if (wxStrcmp(tblName, tblNameSave.c_str()))
|
if (wxStrcmp(tblName, tblNameSave.c_str()))
|
||||||
{
|
{
|
||||||
@@ -3473,31 +3483,31 @@ bool wxDb::TablePrivileges(const wxString &tableName, const wxString &priv, cons
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO))
|
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO))
|
||||||
return(DispAllErrors(henv, hdbc, hstmt));
|
return (DispAllErrors(henv, hdbc, hstmt));
|
||||||
|
|
||||||
bool failed = false;
|
bool failed = false;
|
||||||
retcode = SQLFetch(hstmt);
|
retcode = SQLFetch(hstmt);
|
||||||
while (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
while (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
||||||
{
|
{
|
||||||
if (SQLGetData(hstmt, 1, SQL_C_CHAR, (UCHAR*) result.tableQual, sizeof(result.tableQual), &cbRetVal) != SQL_SUCCESS)
|
if (SQLGetData(hstmt, 1, SQL_C_WXCHAR, (UCHAR*) result.tableQual, sizeof(result.tableQual), &cbRetVal) != SQL_SUCCESS)
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
if (!failed && SQLGetData(hstmt, 2, SQL_C_CHAR, (UCHAR*) result.tableOwner, sizeof(result.tableOwner), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 2, SQL_C_WXCHAR, (UCHAR*) result.tableOwner, sizeof(result.tableOwner), &cbRetVal) != SQL_SUCCESS)
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
if (!failed && SQLGetData(hstmt, 3, SQL_C_CHAR, (UCHAR*) result.tableName, sizeof(result.tableName), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 3, SQL_C_WXCHAR, (UCHAR*) result.tableName, sizeof(result.tableName), &cbRetVal) != SQL_SUCCESS)
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
if (!failed && SQLGetData(hstmt, 4, SQL_C_CHAR, (UCHAR*) result.grantor, sizeof(result.grantor), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 4, SQL_C_WXCHAR, (UCHAR*) result.grantor, sizeof(result.grantor), &cbRetVal) != SQL_SUCCESS)
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
if (!failed && SQLGetData(hstmt, 5, SQL_C_CHAR, (UCHAR*) result.grantee, sizeof(result.grantee), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 5, SQL_C_WXCHAR, (UCHAR*) result.grantee, sizeof(result.grantee), &cbRetVal) != SQL_SUCCESS)
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
if (!failed && SQLGetData(hstmt, 6, SQL_C_CHAR, (UCHAR*) result.privilege, sizeof(result.privilege), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 6, SQL_C_WXCHAR, (UCHAR*) result.privilege, sizeof(result.privilege), &cbRetVal) != SQL_SUCCESS)
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
if (!failed && SQLGetData(hstmt, 7, SQL_C_CHAR, (UCHAR*) result.grantable, sizeof(result.grantable), &cbRetVal) != SQL_SUCCESS)
|
if (!failed && SQLGetData(hstmt, 7, SQL_C_WXCHAR, (UCHAR*) result.grantable, sizeof(result.grantable), &cbRetVal) != SQL_SUCCESS)
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
if (failed)
|
if (failed)
|
||||||
@@ -4186,8 +4196,8 @@ int wxDbCreateDataSource(const wxString &driverName, const wxString &dsn, const
|
|||||||
|
|
||||||
|
|
||||||
/********** wxDbGetDataSource() **********/
|
/********** wxDbGetDataSource() **********/
|
||||||
bool wxDbGetDataSource(HENV henv, wxChar *Dsn, SWORD DsnMax, wxChar *DsDesc,
|
bool wxDbGetDataSource(HENV henv, wxChar *Dsn, SWORD DsnMaxLength, wxChar *DsDesc,
|
||||||
SWORD DsDescMax, UWORD direction)
|
SWORD DsDescMaxLength, UWORD direction)
|
||||||
/*
|
/*
|
||||||
* Dsn and DsDesc will contain the data source name and data source
|
* Dsn and DsDesc will contain the data source name and data source
|
||||||
* description upon return
|
* description upon return
|
||||||
@@ -4195,8 +4205,8 @@ bool wxDbGetDataSource(HENV henv, wxChar *Dsn, SWORD DsnMax, wxChar *DsDesc,
|
|||||||
{
|
{
|
||||||
SWORD cb1,cb2;
|
SWORD cb1,cb2;
|
||||||
|
|
||||||
if (SQLDataSources(henv, direction, (SQLTCHAR FAR *) Dsn, DsnMax, &cb1,
|
if (SQLDataSources(henv, direction, (SQLTCHAR FAR *) Dsn, DsnMaxLength*sizeof(wxChar), &cb1,
|
||||||
(SQLTCHAR FAR *) DsDesc, DsDescMax, &cb2) == SQL_SUCCESS)
|
(SQLTCHAR FAR *) DsDesc, DsDescMaxLength*sizeof(wxChar), &cb2) == SQL_SUCCESS)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@@ -434,7 +434,7 @@ void wxDbTable::setCbValueForColumn(int columnIndex)
|
|||||||
if (colDefs[columnIndex].Null)
|
if (colDefs[columnIndex].Null)
|
||||||
colDefs[columnIndex].CbValue = SQL_NULL_DATA;
|
colDefs[columnIndex].CbValue = SQL_NULL_DATA;
|
||||||
else
|
else
|
||||||
if (colDefs[columnIndex].SqlCtype == SQL_C_CHAR)
|
if (colDefs[columnIndex].SqlCtype == SQL_C_WXCHAR)
|
||||||
colDefs[columnIndex].CbValue = SQL_NTS;
|
colDefs[columnIndex].CbValue = SQL_NTS;
|
||||||
else
|
else
|
||||||
colDefs[columnIndex].CbValue = SQL_LEN_DATA_AT_EXEC(colDefs[columnIndex].SzDataObj);
|
colDefs[columnIndex].CbValue = SQL_LEN_DATA_AT_EXEC(colDefs[columnIndex].SzDataObj);
|
||||||
@@ -779,7 +779,7 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
|
|||||||
// reliable!
|
// reliable!
|
||||||
if (// *(pDb->dbInf.accessibleTables) == 'N' &&
|
if (// *(pDb->dbInf.accessibleTables) == 'N' &&
|
||||||
!pDb->TablePrivileges(tableName,wxT("SELECT"), pDb->GetUsername(), pDb->GetUsername(), tablePath))
|
!pDb->TablePrivileges(tableName,wxT("SELECT"), pDb->GetUsername(), pDb->GetUsername(), tablePath))
|
||||||
s = wxT("Current logged in user does not have sufficient privileges to access this table.\n");
|
s = wxT("Connecting user does not have sufficient privileges to access this table.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s.IsEmpty())
|
if (!s.IsEmpty())
|
||||||
@@ -998,7 +998,7 @@ void wxDbTable::BuildDeleteStmt(wxString &pSqlStmt, int typeOfDel, const wxStrin
|
|||||||
// Get the ROWID value. If not successful retreiving the ROWID,
|
// Get the ROWID value. If not successful retreiving the ROWID,
|
||||||
// simply fall down through the code and build the WHERE clause
|
// simply fall down through the code and build the WHERE clause
|
||||||
// based on the key fields.
|
// based on the key fields.
|
||||||
if (SQLGetData(hstmt, (UWORD)(noCols+1), SQL_C_CHAR, (UCHAR*) rowid, wxDB_ROWID_LEN, &cb) == SQL_SUCCESS)
|
if (SQLGetData(hstmt, (UWORD)(noCols+1), SQL_C_WXCHAR, (UCHAR*) rowid, sizeof(rowid), &cb) == SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
pSqlStmt += wxT("ROWID = '");
|
pSqlStmt += wxT("ROWID = '");
|
||||||
pSqlStmt += rowid;
|
pSqlStmt += rowid;
|
||||||
@@ -1216,7 +1216,7 @@ void wxDbTable::BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxStrin
|
|||||||
// Get the ROWID value. If not successful retreiving the ROWID,
|
// Get the ROWID value. If not successful retreiving the ROWID,
|
||||||
// simply fall down through the code and build the WHERE clause
|
// simply fall down through the code and build the WHERE clause
|
||||||
// based on the key fields.
|
// based on the key fields.
|
||||||
if (SQLGetData(hstmt, (UWORD)(noCols+1), SQL_C_CHAR, (UCHAR*) rowid, wxDB_ROWID_LEN, &cb) == SQL_SUCCESS)
|
if (SQLGetData(hstmt, (UWORD)(noCols+1), SQL_C_WXCHAR, (UCHAR*) rowid, sizeof(rowid), &cb) == SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
pSqlStmt += wxT("ROWID = '");
|
pSqlStmt += wxT("ROWID = '");
|
||||||
pSqlStmt += rowid;
|
pSqlStmt += rowid;
|
||||||
@@ -1283,7 +1283,7 @@ void wxDbTable::BuildWhereClause(wxString &pWhereClause, int typeOfWhere,
|
|||||||
}
|
}
|
||||||
pWhereClause += pDb->SQLColumnName(colDefs[colNo].ColName);
|
pWhereClause += pDb->SQLColumnName(colDefs[colNo].ColName);
|
||||||
|
|
||||||
if (useLikeComparison && (colDefs[colNo].SqlCtype == SQL_C_CHAR))
|
if (useLikeComparison && (colDefs[colNo].SqlCtype == SQL_C_WXCHAR))
|
||||||
pWhereClause += wxT(" LIKE ");
|
pWhereClause += wxT(" LIKE ");
|
||||||
else
|
else
|
||||||
pWhereClause += wxT(" = ");
|
pWhereClause += wxT(" = ");
|
||||||
@@ -1291,6 +1291,8 @@ void wxDbTable::BuildWhereClause(wxString &pWhereClause, int typeOfWhere,
|
|||||||
switch(colDefs[colNo].SqlCtype)
|
switch(colDefs[colNo].SqlCtype)
|
||||||
{
|
{
|
||||||
case SQL_C_CHAR:
|
case SQL_C_CHAR:
|
||||||
|
case SQL_C_WCHAR:
|
||||||
|
//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[colNo].PtrDataObj);
|
colValue.Printf(wxT("'%s'"), (UCHAR FAR *) colDefs[colNo].PtrDataObj);
|
||||||
break;
|
break;
|
||||||
case SQL_C_SHORT:
|
case SQL_C_SHORT:
|
||||||
@@ -1395,7 +1397,7 @@ bool wxDbTable::CreateTable(bool attemptDrop)
|
|||||||
switch(colDefs[i].DbDataType)
|
switch(colDefs[i].DbDataType)
|
||||||
{
|
{
|
||||||
case DB_DATA_TYPE_VARCHAR:
|
case DB_DATA_TYPE_VARCHAR:
|
||||||
cout << pDb->GetTypeInfVarchar().TypeName << wxT("(") << colDefs[i].SzDataObj << wxT(")");
|
cout << pDb->GetTypeInfVarchar().TypeName << wxT("(") << (int)(colDefs[i].SzDataObj / sizeof(wxChar)) << wxT(")");
|
||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_INTEGER:
|
case DB_DATA_TYPE_INTEGER:
|
||||||
cout << pDb->GetTypeInfInteger().TypeName;
|
cout << pDb->GetTypeInfInteger().TypeName;
|
||||||
@@ -1457,7 +1459,7 @@ bool wxDbTable::CreateTable(bool attemptDrop)
|
|||||||
// colDefs[i].DbDataType == DB_DATA_TYPE_BLOB)
|
// colDefs[i].DbDataType == DB_DATA_TYPE_BLOB)
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
s.Printf(wxT("(%d)"), colDefs[i].SzDataObj);
|
s.Printf(wxT("(%d)"), (int)(colDefs[i].SzDataObj / sizeof(wxChar)));
|
||||||
sqlStmt += s;
|
sqlStmt += s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1531,7 +1533,7 @@ bool wxDbTable::CreateTable(bool attemptDrop)
|
|||||||
colDefs[i].DbDataType == DB_DATA_TYPE_VARCHAR)
|
colDefs[i].DbDataType == DB_DATA_TYPE_VARCHAR)
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
s.Printf(wxT("(%d)"), colDefs[i].SzDataObj);
|
s.Printf(wxT("(%d)"), (int)(colDefs[i].SzDataObj / sizeof(wxChar)));
|
||||||
sqlStmt += s;
|
sqlStmt += s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1673,7 +1675,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
ok = pDb->ModifyColumn(tableName, pIdxDefs[i].ColName,
|
ok = pDb->ModifyColumn(tableName, pIdxDefs[i].ColName,
|
||||||
colDefs[j].DbDataType, colDefs[j].SzDataObj,
|
colDefs[j].DbDataType, (int)(colDefs[j].SzDataObj / sizeof(wxChar)),
|
||||||
wxT("NOT NULL"));
|
wxT("NOT NULL"));
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
@@ -1735,7 +1737,7 @@ bool wxDbTable::CreateIndex(const wxString &idxName, bool unique, UWORD noIdxCol
|
|||||||
if ( colDefs[j].DbDataType == DB_DATA_TYPE_VARCHAR)
|
if ( colDefs[j].DbDataType == DB_DATA_TYPE_VARCHAR)
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
s.Printf(wxT("(%d)"), colDefs[i].SzDataObj);
|
s.Printf(wxT("(%d)"), (int)(colDefs[i].SzDataObj / sizeof(wxChar)));
|
||||||
sqlStmt += s;
|
sqlStmt += s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2090,6 +2092,8 @@ bool wxDbTable::IsColNull(UWORD colNo) const
|
|||||||
switch(colDefs[colNo].SqlCtype)
|
switch(colDefs[colNo].SqlCtype)
|
||||||
{
|
{
|
||||||
case SQL_C_CHAR:
|
case SQL_C_CHAR:
|
||||||
|
case SQL_C_WCHAR:
|
||||||
|
//case SQL_C_WXCHAR: SQL_C_WXCHAR is covered by either SQL_C_CHAR or SQL_C_WCHAR
|
||||||
return(((UCHAR FAR *) colDefs[colNo].PtrDataObj)[0] == 0);
|
return(((UCHAR FAR *) colDefs[colNo].PtrDataObj)[0] == 0);
|
||||||
case SQL_C_SSHORT:
|
case SQL_C_SSHORT:
|
||||||
return(( *((SWORD *) colDefs[colNo].PtrDataObj)) == 0);
|
return(( *((SWORD *) colDefs[colNo].PtrDataObj)) == 0);
|
||||||
@@ -2173,6 +2177,8 @@ void wxDbTable::ClearMemberVar(UWORD colNo, bool setToNull)
|
|||||||
switch(colDefs[colNo].SqlCtype)
|
switch(colDefs[colNo].SqlCtype)
|
||||||
{
|
{
|
||||||
case SQL_C_CHAR:
|
case SQL_C_CHAR:
|
||||||
|
case SQL_C_WCHAR:
|
||||||
|
//case SQL_C_WXCHAR: SQL_C_WXCHAR is covered by either SQL_C_CHAR or SQL_C_WCHAR
|
||||||
((UCHAR FAR *) colDefs[colNo].PtrDataObj)[0] = 0;
|
((UCHAR FAR *) colDefs[colNo].PtrDataObj)[0] = 0;
|
||||||
break;
|
break;
|
||||||
case SQL_C_SSHORT:
|
case SQL_C_SSHORT:
|
||||||
@@ -2271,7 +2277,7 @@ void wxDbTable::SetColDefs(UWORD index, const wxString &fieldName, int dataType,
|
|||||||
colDefs[index].DbDataType = dataType;
|
colDefs[index].DbDataType = dataType;
|
||||||
colDefs[index].PtrDataObj = pData;
|
colDefs[index].PtrDataObj = pData;
|
||||||
colDefs[index].SqlCtype = cType;
|
colDefs[index].SqlCtype = cType;
|
||||||
colDefs[index].SzDataObj = size;
|
colDefs[index].SzDataObj = size; //TODO: glt ??? * sizeof(wxChar) ???
|
||||||
colDefs[index].KeyField = keyField;
|
colDefs[index].KeyField = keyField;
|
||||||
colDefs[index].DerivedCol = derivedCol;
|
colDefs[index].DerivedCol = derivedCol;
|
||||||
// Derived columns by definition would NOT be "Insertable" or "Updateable"
|
// Derived columns by definition would NOT be "Insertable" or "Updateable"
|
||||||
@@ -2309,13 +2315,13 @@ wxDbColDataPtr* wxDbTable::SetColDefs(wxDbColInf *pColInfs, UWORD numCols)
|
|||||||
switch (pColInfs[index].dbDataType)
|
switch (pColInfs[index].dbDataType)
|
||||||
{
|
{
|
||||||
case DB_DATA_TYPE_VARCHAR:
|
case DB_DATA_TYPE_VARCHAR:
|
||||||
pColDataPtrs[index].PtrDataObj = new wxChar[pColInfs[index].bufferLength+1];
|
pColDataPtrs[index].PtrDataObj = new wxChar[pColInfs[index].bufferSize+(1*sizeof(wxChar))];
|
||||||
pColDataPtrs[index].SzDataObj = pColInfs[index].columnSize;
|
pColDataPtrs[index].SzDataObj = pColInfs[index].bufferSize+(1*sizeof(wxChar));
|
||||||
pColDataPtrs[index].SqlCtype = SQL_C_CHAR;
|
pColDataPtrs[index].SqlCtype = SQL_C_WXCHAR;
|
||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_INTEGER:
|
case DB_DATA_TYPE_INTEGER:
|
||||||
// Can be long or short
|
// Can be long or short
|
||||||
if (pColInfs[index].bufferLength == sizeof(long))
|
if (pColInfs[index].bufferSize == sizeof(long))
|
||||||
{
|
{
|
||||||
pColDataPtrs[index].PtrDataObj = new long;
|
pColDataPtrs[index].PtrDataObj = new long;
|
||||||
pColDataPtrs[index].SzDataObj = sizeof(long);
|
pColDataPtrs[index].SzDataObj = sizeof(long);
|
||||||
@@ -2330,7 +2336,7 @@ wxDbColDataPtr* wxDbTable::SetColDefs(wxDbColInf *pColInfs, UWORD numCols)
|
|||||||
break;
|
break;
|
||||||
case DB_DATA_TYPE_FLOAT:
|
case DB_DATA_TYPE_FLOAT:
|
||||||
// Can be float or double
|
// Can be float or double
|
||||||
if (pColInfs[index].bufferLength == sizeof(float))
|
if (pColInfs[index].bufferSize == sizeof(float))
|
||||||
{
|
{
|
||||||
pColDataPtrs[index].PtrDataObj = new float;
|
pColDataPtrs[index].PtrDataObj = new float;
|
||||||
pColDataPtrs[index].SzDataObj = sizeof(float);
|
pColDataPtrs[index].SzDataObj = sizeof(float);
|
||||||
@@ -2483,12 +2489,12 @@ bool wxDbTable::Refresh(void)
|
|||||||
if (CanUpdByROWID())
|
if (CanUpdByROWID())
|
||||||
{
|
{
|
||||||
SDWORD cb;
|
SDWORD cb;
|
||||||
wxChar rowid[wxDB_ROWID_LEN+1];
|
wxChar rowid[wxDB_ROWID_LEN+1];
|
||||||
|
|
||||||
// Get the ROWID value. If not successful retreiving the ROWID,
|
// Get the ROWID value. If not successful retreiving the ROWID,
|
||||||
// simply fall down through the code and build the WHERE clause
|
// simply fall down through the code and build the WHERE clause
|
||||||
// based on the key fields.
|
// based on the key fields.
|
||||||
if (SQLGetData(hstmt, (UWORD)(noCols+1), SQL_C_CHAR, (UCHAR*) rowid, wxDB_ROWID_LEN, &cb) == SQL_SUCCESS)
|
if (SQLGetData(hstmt, (UWORD)(noCols+1), SQL_C_WXCHAR, (UCHAR*) rowid, sizeof(rowid), &cb) == SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
whereClause += pDb->SQLTableName(queryTableName);
|
whereClause += pDb->SQLTableName(queryTableName);
|
||||||
// whereClause += queryTableName;
|
// whereClause += queryTableName;
|
||||||
@@ -2739,7 +2745,7 @@ void wxDbTable::SetCol(const int colNo, const wxVariant val)
|
|||||||
case SQL_VARCHAR:
|
case SQL_VARCHAR:
|
||||||
csstrncpyt((wxChar *)(colDefs[colNo].PtrDataObj),
|
csstrncpyt((wxChar *)(colDefs[colNo].PtrDataObj),
|
||||||
val.GetString().c_str(),
|
val.GetString().c_str(),
|
||||||
colDefs[colNo].SzDataObj-1);
|
colDefs[colNo].SzDataObj-1); //TODO: glt ??? * sizeof(wxChar) ???
|
||||||
break;
|
break;
|
||||||
case SQL_C_LONG:
|
case SQL_C_LONG:
|
||||||
case SQL_C_SLONG:
|
case SQL_C_SLONG:
|
||||||
|
Reference in New Issue
Block a user