Description:
Hi,
in my application I use wxWidgets. It queries the type information for several types using ODBC.
I assume that it doesn't return a result record for type information queries.
In a trace log you can see the following:
... snip ...
test_db 9c4-8f8 ENTER SQLGetTypeInfo
HSTMT 00DB2290
SWORD 11 <SQL_TIMESTAMP>
test_db 9c4-8f8 EXIT SQLGetTypeInfo with return code 0 (SQL_SUCCESS)
HSTMT 00DB2290
SWORD 11 <SQL_TIMESTAMP>
test_db 9c4-8f8 ENTER SQLFetch
HSTMT 00DB2290
test_db 9c4-8f8 EXIT SQLFetch with return code 100 (SQL_NO_DATA_FOUND)
HSTMT 00DB2290
test_db 9c4-8f8 ENTER SQLErrorW
HENV 00DB1540
HDBC 00DB15E8
HSTMT 00DB2290
WCHAR * 0x0023F2F8 (NYI)
SDWORD * 0x000362CC
WCHAR * 0x0023EEF8
SWORD 511
SWORD * 0x000356C4
test_db 9c4-8f8 EXIT SQLErrorW with return code 100 (SQL_NO_DATA_FOUND)
HENV 00DB1540
HDBC 00DB15E8
HSTMT 00DB2290
WCHAR * 0x0023F2F8 (NYI)
SDWORD * 0x000362CC
WCHAR * 0x0023EEF8
SWORD 511
SWORD * 0x000356C4
test_db 9c4-8f8 ENTER SQLFreeStmt
HSTMT 00DB2290
UWORD 0 <SQL_CLOSE>
test_db 9c4-8f8 EXIT SQLFreeStmt with return code 0 (SQL_SUCCESS)
HSTMT 00DB2290
UWORD 0 <SQL_CLOSE>
test_db 9c4-8f8 ENTER SQLGetTypeInfo
HSTMT 00DB2290
SWORD 9 <SQL_DATE>
test_db 9c4-8f8 EXIT SQLGetTypeInfo with return code 0 (SQL_SUCCESS)
HSTMT 00DB2290
SWORD 9 <SQL_DATE>
test_db 9c4-8f8 ENTER SQLFetch
HSTMT 00DB2290
test_db 9c4-8f8 EXIT SQLFetch with return code 100 (SQL_NO_DATA_FOUND)
HSTMT 00DB2290
test_db 9c4-8f8 ENTER SQLErrorW
HENV 00DB1540
HDBC 00DB15E8
... snip ...
How to repeat:
Just compile the current wxWidgets CVS head and use the following test application. Don't forget to insert your password in the source (<your password>).
#define wxUSE_GUI 0
#include <stdio.h>
#include <stddef.h>
#include <assert.h>
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers
#ifndef WX_PRECOMP
#include <wx/app.h>
#include <wx/string.h>
#include <wx/wfstream.h>
#include <wx/txtstrm.h>
#include <wx/intl.h>
#include <wx/sstream.h>
#include <wx/db.h>
#endif
wxFFileOutputStream fStdOut(stdout);
wxFFileOutputStream fStdErr(stderr);
wxTextOutputStream cout(fStdOut);
wxTextOutputStream cerr(fStdErr);
class TestDb : public wxAppConsole
{
public:
int OnRun(void);
};
template <class T>
T FromString(const wxString &s)
{
wxStringInputStream sstrIn(s);
wxTextInputStream txtIn(sstrIn);
T value;
txtIn >> value;
return value;
}
int TestDb::OnRun(void)
{
wxDbConnectInf Conn;
Conn.AllocHenv();
Conn.SetConnectionStr(_T("DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=mysql;USER=root;PASSWORD=<your password>;"));
if (Conn.GetHenv()==NULL) {
cerr << _T("Failed to allocate ODBC environment") << endl;
return 1;
}
wxDb *db = wxDbGetConnection(&Conn);
if (db==NULL) {
cerr << _T("Failed to open DB") << endl;
return 1;
}
wxDbFreeConnection(db);
wxDbCloseConnections();
return 0;
}
IMPLEMENT_APP(TestDb)