FAQ
hi

i've tryed to count on a table. if i insert a where clause it will crash
with the following error. someone able to help me about this?
Perl 5.6.1, Win2K, DBI 1.27, DBD-ODBC 1.01 is installed.

SELECT COUNT(TEST) FROM Table WHERE (TEST=?)

DBD::ODBC::st execute failed: [TCX][MyODBC]You have an error in your SQL
syntax near 'WHERE (TEST='test2')' at line 1 (SQL-42000)
[TCX][MyODBC]Unsupported option: 1750 to SQLGetInfo (SQL-S1C00)(DBD:
st_execute/SQLExecute err=-1)


Alex

Search Discussions

  • Alex at Dec 20, 2002 at 12:46 am
    additional to this - with MyODBC 3.51 and a newer MySQL 3.23.54 it will not
    work, too.

    DBD::ODBC::st execute failed: [MySQL][ODBC 3.51 Driver]
    [mysqld-3.23.54-nt]You have an error in your SQL syntax near
    'WHERE (TEST='test2')' at line 1 (SQL-42000)(DBD: st_execute/SQLExecute
    err=-1)
    at C:\Inetpub\test\test.cgi line 39.


    my $sth = $dbh->prepare("SELECT COUNT(TEST) FROM $dbtable WHERE (TEST=?)");
    my $rv = $sth->execute($var1); # this is line 39

    This select will fully work for e.g. with MySQL-Front 2.5 without any
    problems...


    Alex
  • Jeff Urlwin at Dec 20, 2002 at 12:58 pm

    additional to this - with MyODBC 3.51 and a newer MySQL
    3.23.54 it will not work, too.

    DBD::ODBC::st execute failed: [MySQL][ODBC 3.51 Driver]
    [mysqld-3.23.54-nt]You have an error in your SQL syntax near
    'WHERE (TEST='test2')' at line 1 (SQL-42000)(DBD:
    st_execute/SQLExecute
    err=-1)
    at C:\Inetpub\test\test.cgi line 39.


    my $sth = $dbh->prepare("SELECT COUNT(TEST) FROM $dbtable
    WHERE (TEST=?)"); my $rv = $sth->execute($var1); # this is line 39

    This select will fully work for e.g. with MySQL-Front 2.5
    without any problems...
    It's most likely the MyODBC portion of the system, rather the MySQL. I
    haven't tested w/MySQL yet, but it's on my list of DBs to try sometime
    in the future.

    Jeff
  • Alex at Jan 18, 2003 at 7:01 pm
    sorry Jeff... i found today this is my fault. i have done a type missmatch
    on the dbtable var... after correcting this it works now and gives correct
    results... i havent't tested with MyODBC 2.5... only with beta 3.51


    Alex
  • Jacqui Caren at Dec 23, 2002 at 10:35 am

    On Fri, 20 Dec 2002 07:57:50 -0500, Jeff Urlwin wrote:


    additional to this - with MyODBC 3.51 and a newer MySQL
    3.23.54 it will not work, too.

    DBD::ODBC::st execute failed: [MySQL][ODBC 3.51 Driver]
    [mysqld-3.23.54-nt]You have an error in your SQL syntax near
    'WHERE (TEST='test2')' at line 1 (SQL-42000)(DBD:
    st_execute/SQLExecute
    err=-1)
    at C:\Inetpub\test\test.cgi line 39.


    my $sth = $dbh->prepare("SELECT COUNT(TEST) FROM $dbtable
    WHERE (TEST=?)"); my $rv = $sth->execute($var1); # this is line 39

    This select will fully work for e.g. with MySQL-Front 2.5
    without any problems...
    It's most likely the MyODBC portion of the system, rather the MySQL. I
    haven't tested w/MySQL yet, but it's on my list of DBs to try sometime
    in the future.

    The obvious sanity test is that the $dbtable var is unset for some reason.
    Perhaps a check of $dbtable value prior to the prepare would suffice?

    Jacqui

    Jacqui Caren, Ingram Group Ltd. jacqui@ig.co.uk
    ph: +44 (0) 1483 8628xx main=00 fax=01 ddi=65
    http://www.ig.co.uk/ http://www.sitedirector.org/
    http://www.perl.co.uk/
  • Alex at Dec 25, 2002 at 2:15 pm

    The obvious sanity test is that the $dbtable var is unset for some reason.
    Perhaps a check of $dbtable value prior to the prepare would suffice?
    no - the var is set... this isn't the fault.

    try to set:
    my $dbtable='test_db';


    Alex

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedDec 20, '02 at 12:25a
activeJan 18, '03 at 7:01p
posts6
users3
websitedbi.perl.org

3 users in discussion

Alex: 4 posts Jeff Urlwin: 1 post Jacqui Caren: 1 post

People

Translate

site design / logo © 2022 Grokbase