Steffen Goeldner wrote:
>
> DBD::ODBC's get_info() method returns strange results for some
> info types, e.g.:
>
> SQL_XOPEN_CLI_YEAR 10000 892942641
>
> instead of
>
> SQL_XOPEN_CLI_YEAR 10000 1995
>
> I'm quite sure the attached patch fixes that.
Further, the script dumps for unsupported info types, e.g.:
SQL_MAXIMUM_STMT_OCTETS: rc == -1
The attached patch seems to fix that.
However, comments from XS-experts would be appreciated.
Steffen
*** DBD-ODBC-0.37-orig/dbdimp.c Sun Feb 10 19:34:36 2002
--- DBD-ODBC-0.37/dbdimp.c Mon Feb 11 20:03:08 2002
***************
*** 2426,2432 ****
rgbInfoValue, sizeof(rgbInfoValue)-1, &cbInfoValue);
if (!SQL_ok(rc)) {
dbd_error(dbh, rc, "odbc_get_info/SQLGetInfo");
! return Nullsv;
}
/* Fancy logic here to determine if result is a string or int */
--- 2426,2432 ----
rgbInfoValue, sizeof(rgbInfoValue)-1, &cbInfoValue);
if (!SQL_ok(rc)) {
dbd_error(dbh, rc, "odbc_get_info/SQLGetInfo");
! return &sv_undef;
}
/* Fancy logic here to determine if result is a string or int */
***************
*** 2434,2440 ****
retsv = newSViv(*(int *)rgbInfoValue); /* XXX cast */
else if (cbInfoValue != 2 && cbInfoValue != 4) /* must be string */
retsv = newSVpv(rgbInfoValue, 0);
! else if (rgbInfoValue[cbInfoValue+1] == '\0') /* must be string */
retsv = newSVpv(rgbInfoValue, 0);
else if (cbInfoValue == 2) /* short */
retsv = newSViv(*(short *)rgbInfoValue); /* XXX cast */
--- 2434,2440 ----
retsv = newSViv(*(int *)rgbInfoValue); /* XXX cast */
else if (cbInfoValue != 2 && cbInfoValue != 4) /* must be string */
retsv = newSVpv(rgbInfoValue, 0);
! else if (rgbInfoValue[cbInfoValue] == '\0') /* must be string */
retsv = newSVpv(rgbInfoValue, 0);
else if (cbInfoValue == 2) /* short */
retsv = newSViv(*(short *)rgbInfoValue); /* XXX cast */