perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject Re: DBIx::Recordset - nonsense query formation
Date Tue, 25 Nov 2003 22:03:00 GMT
>         $set6 -> Search ({"+$t0\lid|$t0\laddon"     =>  "6\tit",
>                           "$t0\lname"          =>  'Fourth Name',
>                           "\*$t0\lid"           =>  '>',
>                           "\*$t0\laddon"        =>  '<>',
>                           "\*$t0\lname"         =>  '=',
>                           '$compconj'     =>  'and',
>                           '$conj'         =>  'or' }) or die "not ok
> ($DBI::errstr)" ;
>
>
> The SELECT query generated by this:
>
>       DB:  'SELECT id, name, txt FROM dbixrs1, dbixrs3 WHERE
> (dbixrs1.value1=dbixrs3.value1) and (  (  (  id > ? and addon <> ?)
> or (  id > ? and addon <> ?)) or (  (name = ?)))      '
> bind_values=<6 6 it
> it Fourth Name> bind_types=<4 1 4 1 1>
>
> does not make sense because the SQL attempts to do this comparison:
>
>     id > it
>

Yes, it does not make to much sense, but this is a test for the construction
of the where expression, not a database test. For example in mysql this test
works without problems. Pg is somehow more strict, so some of the test
aren't performed for Pg.

The SQL is construced ok, that's all what the test should do

Gerald




> ...that's right, it attempts to compare a numerical field to the
> string "it" which rightly yields an error under Postgres.
>
> I'm going to go ahead and fix this, but thought I would report this as
> something I perceive as needing to be fixed.
>
> Here is test.log for this particular Search():
>
> Search $compconj...
> --------------------
> DB:  SelectWhere <*addon>=<<>> type = *
> DB:  SelectWhere <*id>=<>> type = *
> DB:  SelectWhere <+id|addon>=<6    it> type = +
> DB:  Composite Field +id|addon
> DB:  Composite Field processing id
> DB:  Composite Field get   id > ?
> DB:  Composite Field processing addon
> DB:  Composite Field get   id > ? and addon <> ?
> DB:  Key +id|addon gives   (  id > ? and addon <> ?)  or  (  id > ?
> and addon <> ?) bind_values = <6 6 it it> bind_types=<4 1 4 1>
> DB:  expr is   (  (  id > ? and addon <> ?)  or  (  id > ? and addon
> <> ?)) DB:  SelectWhere <$conj>=<or> type = $
> DB:  SelectWhere <*name>=<=> type = *
> DB:  SelectWhere <name>=<Fourth Name> type = n
> DB:  Single Field name
> DB:  Single Field gives name = ?
> DB:  Key name gives   (name = ?) bind_values = <6 6 it it Fourth Name>
> bind_types=<4 1 4 1 1>
> DB:  expr is   (  (  id > ? and addon <> ?)  or  (  id > ? and addon
> <> ?)) or (  (name = ?))
> DB:  SelectWhere <$compconj>=<and> type = $
> DB:  FLUSH Recordset id = 12  DBIx::Recordset=HASH(0x1054af98)
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  'SELECT id, name, txt FROM dbixrs1, dbixrs3 WHERE
> (dbixrs1.value1=dbixrs3.value1) and (  (  (  id > ? and addon <> ?)
> or (  id > ? and addon <> ?)) or (  (name = ?)))      '
> bind_values=<6 6 it
> it Fourth Name> bind_types=<4 1 4 1 1>
> WARN: DBD::Pg::st execute failed: ERROR:  pg_atoi: error in "it":
> can't parse "it" at blib/lib/DBIx/Recordset.pm line 1366.
>
> DB:  ERROR ERROR:  pg_atoi: error in "it": can't parse "it"
> not ok (ERROR:  pg_atoi: error in "it": can't parse "it") at test.pl
> line 1453.
> DB:  Row::DESTROY
> DB:  Row::DESTROY
> DB:  FLUSH Recordset id = 12  DBIx::Recordset=HASH(0x1054af98)
> DB:  Disconnect (id=12, numOpen = 1)
> DB:  DESTROY (id=12, numOpen = 1)
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org

--------------------------------------------------------------
Gerald Richter     ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
--------------------------------------------------------------
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message