Hi Bill,
"Bill Moseley" <[EMAIL PROTECTED]> wrote:
How do I get the column names as a list to match the order of the
rows returned when using select/fetchall_arrayref [...] I'm not
having luck finding it in the docs.
See the "Statement Handle Attributes" section of the DBI docs:
http://search.
On 5/3/06, Bill Moseley <[EMAIL PROTECTED]> wrote:
How do I get the column names as a list to match the order of the
rows returned when using select/fetchall_arrayref and using an ARRAY
slice? I'm not having luck finding it in the docs.
I don't know the column names ahead of time -- I'm passed
Alexander Foken wrote:
You could slowly migrate your system, a first step would be to make sure
all table and column names match /^[A-Za-z][A-Za-z0-9_]+$/. Next, move
the tables and the business logic to a "real" database. Then finally,
get rid of ODBC drivers and Access on the clients and swi
On Wed, 1 Feb 2006 15:46:31 -0800, Darren Duncan wrote:
Hi Darren
> It would be quite natural for such users to make identifiers like
> 'Person' and 'Home Address' and 'Home Telephone' and 'Work
> Telephone' and so on; it isn't natural for them to say
> 'Home_Telephone' and such.
I agree. My d
At 9:30 AM +1100 2/2/06, Ron Savage wrote:
On Wed, 01 Feb 2006 13:36:41 +0100, Alexander Foken wrote:
Right. But using a restrictive set of characters for table and
column names makes things easier. "The column for the number of
Just as I raved about back in 2003 :-):
Now, I understand th
On Wed, 01 Feb 2006 13:36:41 +0100, Alexander Foken wrote:
Hi Alexander
> Right. But using a restrictive set of characters for table and
> column names makes things easier. "The column for the number of
Just as I raved about back in 2003 :-):
http://savage.net.au/Ron/html/naming-database-object
On Wed, Feb 01, 2006 at 02:08:32AM +0100, [EMAIL PROTECTED] wrote:
> use backticks instead of double quotes:
>
> my $sth=$dbh->prepare('select * from taskhours_per_date where `employee
> name`=?');
That's not portable.
The DBI has a $dbh->quote_identifier method to abstract this and
do-the-righ
Darren Duncan wrote:
At 9:44 AM +0100 2/1/06, Alexander Foken wrote:
You could slowly migrate your system, a first step would be to make
sure all table and column names match /^[A-Za-z][A-Za-z0-9_]+$/.
Next, move the tables and the business logic to a "real" database.
Then finally, get rid o
At 9:44 AM +0100 2/1/06, Alexander Foken wrote:
You could slowly migrate your system, a first step would be to make
sure all table and column names match /^[A-Za-z][A-Za-z0-9_]+$/.
Next, move the tables and the business logic to a "real" database.
Then finally, get rid of ODBC drivers and Acces
Robert Hicks wrote:
Alexander Foken wrote:
You need to pass the quotes to the SQL engine. And by the way, you
should either use parameters or the quote function for values:
my $sth=$dbh->prepare('select * from taskhours_per_date where
"employee name"=?');
$sth->execute('NAME HERE');
Maybe
use backticks instead of double quotes:
my $sth=$dbh->prepare('select * from taskhours_per_date where `employee
name`=?');
Regards,
Renee
Am 31.01.2006 um 23:58 Uhr haben Sie geschrieben:
> Alexander Foken wrote:
> > You need to pass the quotes to the SQL engine. And by the way, you
> > should
Alexander Foken wrote:
You need to pass the quotes to the SQL engine. And by the way, you
should either use parameters or the quote function for values:
my $sth=$dbh->prepare('select * from taskhours_per_date where "employee
name"=?');
$sth->execute('NAME HERE');
Maybe MS Acesss has other wa
Ugg!!
first coice is to rebuild the table
second choice
I found that wrapping the offending field name in [ ] worked with ODBC and
OLE but I am not sure how this will workd with DBI?
something like this
SELECT * FROM taskhours_per_date WHERE [EMPLOYEE NAME] = 'NAME HERE'
might work
option
You need to pass the quotes to the SQL engine. And by the way, you
should either use parameters or the quote function for values:
my $sth=$dbh->prepare('select * from taskhours_per_date where "employee
name"=?');
$sth->execute('NAME HERE');
Maybe MS Acesss has other ways to do this, especiall
I believe you want square-brackets for Access:
my $sth = $dbh->prepare("SELECT * FROM taskhours_per_date WHERE [EMPLOYEE NAME]
= ?");
Paul
Quoting Robert Hicks <[EMAIL PROTECTED]>:
> I am using the ODBC module to talk to an Access database. In that
> database some of the column names have spa
On Mon, 4 Nov 2002 19:08:27 +0100 Georg Botorog <[EMAIL PROTECTED]> wrote:
> Is there a way to get the column names for a cursor call instead of
> ":B1", ":B2", etc?
Those names are usually associated with bind variables, not columns.
Some example code might make it easier for someone here to fig
On Fri, 11 Jan 2002 09:07:15 -0500, Terrence Brannon wrote:
>> You can do (very portable):
>>
>> my $sth = $dbh->prepare("SELECT * FROM $table");
>
>its a shame that it is not just as portable to limit the result
>set to 1 row...
How about 0 rows?
my $sth = $dbh->prepare("SELECT *
Bart Lateur writes:
> [beginners list snipped]
>
> On Fri, 11 Jan 2002 11:40:03 +0100, Marius Keraitis wrote:
>
> >Second step is to show every table contents (by clicking on link with table
> >name).
> >To do this I need to know how many columns is in table, and all names of columns
> >
On 11 Jan 2002, at 9:07, Terrence Brannon wrote:
>
> On Friday, January 11, 2002, at 07:09 AM, Bart Lateur wrote:
>
> > [beginners list snipped]
> >
> > On Fri, 11 Jan 2002 11:40:03 +0100, Marius Keraitis wrote:
> >
> >> Second step is to show every table contents (by clicking on link
> >> with
On Friday, January 11, 2002, at 07:09 AM, Bart Lateur wrote:
> [beginners list snipped]
>
> On Fri, 11 Jan 2002 11:40:03 +0100, Marius Keraitis wrote:
>
>> Second step is to show every table contents (by clicking on link
>> with table
>> name).
>> To do this I need to know how many columns is i
[beginners list snipped]
On Fri, 11 Jan 2002 11:40:03 +0100, Marius Keraitis wrote:
>Second step is to show every table contents (by clicking on link with table
>name).
>To do this I need to know how many columns is in table, and all names of columns
>in table.
You can do (very portable):
Not a real Perl/Oracle hacker, but try if the select clause below produces
the data you need:
===
select
OWNER,
TABLE_NAME,
COLUMN_ID,
COLUMN_NAME,
DATA_TYPE,
DATA_LENGTH,
NULLABLE
from
all_tab_colu
the use in execute or print or whatever else might be useful. I
find it very slick when I need column names.
Steve H.
-Original Message-
From: Scott R. Godin [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 02, 2001 6:28 AM
To: [EMAIL PROTECTED]
Subject: Re: Column Names
In article <
On Fri, Nov 02, 2001 at 02:41:05PM -0500, Scott R. Godin wrote:
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] (Tim Bunce) wrote:
>
> > On Fri, Nov 02, 2001 at 02:18:15PM +0100, Bart Lateur wrote:
> > > On Fri, 02 Nov 2001 07:27:49 -0500, Scott R. Godin wrote:
> > >
> > > >my %db;
>
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Michael Peppler) wrote:
> > my $rows = $sth->rows;
> > # only expecting one row for a unique ID . this should NEVER happen.
> >safe_error("invalid number of rows returned from database ($rows) for
> > ID $id")
> > if $rows
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Tim Bunce) wrote:
> On Fri, Nov 02, 2001 at 02:18:15PM +0100, Bart Lateur wrote:
> > On Fri, 02 Nov 2001 07:27:49 -0500, Scott R. Godin wrote:
> >
> > >my %db;
> > >$sth->bind_columns( \( @db{ @{ $sth->{NAME} } } ));# magic
> > >
> > >
On Fri, Nov 02, 2001 at 02:18:15PM +0100, Bart Lateur wrote:
> On Fri, 02 Nov 2001 07:27:49 -0500, Scott R. Godin wrote:
>
> >my %db;
> >$sth->bind_columns( \( @db{ @{ $sth->{NAME} } } ));# magic
> >
> >while ($sth->fetch)
> >{
> >#... and no worries about which order the
Scott R. Godin writes:
> the absolute neatest trick I've seen with this, that is so totally
> perlish it defies description.. you stare at it for a bit and suddenly
> all becomes clear.
>
>$sth->execute
> or die("Cannot Execute SQL Statement: ", $sth->errstr(), "\n");
>
On Fri, 02 Nov 2001 07:27:49 -0500, Scott R. Godin wrote:
>my %db;
>$sth->bind_columns( \( @db{ @{ $sth->{NAME} } } ));# magic
>
>while ($sth->fetch)
>{
>#... and no worries about which order the columns get returned in
>#... since you access them via the $db{Colum
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Bart Lateur) wrote:
> On Thu, 01 Nov 2001 18:56:18 -0800, Venkataramana Mokkapati wrote:
>
> >How do I get column names and order of column names
> >for a "select * from ..." query.
>
> If you have
>
> $sth = $dbh->prepare("select * fro
On Thu, 01 Nov 2001 18:56:18 -0800, Venkataramana Mokkapati wrote:
>How do I get column names and order of column names
>for a "select * from ..." query.
If you have
$sth = $dbh->prepare("select * from ...");
then try
@column_names = @{$sth->{NAME}};
You may have to do an "ex
$sth->{NAME} returns a reference to an array of field names for each
column
e.g.
foreach my $column (@{ $sth->{NAME} }) {
print $column;
}
--
Simon Oliver
32 matches
Mail list logo