Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I have a real strange DBI problem. I'm using DBIx::Abstract for constructing a search function over a message board, but somehow it gives me a real strange error message:

execute called with 2 bind variables when 0 are needed

Has anyone seen this before? This is the code which I am using:

my @what = split(/\s+/, $what); shift @what if $what[0] eq ''; # skip leading empty fields my $first = 1; foreach (@what) { push (@$where, 'AND') unless $first; push (@$where, [ { subject => ['LIKE', "\%$_\%"] }, 'OR', { message => ['LIKE', "\%$_\%"] }, ]); $first = 0; } $dbx->select({ fields => 'reference, subject, name', table => 'boardmessage', where => $where, });

I can't see any mistake in here, still it gives me the above error message. In the debug I found this thing:

DBIx::Abstract::__literal_query('DBIx::Abstract=HASH(0xb92e080)', 'SEL +ECT reference, subject, name FROM boardmessage WHERE ((subject LIKE ? +) OR (message LIKE ?))', '%huhu%', '%huhu%') called at /usr/share/per +l5/DBIx/Abstract.pm line 769

This leave me even more wondering, for there are two ? in the query and two bind values, so I am really wondering where the thing is bailing out? Did I hit a strange error in the module, or am I having something wrong? Please enlighten me, I'm out of ideas here...
--
use signature; signature(" So long\nAlfie");


In reply to strange DBI problem (bind call difference) by alfie

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2022-05-23 18:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?