Mad_Mac:

Nah, you don't need the concatenation operators. That's why I put the map in there. I think you're getting stuck on making the SQL concatenate the strings together, rather than letting perl do it for you.

Think of it this way, you get a list of artists to search for:

my @inc_artists = ( 'Watson', 'Cline', 'Horne' );

The first chunk of code would generate an SQL statement that looks like:

SELECT SongTitle, SongPath FROM Songs WHERE (Songs.Artist LIKE ?) OR (Songs.Artist LIKE ?) OR (Songs.Artist LIKE ?)

The map statement with the execute wraps your artist names with the '%' symbols you want, so they end up look like:

( '%Watson%', '%Cline%', '%Horne%' );

Finally, the execute statement would effectively have a statement like:

SELECT SongTitle, SongPath FROM Songs WHERE (Songs.Artist LIKE '%Watson%') OR (Songs.Artist LIKE '%Cline%') OR (Songs.Artist LIKE '%Horne%')

which is what I think you want to feed to SQLite.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re^3: Error with DBI and Strawberry Perl under 64 bit W7 by roboticus
in thread Error with DBI and Strawberry Perl under 64 bit W7 by Mad_Mac

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.