On Thu, 2 Jan 2003 21:13:27 -0800 (PST), Michael A Chase wrote:

Hi Michael

Just reply to the list, thanx.

>On Fri, 3 Jan 2003 15:36:11 +1100 Ron Savage <[EMAIL PROTECTED]>
>wrote:
>
>>In this, admittedly unusual, situation the above occurs:
>>OS: Win2K
>>Perl: V 5.8.0
>>DBI: V 1.32
>>ODBC: 1.01
>>DSN: Points to a Microsoft Access database
>>Table name: Nathan Bailey (note the single space)
>>
>>If I do:
>>select * from `Nathan Bailey`
>>it works. Yes, they are backticks.
>>If I do
>>select col_a, col_b from `Nathan Bailey`
>>I get:
>>Describe failed during DBI::st=HASH(0x1c9f0b8)->FETCH(ParamValues)
>
>I presume this is the error message in $DBI::errstr (aka $sth-
>>errstr).

Possibly. See code below.

>Adding $dbh->trace(4); before you prepare the statement may give you
>more details of what is happening.  The contents of

See output below.

$sth->{Statement}
>would also be interesting.

Wouldn't we all like to see this. If only ShowErrorStatement => 1
added the SQL to the error message in this context.

>It would help us understand your problem if you post a snippet of
the
>code that demonstrates the problem.

See output below.

>>This problem does not arise with other 'funny' table names, eg:
>>`Display_ISDT_210_&_Digital` (note the &).

-----><8-----
#!/usr/bin/perl

use strict;
use warnings;

use DBI;
use Error qw/:try/;

# -----------------------------------------------

try
{
        my($dbh) = DBI -> connect
        (
                'dbi:ODBC:mnt', '', '',
                {
                        AutoCommit                      => 1,
                        HandleError                     => sub {Error::Simple -> 
record($_[0]); 0},
                        PrintError                      => 0,
                        RaiseError                      => 1,
                        ShowErrorStatement      => 1,
                }
        );
        my($sql)        = 'select dpt_cde, cmt from `Nathan Bailey`';
        #$sql           = 'select * from `Nathan Bailey`';
        $dbh -> trace(4);
        my($sth)        = $dbh -> prepare($sql);
        print "SQL: $$sth{'Statement'}. \n";
        $sth -> execute();
        my($count) = 0;

        my($data, %h);
        while ($data = $sth -> fetch() )
        {
                $h{$$data[0]} = $$data[1] if (defined $$data[0]);
                $count++;

                next if ($count > 10);

                print "$_ => $h{$_}. \n";
        }
}
catch Error::Simple with
{
        my($error) = shift -> text();

        chomp($error);

        print $error;
};
-----><8-----
    DBI::db=HASH(0x1beb048) trace level set to 4 in DBI 1.32-ithread
    -> prepare for DBD::ODBC::db (DBI::db=HASH(0x1bfe3bc)~0x1beb048
'select dpt_cde, cmt from `Nathan Bailey`') thr#15d43cc

dbih_setup_handle(DBI::st=HASH(0x1bfe488)=>DBI::st=HASH(0x1bc3d0c),
DBD::ODBC::st, 1bfe494, Null!)
    dbih_make_com(DBI::db=HASH(0x1beb048), DBD::ODBC::st, 208)
thr#15d43cc
    SQLPrepare returned 0

    dbd_st_prepare'd sql f30808368, ExecDirect=0
        select dpt_cde, cmt from `Nathan Bailey`
    <- prepare= ( DBI::st=HASH(0x1bfe488) ) [1 items] at x.pl line 27
via c:/Perl/site/lib/Error.pm line 379
    <- FETCH= 'select dpt_cde, cmt from `Nathan Bailey`' ('Statement'
from cache) at x.pl line 29 via c:/Perl/site/lib/Error.pm line 379
    -> execute for DBD::ODBC::st (DBI::st=HASH(0x1bfe488)~0x1bc3d0c)
thr#15d43cc
    dbd_st_execute (outparams = 0)...
    dbd_st_execute (for hstmt 30808368 before)...
dbd_error: err_rc=-1 rc=0 s/d/e: 30808368/30806776/30806608
dbd_error: SQL-HY000 (native -3007): [Microsoft][ODBC Microsoft
Access Driver] The specified field 'dpt_cde' could refer to more than
one table listed in the FROM clause of your SQL statement.
(SQL-HY000)
dbd_error: err_rc=-1 rc=0 s/d/e: 0/30806776/30806608
dbd_error: err_rc=-1 rc=0 s/d/e: 0/0/30806608
st_execute/SQLExecute error -1 recorded: [Microsoft][ODBC Microsoft
Access Driver] The specified field 'dpt_cde' could refer to more than
one table listed in the FROM clause of your SQL statement.
(SQL-HY000)(DBD: st_execute/SQLExecute err=-1)
    !! ERROR: -1 '[Microsoft][ODBC Microsoft Access Driver] The
specified field 'dpt_cde' could refer to more than one table listed
in the FROM clause of your SQL statement. (SQL-HY000)(DBD:
st_execute/SQLExecute err=-1)'
    <- execute= undef at x.pl line 31 via c:/Perl/site/lib/Error.pm
line 379
1   -> FETCH for DBD::ODBC::st (DBI::st=HASH(0x1bc3d0c)~INNER
'ParamValues') thr#15d43cc
dbd_error: err_rc=-1 rc=0 s/d/e: 30808368/30806776/30806608
dbd_error: SQL-HY000 (native -3007): [Microsoft][ODBC Microsoft
Access Driver] The specified field 'dpt_cde' could refer to more than
one table listed in the FROM clause of your SQL statement.
(SQL-HY000)
dbd_error: err_rc=-1 rc=0 s/d/e: 0/30806776/30806608
dbd_error: err_rc=-1 rc=0 s/d/e: 0/0/30806608
dbd_describe/SQLNumResultCols error -1 recorded: [Microsoft][ODBC
Microsoft Access Driver] The specified field 'dpt_cde' could refer to
more than one table listed in the FROM clause of your SQL statement.
(SQL-HY000)(DBD: dbd_describe/SQLNumResultCols err=-1)
    -> DESTROY for DBD::ODBC::st (DBI::st=HASH(0x1bc3d0c)~INNER)
thr#15d43cc
    <- DESTROY= undef at Error.pm line 384
    -> DESTROY for DBD::ODBC::db (DBI::db=HASH(0x1beb048)~INNER)
thr#15d43cc
    <- DESTROY= undef at Error.pm line 384
SQL: select dpt_cde, cmt from `Nathan Bailey`.
Describe failed during DBI::st=HASH(0x1bc3d0c)->FETCH(ParamValues)
-----><8-----

--
Cheers
Ron Savage, [EMAIL PROTECTED] on 03/01/2003
http://savage.net.au/index.html


Reply via email to