RE: POSTGRESQL and PERL?

From: "Wallingford, Ted" <twallingford(at)indexc(dot)com>
To: "'Peter Landis'" <ntwebdeveloper(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Cc: pgsql-sql(at)postgresql(dot)org
Subject: RE: POSTGRESQL and PERL?
Date: 2000-05-26 16:14:16
Message-ID: 70866BD37E22D4119D8000600899F70D011CB8@INDEXAPP00
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Peter my guess is you can just substitute the variable name in for the
actual sortfield name..

select * from company order by $field;

That's why variables BEGIN with denotation characters in Perl rather than
ending with them (like in basic)..

Anyway, let me know if that works... and which module are you using to hit
PostgreSQL????

thax,
Ted

_________________________________________________
Ted Wallingford
Manager of Information Technology
Independence Excavating, Inc.
Precision Environmental Co.
Independence Communications, Inc.
www.indexc.com

> -----Original Message-----
> From: Peter Landis [mailto:ntwebdeveloper(at)yahoo(dot)com]
> Sent: Friday, May 26, 2000 11:58 AM
> To: pgsql-sql(at)postgresql(dot)org
> Cc: pgsql-sql(at)postgresql(dot)org
> Subject: [SQL] POSTGRESQL and PERL?
>
>
>
> Hi-
> I'm a newbie at postgresql and was working on
> sorting by category. What my question is, how do you
> sort by category when using a variable. For instance,
> you can sort by name in perl by doing:
>
> $sqh = $dbh->prepare(q{select name from company order
> by name;});
> $sqh->execute();
>
> but what if you have a variable set like:
> $sort_selection = "name";
>
> How do you sort by the variable?
>
> For instance you cannot do:
> $sqh = $dbh->prepare(q{select name from company order
> by ?;});
> $sqh->execute($sort_selection);
>
> OR
>
> $sqh = $dbh->prepare(q{select name from company order
> by $sort_selection;});
> $sqh->execute();
>
> If anyone could help, I would greatly appreciate it.
>
> Thanks again!
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Kick off your party with Yahoo! Invites.
> http://invites.yahoo.com/
>

Attachment Content-Type Size
Wallingford, Ted.vcf application/octet-stream 137 bytes

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-05-26 16:19:52 Re: PG/DBI: 'NOTICE: UserAbortTransactionBlock and not in in-progress state'
Previous Message Peter Landis 2000-05-26 15:58:18 POSTGRESQL and PERL?