Hi
Is it possible to get the names of the columns which a user has selected? I mean suppose a user writes a query as :
select ename,deptno,sal from emp;
then can we print the column name(ENAME,DEPTNO,SAL) ?
Thanks
Ashish
Easiest Money Transfer to India. Send Money To 6000 Indian Towns.
;
}
will print columnname: value for each field returned for a given row.
Mark
-Original Message-
From: ashish srivastava [mailto:[EMAIL PROTECTED]
Sent: Friday, January 30, 2004 1:48 PM
To: [EMAIL PROTECTED]
Subject: DBI Question
Hi
Is it possible to get the names of the columns which
On 30 Jan 2004, at 08:48 AM, ashish srivastava wrote:
Is it possible to get the names of the columns which a user has
selected? I mean suppose a user writes a query as :
select ename,deptno,sal from emp;
then can we print the column name(ENAME,DEPTNO,SAL) ?
Look at the DBI docs, under the
At 08:48 AM 1/30/2004, ashish srivastava wrote:
Hi
Is it possible to get the names of the columns which a user has selected?
I mean suppose a user writes a query as :
select ename,deptno,sal from emp;
then can we print the column name(ENAME,DEPTNO,SAL) ?
Here's some example code (tested) to
:34 AM
Subject: RE: DBI Question
Hi Ashish,
If you get the results using a hash reference rather than just an array of
values then you can:
(not tested...)
my $row = $stmt-fetchrow_hashref(); # returns a reference to a hash
indexed
by column name
foreach my $column (keys %{$row
Richard Morse wrote:
On 30 Jan 2004, at 08:48 AM, ashish srivastava wrote:
Is it possible to get the names of the columns which a user has
selected? I mean suppose a user writes a query as :
select ename,deptno,sal from emp;
then can we print the column name(ENAME,DEPTNO,SAL) ?
Look at the
,
--
Iain Whyte
infrastructure and systems manager
Fortis Clearing Sydney Pty Ltd
Ph: +61 2 92336497
Fx: +61 2 92364440
Mb: 0419793593
Em: [EMAIL PROTECTED]
-Original Message-
From: steve silvers [mailto:[EMAIL PROTECTED]
Sent: Thursday, 24 July 2003 1:49 AM
To: [EMAIL PROTECTED]
Subject: DBI
On 23 Jul 03, steve silvers ([EMAIL PROTECTED]) wrote:
But if you use a statement as a count.
SELECT COUNT(*) FROM TABLE WHERE bla..
How do you get the count number. Do you still have to go through a loop and
count all occurences of the searched criteria? If so then you can't use a
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Stephen Patterson
Sent: Wednesday, July 23, 2003 11:10 AM
To: [EMAIL PROTECTED]
Subject: Re: DBI Question
snip
as you'll only be getting a single element, you should be able to use
$count = $sth
Try this:
print qq(SELECT NAME="column" SIZE="5");
while(defined ($column) = $sth-fetchrow_array){
or
print qq(OPTION VALUE="$column"$column/OPTION\n) if (defined $column);
---
Charles E. Pelkey [EMAIL PROTECTED]
C.P. Designs
10 matches
Mail list logo