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 (?),
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.
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
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
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
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
, 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
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
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{
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
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
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( ,
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
13 matches
Mail list logo