You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Terrence Brannon <me...@urth.org> on 2003/11/24 02:18:35 UTC

request for DBIx::Recordset patches

Tomorrow morning, I will begin applying my patches to the 
DBIx::Recordset SVN repository in preparation for a new CPAN release. I 
got svn compiled and running on my Cygwin box, so I am a happy man.

If you have any that you want applied, email them to me with subject header:

[PATCH] DBIx::Recordset

even if the patch is for DBIx::Compat.





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


Re: DBIx::Recordset - DataSource => $DSN fails in test.pl

Posted by Gerald Richter <ri...@ecos.de>.
Terrence Brannon wrote:
> *** I plan to fix this my using the created $dbh in DoTest()
> throughout test.pl instead of passing $DSN to each independent
> Search() call, but thought I would report this.

$DSN is intentionaly passed to every Search. This normaly causes to have not
only one database connection (which seems the problem for Pg). This is done
to get a fresh start for a new test and not any cached values from the
previous test.

> I am further down in
> the test suite,
> getting it to truly pass for DBD::Pg, and have run across this error:
>
> Select dbixrs2.name2 id=id...
> --------------------
> WARN: DBI connect('dbname=test','metaperl',...) failed: could not
> connect to server: Address already in use at
> blib/lib/DBIx/Recordset.pm line 203
>

This seems to be the same problem, that Pg allows not two connections at the
same time. There are places in the test which uses two connections, one for
updateing and one for verfying, otherwise you can't make sure that things
are really written to the database and not only held in memory be
DBIx::Recordset

Gerald


> DB:  ERROR open DB dbi:Pg:dbname=test (could not connect to server:
> Address already in use)
> DB:  New Recordset driver=  placeholders supported
> DB:  FLUSH Recordset id = 7  DBIx::Recordset=HASH(0x10547af8)
> DB:  Disconnect (id=7, numOpen = 1)
> DB:  DESTROY (id=7, numOpen = 1)
> CHK-IDS: 2
> ERROR in Select dbixrs2.name2 id=id
> Got too few rows (got 0, expected 1)
> Select dbixrs2.value2 id=id...
>
> *** Which  corresponds to this code:
>
>  printlogf "Select $Table[1].name2 id=id";
>         print LOG "\n--------------------\n" ;
>
>         *set1_ = DBIx::Recordset -> Search ({  '!DataSource'   =>
>                                             $DSN, '!Username'     =>
>                                             $User, '!Password'     =>
>                                             $Password, '!Table'
> => "$Table[0], $Table[1]",
>                                             '!Fields'       =>
> "$Table[0].id, $Table[0].name, $Table[0].value1, $Table[0].addon",
>                                            "'$Table[1].name2" =>
> 'Second Name in Tab2',
>                                            "\\$Table[0].id" =>
> "$Table[1].id",
>                                            '$operator'=>'='})  or die
> "not ok ($DBI::errstr)" ;
>
> *** also note: I just committed my changes to test.pl back to svn up
> to this point:
>
>         ~/hacks/dbirs $ svn commit --message 'incremental commit while
> fixing test suite for DBD::Pg'
> Sending        test.pl
> Transmitting file data .
> Committed revision 143.
>         ~/hacks/dbirs $
>
>
>
>
> ---------------------------------------------------------------------
> 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


DBIx::Recordset - DataSource => $DSN fails in test.pl

Posted by Terrence Brannon <me...@urth.org>.
*** I plan to fix this my using the created $dbh in DoTest() throughout 
test.pl instead of passing $DSN to each independent Search() call, but 
thought I would report this. I am further down in the test suite, 
getting it to truly pass for DBD::Pg, and have run across this error:

Select dbixrs2.name2 id=id...         
--------------------
WARN: DBI connect('dbname=test','metaperl',...) failed: could not 
connect to server: Address already in use at blib/lib/DBIx/Recordset.pm 
line 203

DB:  ERROR open DB dbi:Pg:dbname=test (could not connect to server: 
Address already in use)
DB:  New Recordset driver=  placeholders supported
DB:  FLUSH Recordset id = 7  DBIx::Recordset=HASH(0x10547af8)
DB:  Disconnect (id=7, numOpen = 1)
DB:  DESTROY (id=7, numOpen = 1)
CHK-IDS: 2
ERROR in Select dbixrs2.name2 id=id
Got too few rows (got 0, expected 1)
Select dbixrs2.value2 id=id...        

*** Which  corresponds to this code:

 printlogf "Select $Table[1].name2 id=id";
        print LOG "\n--------------------\n" ;

        *set1_ = DBIx::Recordset -> Search ({  '!DataSource'   =>  $DSN,
                                            '!Username'     =>  $User,
                                            '!Password'     =>  $Password,
                                            '!Table'        =>  
"$Table[0], $Table[1]",
                                            '!Fields'       =>  
"$Table[0].id, $Table[0].name, $Table[0].value1, $Table[0].addon",
                                           "'$Table[1].name2" => 'Second 
Name in Tab2',
                                           "\\$Table[0].id" => 
"$Table[1].id",
                                           '$operator'=>'='})  or die 
"not ok ($DBI::errstr)" ;

*** also note: I just committed my changes to test.pl back to svn up to 
this point:

        ~/hacks/dbirs $ svn commit --message 'incremental commit while 
fixing test suite for DBD::Pg'
Sending        test.pl
Transmitting file data .
Committed revision 143.
        ~/hacks/dbirs $




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


Re: DBIx::Recordset - nonsense query formation

Posted by Gerald Richter <ri...@ecos.de>.
>         $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


DBIx::Recordset - nonsense query formation

Posted by Terrence Brannon <me...@urth.org>.
Before applying any of the patches that have been emailed to the embperl 
list,
I thought I would first make sure that the test suite passed.

I could not use Angus Lees' "patches" for the test suite because most of 
them
simply skipped the test when $Driver eg 'Pg'.

This is a rather difficult thing to discuss, so I will simply state the 
facts
as I see them and ask questions when appropriate:

[ fact one ]: the recordset docs document what happens when a series of 
fields
is joined by a "|" and prefixed with a "+":

    '+name|text' => 'abc' will expand to name='abc' or text='abc'

[ fact two ]: the docs do _not_ state what happens when the value (e.g. 
"abc"
in the above) is not a simple scalar. However, test.pl and EXAMPLES 
section of
the docs have such a case:

        printlogf "Search \$compconj";
        print LOG "\n--------------------\n" ;

        $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

...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


Re: request for DBIx::Recordset patches

Posted by Kaare Rasmussen <ka...@kakidata.dk>.
> I have never done such extensive patching. I wonder if I could just
> patch the original on a different branch and then pray that I can merge
> them all?

Seems that several of the patches are for the same problem - full qualified 
names contra simple column names. I think you have to pick one.

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Email: kar@kakidata.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Web:      www.suse.dk


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


Re: request for DBIx::Recordset patches

Posted by Terrence Brannon <me...@urth.org>.
Actually, I used the excellent htDig email archives of this list

     http://www.ecos.de/~mailarc/embperl/

and came up with a ream of DBIx::Recordset patches to apply:

http://www.ecos.de/~mailarc/embperl/2002-06/msg00052.html
http://www.ecos.de/~mailarc/embperl/2003-10/msg00025.html
http://www.ecos.de/~mailarc/embperl/2002-02/msg00058.html
http://www.ecos.de/~mailarc/embperl/2002-02/msg00076.html
http://www.ecos.de/~mailarc/embperl/2002-02/msg00063.html
http://www.ecos.de/~mailarc/embperl/2003-05/msg00025.html
http://www.ecos.de/~mailarc/embperl/2003-10/msg00037.html
http://www.ecos.de/~mailarc/embperl/2001-12/msg00090.html
http://www.ecos.de/~mailarc/embperl/2003-10/msg00028.html
http://www.ecos.de/~mailarc/embperl/2001-12/msg00038.html
http://www.ecos.de/~mailarc/embperl/2002-09/msg00114.html
http://www.ecos.de/~mailarc/embperl/2002-01/msg00006.html

I have never done such extensive patching. I wonder if I could just 
patch the original on a different branch and then pray that I can merge 
them all?

I will probably end up doing the whole thing manually, but it's worth 
the ol' college try to get a merge to work.

Off to read the svn docs...

> Tomorrow morning, I will begin applying my patches to the 
> DBIx::Recordset SVN repository in preparation for a new CPAN release. 
> I got svn compiled and running on my Cygwin box, so I am a happy man.
>
> If you have any that you want applied, email them to me with subject 
> header:
>
> [PATCH] DBIx::Recordset
>
> even if the patch is for DBIx::Compat.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>



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