For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > March 2005 > DB_DataObject Bug?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author DB_DataObject Bug?
Ian

2005-03-27, 3:56 pm

I'm currently running MySQL 4.0. When using DB_DataObject the sequences just
don't work! I've set them for each individual table within the
db_dataobject.ini and created the tables as per usual. However, no sequences
are generated? I would just use the normal auto_incriment but it is
necessary to use pear sequences for what I intend to accomplish.



Many thanks.






Alan

2005-03-28, 3:57 am

print_r($obj->sequenceKey()) - will tell you what dataobjects thinks the
table should do about sequences.

pear sequences are only generated when you actually run the first
insert.

regards
Alan

On Sun, 2005-03-27 at 19:50 +0100, Ian wrote:
> I'm currently running MySQL 4.0. When using DB_DataObject the sequences just
> don't work! I've set them for each individual table within the
> db_dataobject.ini and created the tables as per usual. However, no sequences
> are generated? I would just use the normal auto_incriment but it is
> necessary to use pear sequences for what I intend to accomplish.
>
>
>
> Many thanks.
>
>
>
>
>

Ian

2005-03-28, 8:56 am

I've found what I believe to be the issue. It is when I try to add multiple
databases to the ini file. For example this works fine.....

[DB_DataObject]
; PEAR::DB DSN
database = mysql://xxxx:xxxxx@localhost/db1
sequence_db_table1 = t1_id
schema_location = /prj/DataObject
class_location = /prj/DataObject
require_prefix = DataObjects/
class_prefix = DataObjects_
dont_die = false


I can use the above without any problems what so ever. If however I edit the
file like below adding my second and 3rd db, and then a couple of required
table sequences, run createTables again, the initial insert will work,
sequences are not generated meaning that all inserts after this point along
with updates just do not work. It's got to be to do with the syntax of this
ini file but I can't find an example anywhere (not even in the
documentation!).

[DB_DataObject]
; PEAR::DB DSN
database_db1 = mysql://xxxxx:xxxxx@localhost/db1
database_db2 = mysql://xxxxx:xxxxx@localhost/db2
database_db3 = mysql://xxxxx:xxxxx@localhost/db3

//These are two sequences that are required for two tables in db3
sequence_db3_table1 = table1_id
sequence_db3_table2 = table2_id

schema_location = /prj/DataObject
class_location = /prj/DataObject
require_prefix = DataObjects/
class_prefix = DataObjects_
dont_die = false


It doesn't seem to matter if I use the table_* syntax either to tie each of
these tables to one of the databases.

I would really really love some help with this, I've been sat for literally
days trying to get it going now and I know its just something to do with
this ini file.

HELP! :(




-----Original Message-----
From: Alan [mailto:alan@akbkhome.com]
Sent: 28 March 2005 04:48
To: Ian
Cc: pear-general@lists.php.net
Subject: Re: DB_DataObject Bug?

print_r($obj->sequenceKey()) - will tell you what dataobjects thinks the
table should do about sequences.

pear sequences are only generated when you actually run the first insert.

regards
Alan

On Sun, 2005-03-27 at 19:50 +0100, Ian wrote:
> I'm currently running MySQL 4.0. When using DB_DataObject the
> sequences just don't work! I've set them for each individual table
> within the db_dataobject.ini and created the tables as per usual.
> However, no sequences are generated? I would just use the normal
> auto_incriment but it is necessary to use pear sequences for what I intend

to accomplish.
>
>
>
> Many thanks.
>
>
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com