Skip Menu |

This queue is for tickets about the DBD-ODBC CPAN distribution.

Report information
The Basics
Id: 52651
Status: rejected
Priority: 0/
Queue: DBD-ODBC

People
Owner: Nobody in particular
Requestors: nomorsad.poubelle [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.23
Fixed in: (no value)



Hi, The DBD::ODBC Perl module don't seems to work with the ODBC Sqlite driver from http://www.ch-werner.de/sqliteodbc/ (last version 0.84) However, this SQlite driver works great with other non-Perl applications. I think the message come from : http://www.ch-werner.de/sqliteodbc/html/sqlite3odbc_8c-source.html#l08995 Regards, Vincent * Versions : ActivePerl 5.8.9 DBD::ODBC 1.23 DBI 1.609 * Example of script : use DBD::ODBC; DBI->connect("dbi:ODBC:DSN=SCF1"); output with stack trace: DBI connect('DSN=SCF1','',...) failed: invalid length or pointer (SQL-HY009) at C:/Perl/lib/DBI.pm line 652 DBI::__ANON__(undef, undef) called at C:/Perl/lib/DBI.pm line 706 DBI::connect('DBI', 'dbi:ODBC:DSN=SCF1') called at C:\Documents and Settings\Administrateur\Bureau\test.pl line 3
On Thu Dec 10 11:51:03 2009, nomorsad wrote: Show quoted text
> Hi, > > The DBD::ODBC Perl module don't seems to work with the ODBC Sqlite > driver from http://www.ch-werner.de/sqliteodbc/ (last version 0.84) > > However, this SQlite driver works great with other non-Perl applications. > > I think the message come from : > http://www.ch-werner.de/sqliteodbc/html/sqlite3odbc_8c-source.html#l08995 > > Regards, > Vincent > > > > * Versions : > ActivePerl 5.8.9 > DBD::ODBC 1.23 > DBI 1.609 > > * Example of script : > > use DBD::ODBC; > DBI->connect("dbi:ODBC:DSN=SCF1"); > > output with stack trace: > > DBI connect('DSN=SCF1','',...) failed: invalid length or pointer > (SQL-HY009) at C:/Perl/lib/DBI.pm line 652 > DBI::__ANON__(undef, undef) called at C:/Perl/lib/DBI.pm line 706 > DBI::connect('DBI', 'dbi:ODBC:DSN=SCF1') called at C:\Documents and > Settings\Administrateur\Bureau\test.pl line 3
DBD::ODBC uses SQLSetConnectOption (the older API) not SQLSetConnectAttr. The driver manager is supposed to translate SQLSetCOnnectOption calls to SQLSetConnectAttr calls and I'd guess it does not set len to SQL_IS_INTEGER (it probably passed 0). If you look at the ODBC API docs sqllite should not be looking at the len for SQL_AUTO_COMMIT as they say: "If Attribute is an ODBC-defined attribute and ValuePtr is an integer, StringLength is ignored." You can find the docs here: http://msdn.microsoft.com/en-us/library/ms713605%28VS.85%29.aspx I think sqllite is wrong in this case, it should not require the len to be SQL_IS_INTEGER or SQL_IS_UINTEGER or SQL_IS_POINTER as SQL_AUTO_COMMIT is an ODBC defined attribute. Also, the remainder of the code is absolutely wrong here: if (val && len >= sizeof (SQLINTEGER)) { 09019 getit: 09020 d->autocommit = *((SQLINTEGER *) val) == SQL_AUTOCOMMIT_ON; I len was > sizeof(SQLINTEGER) and val was 0 or 1 (for on or off) then the code above would attempt to dereference 0 or 1 which would seg fault. You need to go back to the sqllite people and tell then this code is wrong. If the attribute is SQL_AUTO_COMMIT they can simply treat val as an SQL_INTEGER which contains SQL_AUTOCOMMIT_ON or OFF. I'll leave this report open for a while in case you or someone at sqllite want to comment but it is not a bug in DBD::ODBC. Martin -- Martin J. Evans Wetherby, UK
Le Jeu. Déc. 10 12:41:56 2009, MJEVANS a écrit : Show quoted text
> You need to go back to the sqllite people and tell then this code is > wrong. If the attribute is SQL_AUTO_COMMIT they can simply treat val as > an SQL_INTEGER which contains SQL_AUTOCOMMIT_ON or OFF. > > I'll leave this report open for a while in case you or someone at > sqllite want to comment but it is not a bug in DBD::ODBC. > > Martin
Thanks for your answer. I will try to contact the author of sqliteodbc.
On Fri Dec 11 03:53:15 2009, nomorsad wrote:
Show quoted text
> Le Jeu. Déc. 10 12:41:56 2009, MJEVANS a écrit :
> > You need to go back to the sqllite people and tell then this code is
> > wrong. If the attribute is SQL_AUTO_COMMIT they can simply treat val as
> > an SQL_INTEGER which contains SQL_AUTOCOMMIT_ON or OFF.
> >
> > I'll leave this report open for a while in case you or someone at
> > sqllite want to comment but it is not a bug in DBD::ODBC.
> >
> > Martin
>
> Thanks for your answer. I will try to contact the author of sqliteodbc.

Did you get anywhere with this?

Martin
--
Martin J. Evans
Wetherby, UK
From: nomorsad.poubelle [...] gmail.com
On Thu Jan 07 12:43:06 2010, MJEVANS wrote: <br /> &gt; <br /> &gt; Did you get anywhere with this? <br /> &gt; <br /> <br /> odbcsqlite has been fixed in the developpement version (0.85pre1).<br /> The problem will probalby be fixed in 0.85 release.<br /> <br /> <br />
On Thu Jan 07 16:59:52 2010, nomorsad wrote:
Show quoted text
> On Thu Jan 07 12:43:06 2010, MJEVANS wrote: <br />
> &gt; <br />
> &gt; Did you get anywhere with this? <br />
> &gt; <br />
> <br />
> odbcsqlite has been fixed in the developpement version (0.85pre1).<br />
> The problem will probalby be fixed in 0.85 release.<br />
> <br />
> <br />

ok, I will close this once I've added a note to DBD::ODBC to mention this issue.

Thanks

Martin
--
Martin J. Evans
Wetherby, UK
On Thu Jan 07 17:23:58 2010, MJEVANS wrote:
Show quoted text
> On Thu Jan 07 16:59:52 2010, nomorsad wrote:
> > On Thu Jan 07 12:43:06 2010, MJEVANS wrote: <br />
> > &gt; <br />
> > &gt; Did you get anywhere with this? <br />
> > &gt; <br />
> > <br />
> > odbcsqlite has been fixed in the developpement version (0.85pre1).<br />
> > The problem will probalby be fixed in 0.85 release.<br />
> > <br />
> > <br />
>
> ok, I will close this once I've added a note to DBD::ODBC to mention this
> issue.
>
> Thanks
>
> Martin
> --
> Martin J. Evans
> Wetherby, UK

I added a FAQ entry and will close this rt now.

Martin
--
Martin J. Evans
Wetherby, UK