|| Dbms() == dbmsXBASE_SEQUITER )
UserID.Empty();
- // Oracle user names may only be in uppercase, so force
- // the name to uppercase
- if (Dbms() == dbmsORACLE)
+ // Some databases require user names to be specified in uppercase,
+ // so force the name to uppercase
+ if ((Dbms() == dbmsORACLE) ||
+ (Dbms() == dbmsMAXDB))
UserID = UserID.Upper();
return UserID.c_str();
bool wxDb::Open(const wxString& inConnectStr, bool failOnDataTypeUnsupported)
{
wxASSERT(inConnectStr.Length());
+ return Open(inConnectStr, NULL, failOnDataTypeUnsupported);
+}
+
+bool wxDb::Open(const wxString& inConnectStr, SQLHWND parentWnd, bool failOnDataTypeUnsupported)
+{
dsn = wxT("");
uid = wxT("");
authStr = wxT("");
inConnectionStr = inConnectStr;
- 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 );
{
wxString odbcErrMsg;
-#ifdef __VMS
- while (SQLError(aHenv, aHdbc, aHstmt, (SQLTCHAR FAR *) sqlState, (SQLINTEGER *) &nativeError, (SQLTCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS)
-#else
- while (SQLError(aHenv, aHdbc, aHstmt, (SQLTCHAR FAR *) sqlState, (long*) &nativeError, (SQLTCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS)
-#endif
+ while (SQLError(aHenv, aHdbc, aHstmt, (SQLTCHAR FAR *) sqlState, &nativeError, (SQLTCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS)
{
odbcErrMsg.Printf(wxT("SQL State = %s\nNative Error Code = %li\nError Message = %s\n"), sqlState, nativeError, errorMsg);
logError(odbcErrMsg, sqlState);
/********** wxDb::GetNextError() **********/
bool wxDb::GetNextError(HENV aHenv, HDBC aHdbc, HSTMT aHstmt)
{
-#ifdef __VMS
- if (SQLError(aHenv, aHdbc, aHstmt, (SQLTCHAR FAR *) sqlState, (SQLINTEGER *) &nativeError, (SQLTCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS)
-#else
- if (SQLError(aHenv, aHdbc, aHstmt, (SQLTCHAR FAR *) sqlState, (long*) &nativeError, (SQLTCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS)
-#endif
+ if (SQLError(aHenv, aHdbc, aHstmt, (SQLTCHAR FAR *) sqlState, &nativeError, (SQLTCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS)
return true;
else
return false;
/*
BJO 20000503
These are tentative new GetColumns members which should be more database
- independant and which always returns the columns in the order they were
+ independent and which always returns the columns in the order they were
created.
- The first one (wxDbColInf *wxDb::GetColumns(wxChar *tableName[], const
wxChar typeName[30+1];
SDWORD precision, length;
- FILE *fp = wxFopen(fileName.fn_str(),wxT("wt"));
+ FILE *fp = wxFopen(fileName.c_str(),wxT("wt"));
if (fp == NULL)
return false;
{
if (fpSqlLog == 0)
{
- fpSqlLog = wxFopen(filename.fn_str(), (append ? wxT("at") : wxT("wt")));
+ fpSqlLog = wxFopen(filename.c_str(), (append ? wxT("at") : wxT("wt")));
if (fpSqlLog == NULL)
return false;
}
return((wxDBMS)(dbmsType = dbmsXBASE_SEQUITER));
if (!wxStricmp(baseName,wxT("MySQL")))
return((wxDBMS)(dbmsType = dbmsMY_SQL));
+ if (!wxStricmp(baseName,wxT("MaxDB")))
+ return((wxDBMS)(dbmsType = dbmsMAXDB));
baseName[3] = 0;
if (!wxStricmp(baseName,wxT("DB2")))