+ // --------------- Date/Time ---------------
+ for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlDateTypes) &&
+ !getDataTypeInfo(PossibleSqlDateTypes[iIndex], typeInfDate); ++iIndex)
+ {}
+
+ if (iIndex < WXSIZEOF(PossibleSqlDateTypes))
+ typeInfDate.FsqlType = PossibleSqlDateTypes[iIndex];
+ else if (failOnDataTypeUnsupported)
+ return false;
+
+ // --------------- BLOB ---------------
+ for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlBlobTypes) &&
+ !getDataTypeInfo(PossibleSqlBlobTypes[iIndex], typeInfBlob); ++iIndex)
+ {}
+
+ if (iIndex < WXSIZEOF(PossibleSqlBlobTypes))
+ typeInfBlob.FsqlType = PossibleSqlBlobTypes[iIndex];
+ else if (failOnDataTypeUnsupported)
+ return false;
+
+ // --------------- MEMO ---------------
+ for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlMemoTypes) &&
+ !getDataTypeInfo(PossibleSqlMemoTypes[iIndex], typeInfMemo); ++iIndex)
+ {}
+
+ if (iIndex < WXSIZEOF(PossibleSqlMemoTypes))
+ typeInfMemo.FsqlType = PossibleSqlMemoTypes[iIndex];
+ else if (failOnDataTypeUnsupported)
+ return false;
+
+ return true;
+} // wxDb::determineDataTypes
+
+
+bool wxDb::open(bool failOnDataTypeUnsupported)
+{
+/*
+ If using Intersolv branded ODBC drivers, this is the place where you would substitute
+ your branded driver license information
+
+ SQLSetConnectOption(hdbc, 1041, (UDWORD) wxEmptyString);
+ SQLSetConnectOption(hdbc, 1042, (UDWORD) wxEmptyString);
+*/
+
+ // Mark database as open
+ dbIsOpen = true;
+
+ // Allocate a statement handle for the database connection
+ if (SQLAllocStmt(hdbc, &hstmt) != SQL_SUCCESS)
+ return(DispAllErrors(henv, hdbc));
+
+ // Set Connection Options
+ if (!setConnectionOptions())
+ return false;
+
+ if (!determineDataTypes(failOnDataTypeUnsupported))
+ return false;
+
+#ifdef DBDEBUG_CONSOLE
+ cout << wxT("VARCHAR DATA TYPE: ") << typeInfVarchar.TypeName << endl;
+ cout << wxT("INTEGER DATA TYPE: ") << typeInfInteger.TypeName << endl;
+ cout << wxT("FLOAT DATA TYPE: ") << typeInfFloat.TypeName << endl;
+ cout << wxT("DATE DATA TYPE: ") << typeInfDate.TypeName << endl;
+ cout << wxT("BLOB DATA TYPE: ") << typeInfBlob.TypeName << endl;
+ cout << wxT("MEMO DATA TYPE: ") << typeInfMemo.TypeName << endl;
+ cout << endl;
+#endif
+
+ // Completed Successfully
+ return true;
+}
+
+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 = wxEmptyString;
+ uid = wxEmptyString;
+ authStr = wxEmptyString;
+
+ RETCODE retcode;
+
+ if (!FwdOnlyCursors())