Re: shortcuts for common placeholder idioms...

2003-03-17 Thread Moritz von Schweinitz
better late than never.. i'd just like to recommend some more hash-friendly routines for these kind of operations. i know that they are relativly tricial to code, but would make it all seem more natural for the beginners, methinks. something like $dbh-hash_do(INSERT INTO table (?) VALUES (?),

Re: shortcuts for common placeholder idioms...

2003-03-17 Thread Michael A Chase
On Mon, 17 Mar 2003 05:07:36 -0600 Moritz von Schweinitz [EMAIL PROTECTED] wrote: i'd just like to recommend some more hash-friendly routines for these kind of operations. i know that they are relativly tricial to code, but would make it all seem more natural for the beginners, methinks.

Re: shortcuts for common placeholder idioms...

2003-03-17 Thread Tim Bunce
On Mon, Mar 17, 2003 at 12:04:22PM -0800, Michael A Chase wrote: On Mon, 17 Mar 2003 05:07:36 -0600 Moritz von Schweinitz [EMAIL PROTECTED] wrote: i'd just like to recommend some more hash-friendly routines for these kind of operations. i know that they are relativly tricial to code, but

Re: shortcuts for common placeholder idioms...

2003-03-17 Thread Michael A Chase
On Mon, 17 Mar 2003 20:49:49 + Tim Bunce [EMAIL PROTECTED] wrote: On Mon, Mar 17, 2003 at 12:04:22PM -0800, Michael A Chase wrote: Spliting into separate prepare and execute stages and using placeholders would allow prepare once and execute many times and allow the subroutines to be

Re: shortcuts for common placeholder idioms...

2003-03-11 Thread Tim Bunce
On Mon, Mar 10, 2003 at 03:47:31PM -0800, Jeff Zucker wrote: Paul Boutros wrote: my $sql = qq{ INSERT INTO table ( ${\comma_separated_values(@col)} ) VALUES ( ${\comma_separated_placeholders(@col)} ) }; I'm not sure I like this, but if it is to be used, a better name might

Re: shortcuts for common placeholder idioms...

2003-03-11 Thread Keith Jackson
my 2 cents... You can't just blindly take form names from the query object and try to stuff them in a table. I have function that I call first that determines the common fields between the form and my table. Then I create the insert/update statement. Thanks Tim for the x @cols clause. Going

RE: shortcuts for common placeholder idioms...

2003-03-11 Thread Mitch Helle-Morrissey
, first, last) values (?, ?, ?) -Original Message- From: Keith Jackson [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2003 8:40 AM To: Tim Bunce Cc: [EMAIL PROTECTED] Subject: Re: shortcuts for common placeholder idioms... my 2 cents... You can't just blindly take form names from

shortcuts for common placeholder idioms...

2003-03-10 Thread Tim Bunce
foreach ( $cgi-param() ) { push @cols, $_; push @vals, $cgi - param( $_ ); } my $sql = INSERT INTO table ( . join( , , @cols ) . )\n . VALUES ( . join( , , map { ? } @cols ) . ); Seeing all that 'line noise' makes me think we need a neater way. Personally I'd have written

Re: shortcuts for common placeholder idioms...

2003-03-10 Thread Michael A Chase
On Mon, 10 Mar 2003 22:15:35 + Tim Bunce [EMAIL PROTECTED] wrote: But imagine the DBI provided these two functions: sub comma_separated_values { join , , @_ } sub comma_separated_placeholders { join , , (?) x @_ } you could then write the statement like this: separated my $sql = qq{

Re: shortcuts for common placeholder idioms...

2003-03-10 Thread Paul Boutros
foreach ( $cgi-param() ) { push @cols, $_; push @vals, $cgi - param( $_ ); } my $sql = INSERT INTO table ( . join( , , @cols ) . )\n . VALUES ( . join( , , map { ? } @cols ) . ); Seeing all that 'line noise' makes me think we need a neater way. Personally I'd have

Re: shortcuts for common placeholder idioms...

2003-03-10 Thread Jeffrey Baker
On Mon, Mar 10, 2003 at 05:56:49PM -0500, Paul Boutros wrote: foreach ( $cgi-param() ) { push @cols, $_; push @vals, $cgi - param( $_ ); } my $sql = INSERT INTO table ( . join( , , @cols ) . )\n . VALUES ( . join( , , map { ? } @cols ) . ); Seeing all that

Re: shortcuts for common placeholder idioms...

2003-03-10 Thread Paul Boutros
On Mon, 10 Mar 2003, Jeffrey Baker wrote: On Mon, Mar 10, 2003 at 05:56:49PM -0500, Paul Boutros wrote: foreach ( $cgi-param() ) { push @cols, $_; push @vals, $cgi - param( $_ ); } my $sql = INSERT INTO table ( . join( , , @cols ) . )\n . VALUES ( . join( ,

Re: shortcuts for common placeholder idioms...

2003-03-10 Thread Jeff Zucker
Paul Boutros wrote: my $sql = qq{ INSERT INTO table ( ${\comma_separated_values(@col)} ) VALUES ( ${\comma_separated_placeholders(@col)} ) }; I'm not sure I like this, but if it is to be used, a better name might be comma_list which is the BNF short notation for all comma separated