Hello all, Not sure if this is a bug, i'm starting to think it could be. Works fine for other queries, but not this one for some reason. bind_param simply doesn't replace the param no matter what I do:
my $blogTagToShow = shift; my $dbh = DBI->connect("dbi:SQLite:dbname=$db"); $dbh->trace(4); my $query = "SELECT * FROM tblBlogPosts WHERE fldTags LIKE '%?%' ORDER + BY fldDate DESC"; my $sth = $dbh->prepare($query); $sth->bind_param(1, $blogTagToShow); $dbh->trace(0);
When looking at the trace, it seems to go through the motions of binding the param, but doesn't.
sqlite trace: prepare statement: SELECT * FROM tblBlogPosts WHERE fldT +ags LIKE '%?%' ORDER BY fldDate DESC at dbdimp.c line 258 <- prepare= DBI::st=HASH(0x93bba20) at Libraries//libBlog.pm line +42 via at index.pl line 152 -> bind_param for DBD::SQLite::st (DBI::st=HASH(0x93bba20)~0x93b64 +ec 1 'windows') sqlite trace: bind into 0x93b6504: 1 => windows (0) pos 0 at dbdimp.c line 464 <- bind_param= 1 at Libraries//libBlog.pm line 43 via at index.pl + line 152 -> trace for DBD::SQLite::db (DBI::db=HASH(0x93b62dc)~0x93b627c 0) <- trace= 4 at Libraries//libBlog.pm line 45 via at index.pl line + 152 -> execute for DBD::SQLite::st (DBI::st=HASH(0x93bba20)~0x93b64ec) sqlite trace: execute at dbdimp.c line 325 sqlite trace: Execute returned 6 cols
Anyone got any ideas ? Cheers!, Dave

In reply to DBI:SQLite bind_param problem by davehope

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.