Re: Converting a list join to a scaler/string

From: sdfgsd (footnipple_at_indiatimes.com)
Date: 11/06/03


Date: Thu, 06 Nov 2003 16:38:10 GMT


"J. Gleixner" <glex_nospam@qwest.invalid> wrote in message
news:uHuqb.1206$2B6.18819@news.uswest.net...
> sdfgsd wrote:

<snip>

> Now that you've stated you're trying to build SQL, there are better ways
> to do what you want. Read a few of the many articles at:
>
> http://www.perl.com/search/index.ncsp?sp-q=dbi&submit=Search
>
> For instance:
>
> http://www.perl.com/pub/a/2001/03/dbiokay.html
>
> my $fields = join(', ', @fields);
> my $values = join(', ', map { $dbh->quote($_) } @formdata{@fields});
> my $sql = "INSERT into $table ($fields) values ($values)";

Wow. This is a lot easier. Thanks

> Can also use placeholders, and not have to worry about calling quote
> directly, to make things even nicer. That's also covered in that article.
>
>



Relevant Pages

  • Re: Five-year-old penalized because mother tried to leave Cuba
    ... >>> No citations at AI website. ... Cited woth lots of articles in a report. ... You do recall but you don't want to have to admit he has the unconditional ...
    (soc.culture.cuba)
  • Re: Windows Update
    ... Mila <snip> ... When I click download and install, I get the error message ... I have tried all the KB articles and also any MS solutions to ...
    (microsoft.public.windowsupdate)
  • Re: Why cant american cities ban cars?
    ... Mr. Macpherson's wife, ... a secret Romish plot to infiltrate the NYT with articles that would ... Those unwilling to register with the NYT can read the article here: ...
    (rec.bicycles.tech)
  • Re: Lead (Pb) price continues to skyrocket
    ... will you PLEASE start reading those long articles that you ... <snip lengthy quote from the following> ... Duh, Gunner, notice anything about that first URL, which you first supplied ...
    (rec.crafts.metalworking)
  • Re: Katrina, Cuba Aid & Cuba drought
    ... Scroll down for ... || mention of Cuba's drought. ... Very interesting articles. ...
    (alt.smokers.cigars)