Re: Converting a list join to a scaler/string
From: sdfgsd (footnipple_at_indiatimes.com)
Date: 11/06/03
- Next message: Richard S Beckett: "nested loop."
- Previous message: J. Gleixner: "Re: Converting a list join to a scaler/string"
- In reply to: J. Gleixner: "Re: Converting a list join to a scaler/string"
- Next in thread: Malcolm Dew-Jones: "Re: Converting a list join to a scaler/string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
>
>
- Next message: Richard S Beckett: "nested loop."
- Previous message: J. Gleixner: "Re: Converting a list join to a scaler/string"
- In reply to: J. Gleixner: "Re: Converting a list join to a scaler/string"
- Next in thread: Malcolm Dew-Jones: "Re: Converting a list join to a scaler/string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|