- tempStr = wxT("%");
- tempStr.Printf(wxT("%s%d.%d"), tempStr.c_str(),columnLength, decimalDigits);
+ tempStr.Printf(wxT("%%%d.%d"), columnLength, decimalDigits);
bool wxDb::Open(const wxString& inConnectStr, bool failOnDataTypeUnsupported)
{
wxASSERT(inConnectStr.Length());
bool wxDb::Open(const wxString& inConnectStr, bool failOnDataTypeUnsupported)
{
wxASSERT(inConnectStr.Length());
- retcode = SQLDriverConnect(hdbc, NULL, (SQLTCHAR FAR *)inConnectionStr.c_str(),
+ retcode = SQLDriverConnect(hdbc, parentWnd, (SQLTCHAR FAR *)inConnectionStr.c_str(),
(SWORD)inConnectionStr.Length(), (SQLTCHAR FAR *)outConnectBuffer,
sizeof(outConnectBuffer), &outConnectBufferLen, SQL_DRIVER_COMPLETE );
(SWORD)inConnectionStr.Length(), (SQLTCHAR FAR *)outConnectBuffer,
sizeof(outConnectBuffer), &outConnectBufferLen, SQL_DRIVER_COMPLETE );
// Get information about the data type specified
if (SQLGetTypeInfo(hstmt, fSqlType) != SQL_SUCCESS)
// Get information about the data type specified
if (SQLGetTypeInfo(hstmt, fSqlType) != SQL_SUCCESS)
/*
* This function is called internally whenever an error condition prevents the user's
* request from being executed. This function will query the datasource as to the
/*
* This function is called internally whenever an error condition prevents the user's
* request from being executed. This function will query the datasource as to the
*
* The function will retrieve each error condition from the datasource and
* Printf the codes/text values into a string which it then logs via logError().
* If in DBDEBUG_CONSOLE mode, the constructed string will be displayed in the console
* window and program execution will be paused until the user presses a key.
*
*
* The function will retrieve each error condition from the datasource and
* Printf the codes/text values into a string which it then logs via logError().
* If in DBDEBUG_CONSOLE mode, the constructed string will be displayed in the console
* window and program execution will be paused until the user presses a key.
*
wxDbColInf* pColInf = new wxDbColInf[noCols];
// Fill in column information (name, datatype)
wxDbColInf* pColInf = new wxDbColInf[noCols];
// Fill in column information (name, datatype)
{
if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_NAME,
name, sizeof(name),
{
if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_NAME,
name, sizeof(name),
pColInf[colNum].colName[DB_MAX_COLUMN_NAME_LEN] = 0; // Prevent buffer overrun
if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_TYPE,
pColInf[colNum].colName[DB_MAX_COLUMN_NAME_LEN] = 0; // Prevent buffer overrun
if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_TYPE,
- NULL, 0, &Sword, &Sdword) != SQL_SUCCESS)
+ NULL, 0, &Sword, &Sqllen) != SQL_SUCCESS)
-bool wxDb::GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned)
+bool wxDb::GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SQLLEN FAR *cbReturned)
wxChar szPkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Primary key column */
wxChar szFkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Foreign key column */
SQLRETURN retcode;
wxChar szPkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Primary key column */
wxChar szFkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Foreign key column */
SQLRETURN retcode;
GetData( 5, SQL_C_SSHORT, &iKeySeq, 0, &cb);
GetData( 7, SQL_C_WXCHAR, szFkTable, DB_MAX_TABLE_NAME_LEN+1, &cb);
GetData( 8, SQL_C_WXCHAR, szFkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
GetData( 5, SQL_C_SSHORT, &iKeySeq, 0, &cb);
GetData( 7, SQL_C_WXCHAR, szFkTable, DB_MAX_TABLE_NAME_LEN+1, &cb);
GetData( 8, SQL_C_WXCHAR, szFkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb);
* 1) The last array element of the tableName[] argument must be zero (null).
* This is how the end of the array is detected.
* 2) This function returns an array of wxDbColInf structures. If no columns
* 1) The last array element of the tableName[] argument must be zero (null).
* This is how the end of the array is detected.
* 2) This function returns an array of wxDbColInf structures. If no columns
* CALLING FUNCTION IS RESPONSIBLE FOR DELETING THE MEMORY RETURNED WHEN IT
* IS FINISHED WITH IT. i.e.
*
* CALLING FUNCTION IS RESPONSIBLE FOR DELETING THE MEMORY RETURNED WHEN IT
* IS FINISHED WITH IT. i.e.
*
DispAllErrors(henv, hdbc, hstmt);
SQLFreeStmt(hstmt, SQL_CLOSE);
return(-1);
DispAllErrors(henv, hdbc, hstmt);
SQLFreeStmt(hstmt, SQL_CLOSE);
return(-1);
DispAllErrors(henv, hdbc, hstmt);
SQLFreeStmt(hstmt, SQL_CLOSE);
return(-1);
DispAllErrors(henv, hdbc, hstmt);
SQLFreeStmt(hstmt, SQL_CLOSE);
return(-1);
* -- : uses SQLTables and fills pTableInf; ------
* -- : pColInf is set to NULL and numCols to 0; ------
* -- : returns pDbInf (wxDbInf) ------
* -- : uses SQLTables and fills pTableInf; ------
* -- : pColInf is set to NULL and numCols to 0; ------
* -- : returns pDbInf (wxDbInf) ------
* -- : pColInf can be filled with GetColumns(..); ------
* -- : numCols can be filled with GetColumnCount(..); ------
* ---------------------------------------------------------------------
* -- : pColInf can be filled with GetColumns(..); ------
* -- : numCols can be filled with GetColumnCount(..); ------
* ---------------------------------------------------------------------
// embedded nulls in strings
setupStr.Printf(wxT("DSN=%s%cDescription=%s%cDefaultDir=%s%c"),dsn,2,description,2,defDir,2);
// embedded nulls in strings
setupStr.Printf(wxT("DSN=%s%cDescription=%s%cDefaultDir=%s%c"),dsn,2,description,2,defDir,2);
********************************************************************
*
* The following functions are all DEPRECATED and are included for
********************************************************************
*
* The following functions are all DEPRECATED and are included for
*
********************************************************************
********************************************************************/
*
********************************************************************
********************************************************************/