FAQ
All,

Is there a quick fix to allow substr to be called with two parameters
instead of three? Sometime in 3.5 the official SQLite distribution
made the third parameter optional and it looks like there is code
within the sqlite3.c that makes queries using that form of the
function. However, when I execute a SQL statement in my Perl code
using either DBD::SQLite 1.31 or 1.32.1 I get an error saying prepare
failed and that substr was being called with the wrong number of
arguments.

Using the same query in the sqlite3 command line utility executes
appropriately. Thanks!

--
Jesse Erdmann
Bioinformatics Analyst
Masonic Cancer Center
University of Minnesota
jerdmann@umn.edu
612-626-3123

jesse@jesseerdmann.com
Twitter: http://twitter.com/jesseerdmann

Search Discussions

  • Kenichi ishigaki at Feb 12, 2011 at 1:54 am
    Hi,

    the following test script works for me on debian, centos, and windows.
    Please make sure your DBD::SQLite is compiled with the bundled library.
    I'm afraid that your DBD::SQLite is possibly compiled with an older version
    of system sqlite.

    ------------------------
    #!/usr/bin/perl
    use strict;
    use warnings;
    use DBI;
    use Test::More tests => 4;

    my $dbh = DBI->connect('dbi:SQLite::memory:');
    cmp_ok $DBD::SQLite::VERSION, '>', 1.14, "DBD::SQLite $DBD::SQLite::VERSION";
    cmp_ok $dbh->{sqlite_version}, 'ge', "3.6", "Compiled with
    $dbh->{sqlite_version}";

    $dbh->do('create table foo (text)');
    $dbh->do('insert into foo values (?)', undef, "works for me?");
    is $dbh->selectrow_array('select substr(text,5) from foo') => 's for me?';
    is $dbh->selectrow_array('select substr(text,5,2) from foo') => 's ';
    ------------------------

    HTH,

    Kenichi

    2011/2/12 Jesse Erdmann <jerdmann@umn.edu>:
    All,

    Is there a quick fix to allow substr to be called with two parameters
    instead of three? ?Sometime in 3.5 the official SQLite distribution
    made the third parameter optional and it looks like there is code
    within the sqlite3.c that makes queries using that form of the
    function. ?However, when I execute a SQL statement in my Perl code
    using either DBD::SQLite 1.31 or 1.32.1 I get an error saying prepare
    failed and that substr was being called with the wrong number of
    arguments.

    Using the same query in the sqlite3 command line utility executes
    appropriately. ?Thanks!

    --
    Jesse Erdmann
    Bioinformatics Analyst
    Masonic Cancer Center
    University of Minnesota
    jerdmann@umn.edu
    612-626-3123

    jesse@jesseerdmann.com
    Twitter: http://twitter.com/jesseerdmann

    _______________________________________________
    DBD-SQLite mailing list
    DBD-SQLite@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbd-sqlite

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbd-sqlite @
postedFeb 11, '11 at 9:01p
activeFeb 12, '11 at 1:54a
posts2
users2
websiteshadowcat.co.uk

2 users in discussion

Jesse Erdmann: 1 post Kenichi ishigaki: 1 post

People

Translate

site design / logo © 2021 Grokbase