DBD::ODBC and FreeTDS
From: Frediano (Frediano.Ziglio_at_vodafone.com)
Date: 04/16/04
- Next message: phneik_at_ed.shawcable.net: "Sisters nice tits and Handjob 3477"
- Previous message: Tim To: "performance problem with dbd oracle"
- Next in thread: Jeff Urlwin: "RE: :ODBC and FreeTDS"
- Reply: Jeff Urlwin: "RE: :ODBC and FreeTDS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 16 Apr 2004 11:21:27 +0200 To: <dbi-users@perl.org>
I'm doing some test to get 100% working with FreeTDS (sql server odbc
driver for *nix) and DBD::ODBC.
Using 1.09 I get some fails (see out1.txt)
Analyzing log (unixODBC and FreeTDS one) it appear that binding is wrong
for input/output parameters. You bind a string composed by one zero
character ("\0"), not a NULL. I did this change:
diff -r -U10 DBD-ODBC-1.09orig/dbdimp.c DBD-ODBC-1.09/dbdimp.c
--- DBD-ODBC-1.09orig/dbdimp.c 2004-03-06 18:53:58.000000000 +0100
+++ DBD-ODBC-1.09/dbdimp.c 2004-04-15 21:24:10.000000000 +0200
@@ -2617,20 +2634,21 @@
cbColDef = 1;
if (phs->is_inout) {
if (!phs->sv_buf) {
croak("panic: DBD::ODBC binding undef with bad buffer!!!!");
}
phs->sv_buf[0] = '\0'; /* just in case, we *know* we called
SvGROW above */
rgbValue = phs->sv_buf;
/* patch for binding undef inout params on sql server */
ibScale = 1;
phs->cbValue = 1;
+ phs->cbValue = SQL_NULL_DATA;
} else {
rgbValue = NULL;
phs->cbValue = SQL_NULL_DATA;
}
}
else {
rgbValue = phs->sv_buf;
phs->cbValue = (UDWORD) value_len;
/* not undef, may be a blank string or something */
if (phs->cbValue == 0)
however I get a infinite loop (see out2.txt). From unixODBC log it seems
that DBD::ODBC calls in a loop SQLMoreResults, SQLMoreResults returns
SQL_NO_DATA however DBD::ODBC doesn't reset moreResults.
I improved the patch (attached) however I don't understand why I get
infinite loop with FreeTDS and not with MS ODBC...
Why you pass a null character instead of a NULL? From comment it's a
workaround for sql server however it can break other drivers, a best way
for sql server if to use only output parameter (not input/output) cause
with sql server you use always deferred bind.
I did also some changes to t/07bind.t however I don't know if these
change are so right...
freddy77
- text/plain attachment: out1.txt
- text/plain attachment: out2.txt
- application/x-gzip attachment: dbd.diff.gz
- Next message: phneik_at_ed.shawcable.net: "Sisters nice tits and Handjob 3477"
- Previous message: Tim To: "performance problem with dbd oracle"
- Next in thread: Jeff Urlwin: "RE: :ODBC and FreeTDS"
- Reply: Jeff Urlwin: "RE: :ODBC and FreeTDS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|