Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: RFC: Placeholder creation for SQL statements

by Anonymous Monk
on Mar 09, 2018 at 14:15 UTC ( #1210568=note: print w/replies, xml ) Need Help??


in reply to RFC: Placeholder creation for SQL statements

What you call "cumbersome" and "more work," though, might make the code more maintainable in the long run. Code changes are usually made through version-control commits which are tied to work-order or trouble tickets. The delta within that commit describes exactly what was changed, and it should be seen to be specific to the problem. Also, the change should minimize testing impact we should not have to go back and see if other, unrelated code is now broken. If you create "clever" code to do something you might create a black-hole which can't be readily touched ... and/or that can't be instantly understood. DBI already has the ability to pass an array of placeholder values to a query so that they will be substituted for the ? marks left-to-right.
  • Comment on Re: RFC: Placeholder creation for SQL statements

Replies are listed 'Best First'.
Re^2: RFC: Placeholder creation for SQL statements
by choroba (Bishop) on Mar 09, 2018 at 15:22 UTC
    > DBI already has the ability to pass an array of placeholder values to a query so that they will be substituted for the ? marks left-to-right.

    But it only works if you know the number of the placeholders in advance, which is exactly the problem the OP tries to solve.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re^2: RFC: Placeholder creation for SQL statements
by LanX (Bishop) on Mar 09, 2018 at 16:14 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1210568]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2018-06-18 23:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (111 votes). Check out past polls.

    Notices?