Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Flexible Update SQL

by bichonfrise74 (Vicar)
on Dec 02, 2010 at 01:14 UTC ( #874795=note: print w/replies, xml ) Need Help??


in reply to Re: Flexible Update SQL
in thread Flexible Update SQL

But this does not solve the problems:
  • passing null parameters...
  • placement of the comma...
  • Replies are listed 'Best First'.
    Re^3: Flexible Update SQL
    by roboticus (Chancellor) on Dec 02, 2010 at 02:53 UTC

      bichonfrise74:

      Actually, placeholders *do* handle the null parameter. Constructing the update statement can do the rest...

      my @fields = qw(name phone city country); my $SQL = "update table set " . join(", ", map { "$_=?" } @fields) . "where ...."; my $ST=$DB->prepare($SQL); while (...) { my @values = (.....); $ST->execute(@values); }

      ...roboticus

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

    Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Node Status?
    node history
    Node Type: note [id://874795]
    help
    Chatterbox?
    [LanX]: choroba: GREAT JOKE! xD
    LanX starts googling the punch line ...
    [choroba]: suddenly, a weird noise can be heard, and the conductor stops them
    [choroba]: (sorry, was interrupted by a call)
    [choroba]: What was that? asks he
    [choroba]: and the triangle player says, "That was me. It's written here in the score"
    [choroba]: and shows a bar with a note "ohne Triangel"
    [choroba]: where "ohne" means "will bend" in Czech

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (12)
    As of 2017-03-27 11:54 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Should Pluto Get Its Planethood Back?



      Results (319 votes). Check out past polls.