The attached patch makes it possible to choose the ODBC version. E.g.: my $dbh = DBI->connect( ..., { odbc_version => 3 } )
directs the driver to exhibit ODBC 3.x behavior. Steffen
diff -bc DBD-ODBC-0.38-orig/ODBC.pm DBD-ODBC-0.38/ODBC.pm *** DBD-ODBC-0.38-orig/ODBC.pm Tue Feb 12 17:17:36 2002 --- DBD-ODBC-0.38/ODBC.pm Fri Feb 22 22:49:33 2002 *************** *** 59,65 **** sub connect { my $drh = shift; ! my($dbname, $user, $auth)= @_; $user = '' unless defined $user; $auth = '' unless defined $auth; --- 59,65 ---- sub connect { my $drh = shift; ! my($dbname, $user, $auth, $attr)= @_; $user = '' unless defined $user; $auth = '' unless defined $auth; *************** *** 73,79 **** # Call ODBC logon func in ODBC.xs file # and populate internal handle data. ! DBD::ODBC::db::_login($this, $dbname, $user, $auth) or return undef; $this; } --- 73,79 ---- # Call ODBC logon func in ODBC.xs file # and populate internal handle data. ! DBD::ODBC::db::_login($this, $dbname, $user, $auth, $attr) or return undef; $this; } diff -bc DBD-ODBC-0.38-orig/dbdimp.c DBD-ODBC-0.38/dbdimp.c *** DBD-ODBC-0.38-orig/dbdimp.c Tue Feb 12 19:11:56 2002 --- DBD-ODBC-0.38/dbdimp.c Fri Feb 22 23:03:36 2002 *************** *** 166,176 **** --- 166,184 ---- ------------------------------------------------------------*/ int dbd_db_login(dbh, imp_dbh, dbname, uid, pwd) + SV *dbh; imp_dbh_t *imp_dbh; char *dbname; char *uid; char *pwd; + { + return dbd_db_login6(dbh, imp_dbh, dbname, uid, pwd, Nullsv); + } + + int + dbd_db_login6(dbh, imp_dbh, dbname, uid, pwd, attr) SV *dbh; imp_dbh_t *imp_dbh; char *dbname; char *uid; char *pwd; + SV *attr; { D_imp_drh_from_dbh; int ret; *************** *** 195,200 **** --- 203,224 ---- if (!SQL_ok(rc)) return 0; } + { + SV **odbc_version_sv; + UV odbc_version = 0; + DBD_ATTRIB_GET_IV(attr, "odbc_version",12, odbc_version_sv, odbc_version); + if (odbc_version) { + rc = SQLSetEnvAttr(imp_drh->henv, SQL_ATTR_ODBC_VERSION, +(SQLPOINTER)odbc_version, SQL_IS_INTEGER); + if (!SQL_ok(rc)) { + dbd_error(dbh, rc, "db_login/SQLSetEnvAttr"); + if (imp_drh->connects == 0) { + SQLFreeEnv(imp_drh->henv); + imp_drh->henv = SQL_NULL_HENV; + } + return 0; + } + } + } imp_dbh->henv = imp_drh->henv; /* needed for dbd_error */ rc = SQLAllocConnect(imp_drh->henv, &imp_dbh->hdbc); diff -bc DBD-ODBC-0.38-orig/dbdimp.h DBD-ODBC-0.38/dbdimp.h *** DBD-ODBC-0.38-orig/dbdimp.h Thu Feb 07 15:50:32 2002 --- DBD-ODBC-0.38/dbdimp.h Fri Feb 22 21:54:04 2002 *************** *** 131,136 **** --- 131,137 ---- #define dbd_init odbc_init #define dbd_db_login odbc_db_login + #define dbd_db_login6 odbc_db_login6 #define dbd_db_do odbc_db_do #define dbd_db_commit odbc_db_commit #define dbd_db_rollback odbc_db_rollback Common subdirectories: DBD-ODBC-0.38-orig/iodbcsrc and DBD-ODBC-0.38/iodbcsrc Common subdirectories: DBD-ODBC-0.38-orig/mytest and DBD-ODBC-0.38/mytest Common subdirectories: DBD-ODBC-0.38-orig/t and DBD-ODBC-0.38/t