if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
return(DispAllErrors(henv, hdbc));
- retcode = SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
- retcode = SQLSetConnectOption(hdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
+ /* retcode = */ SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
+ /* retcode = */ SQLSetConnectOption(hdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
// 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
{
const long SQL_PRESERVE_CURSORS = 1204L;
const long SQL_PC_ON = 1L;
- retcode = SQLSetConnectOption(hdbc, SQL_PRESERVE_CURSORS, SQL_PC_ON);
+ /* retcode = */ SQLSetConnectOption(hdbc, SQL_PRESERVE_CURSORS, SQL_PC_ON);
}
// Display the connection options to verify them
} // wxDb::ExecSql()
-/********** wxDb::ExecSql() with column info **********/
+/********** wxDb::ExecSql() with column info **********/
bool wxDb::ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcols)
{
//execute the statement first
DispAllErrors(henv, hdbc, hstmt);
return false;
}
-
+
if (noCols == 0)
return false;
- else
+ else
numcols = noCols;
-
+
// Get column information
short colNum;
wxChar name[DB_MAX_COLUMN_NAME_LEN+1];
SWORD Sword;
SDWORD Sdword;
wxDbColInf* pColInf = new wxDbColInf[noCols];
-
+
//fill in column information (name, datatype)
- for (colNum = 0; colNum < noCols; colNum++)
+ for (colNum = 0; colNum < noCols; colNum++)
{
- if (SQLColAttributes(hstmt, colNum+1, SQL_COLUMN_NAME,
+ if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_NAME,
name, sizeof(name),
&Sword, &Sdword) != SQL_SUCCESS)
{
delete[] pColInf;
return false;
}
-
+
wxStrncpy(pColInf[colNum].colName, name, DB_MAX_COLUMN_NAME_LEN);
-
- if (SQLColAttributes(hstmt, colNum+1, SQL_COLUMN_TYPE,
+
+ if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_TYPE,
NULL, 0, &Sword, &Sdword) != SQL_SUCCESS)
{
DispAllErrors(henv, hdbc, hstmt);
delete[] pColInf;
return false;
}
-
+
switch (Sdword)
{
case SQL_VARCHAR:
#ifdef __WXDEBUG__
default:
wxString errMsg;
- errMsg.Printf(wxT("SQL Data type %d currently not supported by wxWidgets"), Sdword);
+ errMsg.Printf(wxT("SQL Data type %ld currently not supported by wxWidgets"), (long)Sdword);
wxLogDebug(errMsg,wxT("ODBC DEBUG MESSAGE"));
#endif
}
}
-
+
*columns = pColInf;
return true;
} // wxDb::ExecSql()
} // while
tempStr.Trim(); // Get rid of any unneeded blanks
- if (!tempStr.IsEmpty())
+ if (!tempStr.empty())
{
for (i=0; i<noCols; i++)
{ // Find the Column name
// MySQL, SQLServer, and Access cannot accept a user name when looking up column names, so we
// use the call below that leaves out the user name
- if (!UserID.IsEmpty() &&
+ if (!UserID.empty() &&
Dbms() != dbmsMY_SQL &&
Dbms() != dbmsACCESS &&
Dbms() != dbmsMS_SQL_SERVER)
// MySQL, SQLServer, and Access cannot accept a user name when looking up column names, so we
// use the call below that leaves out the user name
- if (!UserID.IsEmpty() &&
+ if (!UserID.empty() &&
Dbms() != dbmsMY_SQL &&
Dbms() != dbmsACCESS &&
Dbms() != dbmsMS_SQL_SERVER)
// MySQL, SQLServer, and Access cannot accept a user name when looking up column names, so we
// use the call below that leaves out the user name
- if (!UserID.IsEmpty() &&
+ if (!UserID.empty() &&
Dbms() != dbmsMY_SQL &&
Dbms() != dbmsACCESS &&
Dbms() != dbmsMS_SQL_SERVER)
// MySQL, SQLServer, and Access cannot accept a user name when looking up column names, so we
// use the call below that leaves out the user name
- if (!UserID.IsEmpty() &&
+ if (!UserID.empty() &&
Dbms() != dbmsMY_SQL &&
Dbms() != dbmsACCESS &&
Dbms() != dbmsMS_SQL_SERVER)
SQLFreeStmt(hstmt, SQL_CLOSE); // Close if Open
tblNameSave.Empty();
- if (!UserID.IsEmpty() &&
+ if (!UserID.empty() &&
Dbms() != dbmsMY_SQL &&
Dbms() != dbmsACCESS &&
Dbms() != dbmsMS_SQL_SERVER)
wxChar typeName[30+1];
SDWORD precision, length;
- FILE *fp = wxFopen(fileName.c_str(),wxT("wt"));
+ FILE *fp = wxFopen(fileName.fn_str(),wxT("wt"));
if (fp == NULL)
return false;
wxString UserID;
convertUserID(userID,UserID);
- if (!UserID.IsEmpty() &&
+ if (!UserID.empty() &&
Dbms() != dbmsMY_SQL &&
Dbms() != dbmsACCESS &&
Dbms() != dbmsINTERBASE &&
// Some databases cannot accept a user name when looking up table names,
// so we use the call below that leaves out the user name
- if (!UserID.IsEmpty() &&
+ if (!UserID.empty() &&
Dbms() != dbmsMY_SQL &&
Dbms() != dbmsACCESS &&
Dbms() != dbmsMS_SQL_SERVER &&
// Some databases cannot accept a user name when looking up table names,
// so we use the call below that leaves out the user name
- if (!Schema.IsEmpty() &&
+ if (!Schema.empty() &&
Dbms() != dbmsMY_SQL &&
Dbms() != dbmsACCESS &&
Dbms() != dbmsMS_SQL_SERVER)
{
if (fpSqlLog == 0)
{
- fpSqlLog = wxFopen(filename, (append ? wxT("at") : wxT("wt")));
+ fpSqlLog = wxFopen(filename.fn_str(), (append ? wxT("at") : wxT("wt")));
if (fpSqlLog == NULL)
return false;
}
*/
{
SWORD cb1,cb2;
+ SWORD lengthDsn = (SWORD)(DsnMaxLength*sizeof(wxChar));
+ SWORD lengthDsDesc = (SWORD)(DsDescMaxLength*sizeof(wxChar));
- if (SQLDataSources(henv, direction, (SQLTCHAR FAR *) Dsn, DsnMaxLength*sizeof(wxChar), &cb1,
- (SQLTCHAR FAR *) DsDesc, DsDescMaxLength*sizeof(wxChar), &cb2) == SQL_SUCCESS)
+ if (SQLDataSources(henv, direction, (SQLTCHAR FAR *) Dsn, lengthDsn, &cb1,
+ (SQLTCHAR FAR *) DsDesc, lengthDsDesc, &cb2) == SQL_SUCCESS)
return true;
else
return false;