Subject: | ODBC driver does not support SQL_COLUMN_DISPLAY_SIZE on SQLTables() |
DBD-ODBC-1.17 : (ODBC.pm 11768 2008-09-12 13:00:28Z mjevans)
perl : v5.10.0 built for MSWin32-x86-multi-thread, Binary build 1004
[287188] provided by ActiveState, Built Sep 3 2008 13:16:37
I use a propriety ODBC driver that does not support
SQL_COLUMN_DISPLAY_SIZE and SQL_COLUMN_LENGTH on statement handles that
come from a call to SQLTables() and SQLColumns().
I did some debugging to find out and made a 'fix' in
dbdimp.c,dbd_descibe(). The function dbd_descibe() contains via an
#ifdef a fallback when in the interface does not support
SQL_COLUMN_DISPLAY_SIZE and SQL_COLUMN_LENGTH, I extended this. Now the
interface accepts when the implementation does not support those column
attributes and falls back to a default value.
The point that I address it here rather at the implementator of the
ODBC-driver is that this driver works fine with MS office, cognos etc.
Also in respect to retrieving meta data like table and column info.
I hope that you will except this change so I've not to stick to my
private build and it gives me the possibility to utilize Perl in
combination with this driver to a broader audience that myself.
Please find attached a fix in diff-C3 format and a trace file based on
this fix. In this trace I perform a list of some tables, get the columns
of a table and perform a query on that table. The first two actions show
the problem of the not supported attributes the later not.
Regards,
JHF
Subject: | dbdimp_c_fix_diffC3.txt |
*** DBD-ODBC-1.17\dbdimp.c Fri Sep 12 15:01:28 2008
--- DBD-ODBC-1.17-new\dbdimp.c Mon Dec 15 12:25:36 2008
***************
*** 2067,2075 ****
NULL, 0, NULL ,
&fbh->ColDisplaySize);/* TBD: 3.0 update */
if (!SQL_SUCCEEDED(rc)) {
! dbd_error(
! h, rc, "describe/SQLColAttributes/SQL_COLUMN_DISPLAY_SIZE");
! break;
} else if (DBIc_TRACE(imp_sth, 0, 0, 8)) {
TRACE1(imp_sth, " display size = %ld\n", fbh->ColDisplaySize);
}
--- 2067,2078 ----
NULL, 0, NULL ,
&fbh->ColDisplaySize);/* TBD: 3.0 update */
if (!SQL_SUCCEEDED(rc)) {
! if( DBIc_TRACE(imp_sth, 0, 0, 8) ) {
! TRACE1(imp_sth, " describe/SQLColAttributes/SQL_COLUMN_DISPLAY_SIZE not supported, will be equal to SQL_COLUMN_LENGTH\n",0);
! }
! /* ColDisplaySize will be made equal to ColLength */
! fbh->ColDisplaySize = 0;
! rc = SQL_SUCCESS;
} else if (DBIc_TRACE(imp_sth, 0, 0, 8)) {
TRACE1(imp_sth, " display size = %ld\n", fbh->ColDisplaySize);
}
***************
*** 2086,2093 ****
SQL_COLUMN_LENGTH,
NULL, 0, NULL ,&fbh->ColLength);
if (!SQL_SUCCEEDED(rc)) {
! dbd_error(h, rc, "describe/SQLColAttributes/SQL_COLUMN_LENGTH");
! break;
} else if (DBIc_TRACE(imp_sth, 0, 0, 8)) {
TRACE1(imp_sth, " column length = %ld\n", fbh->ColLength);
}
--- 2089,2099 ----
SQL_COLUMN_LENGTH,
NULL, 0, NULL ,&fbh->ColLength);
if (!SQL_SUCCEEDED(rc)) {
! fbh->ColLength = 2001; /* XXX! */
! if( DBIc_TRACE(imp_sth, 0, 0, 8) ) {
! TRACE1(imp_sth, " describe/SQLColAttributes/SQL_COLUMN_LENGT not supported, fallback on %d\n",fbh->ColLength);
! }
! rc = SQL_SUCCESS;
} else if (DBIc_TRACE(imp_sth, 0, 0, 8)) {
TRACE1(imp_sth, " column length = %ld\n", fbh->ColLength);
}
Subject: | dbdimp_c_fix_trace.txt |
Message body is not shown because it is too large.