in reply to Re^2: Perl DBI '?' substitution with prepare/execute (abstract SQL)
in thread Perl DBI '?' substitution with prepare/execute

What I especially like about SQL::Abstract is that the problem of variable numbers of placeholders is addressed, it's no fun to generate strings like (?,?,?,?) for IN statements.

Hmm, interesting. I'll have to take a closer look at that module. I had previously been building strings like this:

my $insertstring = '['.join('],[', @sqlcolumns).']'; my $valuestring = join(',', map {'?'} @sqlcolumns); my $query = "INSERT INTO table ($insertstring) VALUES ($valuest +ring)";
Which is, as you say, tedious.

Replies are listed 'Best First'.
Re^4: Perl DBI '?' substitution with prepare/execute (abstract SQL)
by LanX (Saint) on Apr 18, 2016 at 16:35 UTC
    yeah but IMHO the way operators like IN are coded into hashes doesn't improve readability..

    hopefully I'll meet ribasushi soon again to discuss further, SQL is not my core domain...

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      Hmm, I see what you mean. Also, the flexibility and mutability of the operators makes this quite a daunting API to learn.