Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, January 2007
qt 4.1.2 some questions about ODBC


Message 1 in thread

I am fairly new to QT, so I apologize if my questions wont be very hard :)
I am triyng to understand how work with database through ODBC and looking
inside C:\Qt\4.1.2\src\sql\drivers\odbc\qsql_odbc.cpp

1) ODBC version. qsqlodbc.dll register two aliases for himself, "ODBC" and
"ODBC3", but in method QODBCDriver::open() I see a command:
    r = SQLSetEnvAttr(d->hEnv,
                       SQL_ATTR_ODBC_VERSION,
                       (SQLPOINTER)SQL_OV_ODBC2,
                       SQL_IS_UINTEGER);
which effectivly uses second version of ODBC... Am I missing something?
I prefer to work with ODBC 3+, because of SQLSTATE codes in it are much more
informative comparing to older versions.

2) In the same method QODBCDriver::open(), function SQLDriverConnect are
always called with flag SQL_DRIVER_NOPROMPT. Is it possible, to change this
flag to other flags?

3) ODBC by itself has several wizards like SQLCreateDataSource,
SQLDriverConnect with SQL_DRIVER_PROMPT flag, etc. Is it possible, to call
this wizards from QSqlDriver? I think it will go against current QSql
design, or not?

4) If I want to use driver specific attributes, how can I do it? In pure
C/ODBC, my code looks like:
 RetCode = SQLSetConnectAttr(hDbc, SETUP_CALLBACK,
        (SQLPOINTER) &my_msgproc, SQL_IS_POINTER );
Here 'my_msgproc' is a name of function I regestering as callback.
How to do this in QSqlDriver terms?

I think all this wishes can be satisfied with my own ODBC plugin, but may be
I just missing something? Or is there any other ODBC plugin for QT?


--
 [ signature omitted ]