>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 09, 2001 8:55 PM
Subject: Re: Reusable code for binding columns.
>. . .
> Personally, I think this is a perfect example of the "beauty" of Perl.
> Visually, \@column{qw(one two three four five)} LOOKS like a ref of
> "Steve" == Steve Howard <[EMAIL PROTECTED]> writes:
Steve> Thanks to all for the further discussion on this. After this
Steve> tonight, going back to my original question about reusable code
Steve> for binding columns, this makes for a slicker solution than I
Steve> even though would come f
On 2001-03-10 01:46:58, [EMAIL PROTECTED] wrote:
>
> $rc = $sth->bind_columns(\@column{qw($columns)});
qw doesn't work like you seem to expect (see perlop(1)). You need
something like:
my @columns = split / /, $columnlist; # or whatever
# ...
$rc = $sth->bind_columns(\@col
l! That's even better than I exected as a solution.
Thanks a lot to all of you who responded, and contributed.
Steve Howard
-Original Message-
From: James Maes [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 09, 2001 11:28 PM
To: Sterin, Ilya; Matthew O. Persico; [EMAIL PROTECTED]
Ilya Sterin
-Original Message-
From: James Maes [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 10, 2001 12:28 AM
To: Sterin, Ilya; Matthew O. Persico; [EMAIL PROTECTED]
Subject: Re: Reusable code for binding columns.
still need an ='s sign for anonymouse arrays
@hash = {
n order to declare the hash, it has to a hash, not a slice of a hash;
you don't yet have a hash to slice :-). Try this:
my %hash = ('hi_there' => undef,
'bye_there' => 'testing',
'over_there' => undef);
>
>
On 2001-03-10 00:10:39, [EMAIL PROTECTED] wrote:
>
> why doesn't this work with my perl5.6
>
> use strict;
> my @hash{'hi_there','bye_there','over_there'};
> $hash{'bye_there'} = "testing";
> print $hash{'bye_there'};
What are you expecting it to do? It isn't meaningful to "my" a hash
slice, or
= "testing";
> print $hash{'bye_there'};
>
> Any ideas, it comes with...
> syntax error at test.pl line 2, near "@hash{"
> Execution of test.pl aborted due to compilation errors.
>
> -Original Message-
> From: Matthew O. Persico [mailto:[
quot;testing";
print $hash{'bye_there'};
Any ideas, it comes with...
syntax error at test.pl line 2, near "@hash{"
Execution of test.pl aborted due to compilation errors.
-Original Message-
From: Matthew O. Persico [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 09, 20
"Thomas A. Lowery" wrote:
>
> OK Randal, how does this work? I put it in code and see it WORKS, but my
> brains hurts trying to understand it.
>
> > $rc = $sth->bind_columns(\@column{qw(one two three four five)});
Step back a bit.
An array element is $array[0].
An array slice is @array[1,2
On 2001-03-09 22:56:11, [EMAIL PROTECTED] wrote:
>
> OK Randal, how does this work? I put it in code and see it WORKS, but
> my brains hurts trying to understand it.
>
> > $rc = $sth->bind_columns(\@column{qw(one two three four five)});
@x{qw(a b) is ($x{a}, $x{b}). \($a, $b) is (\$a, \$b).
T
'}, \$column{'four'},
\$column{'five'}
That's exactly the type of arg list bind_columns() wants.
Pretty cool. Pretty Perl. 8-)
> -Original Message-
> From: Thomas A. Lowery [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 09, 2001 10:56 PM
> To: [EMAIL
OK Randal, how does this work? I put it in code and see it WORKS, but my
brains hurts trying to understand it.
> $rc = $sth->bind_columns(\@column{qw(one two three four five)});
Tom
On Wed, Mar 07, 2001 at 11:46:07PM -0800, Randal L. Schwartz wrote:
>
> This is weird, but it works:
>
> Now
When I generate SQL automatically from the datadictionary, I normally use an
array to hold the column values:
# $dbh -> {RaiseError} = 1;
$sth -> execute;
my @sTitle = @{$sth -> {'NAME'}};
my @sCol = ();
$sth -> bind_columns( \( @sCol[0 .. $#sTitle] ) );
while ( $sth -> fetch )
On 7 Mar 2001, Randal L. Schwartz wrote:
> This is weird, but it works:
>
> $rc = $sth->bind_columns(\@column{qw(one two three four five)});
I actually do this all the time with arrays:
> $rc = $sth->bind_columns(\@column[0..$#cols]);
Very sweet.
David
> "Steve" == Steve Howard <[EMAIL PROTECTED]> writes:
Steve> $row = $select->bind_columns(undef, \$column1, \$column2..
This is weird, but it works:
$rc = $sth->bind_columns(\@column{qw(one two three four five)});
Now $column{one} is the first column, and $column{two} is the second
col
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Wed, Mar 07, 2001 at 09:16:10PM -0600, Steve Howard wrote:
> My problem comes with finding a way to build reusable code for a subroutine
> to deal with tables that will not go straight across. The obstacle is in
> this statement:
>
> $row = $selec
17 matches
Mail list logo