Re: Ordinal number within a table

In article <B4448B75FF74124ABB5793D8BFBEEA3901C13CAB__14941.5178261281$1119975129$gmane$org [at] exccpgo04.corp.xcelenergy.com>,
"Kapoor, Nishikant" <nishikant.x.kapoor [at] xcelenergy.com> writes:

> I could, but I am assigning the entire resultset in one shot to another construct as follows:

> my $str = "SELECT \ [at] row:=\ [at] row+1 as row, <fields> FROM <tables> WHERE ...";
> my $sth = $conn->prepare($st);
> $sth->execute();
> return $sth->fetchall_arrayref( {} );

Just change the last line to

my $n = 0;
return [ map { [ ++$n, [at] $_ ] } [at] {$sth->fetchall_arrayref} ];

What's the problem?


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules [at] m .gmane.org
Harald Fuchs [ Di, 28 Juni 2005 18:53 ] [ ID #856819 ]
Datenbanken » gmane.comp.db.mysql.perl » Re: Ordinal number within a table

Vorheriges Thema: RE: Ordinal number within a table
Nächstes Thema: RE: Ordinal number within a table