Re: DataObjects: Rows inserted in triplicate

From: Date: Tue, 22 Feb 2005 22:13:38 +0000
Subject: Re: DataObjects: Rows inserted in triplicate
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17628@lists.php.net to get a copy of this message
On Tue, 22 Feb 2005 14:07:22 -0800, Sasha Sklar <Sasha.Sklar@craveonline.com> wrote: > OK, couple of things. I noticed an error in my manually created class. I > had copy/pasted the code for the staticGet function, and forgotten to > change the name of the table. > > I ran the generator, and it worked fine. I tested the generated class, > and it is doing the same thing, but it doesn't seem to be creating the > seq table anymore. The seq table thing was a problem in your database.ini file, then. You probably didn't set up the key value correctly when you created those manually. Actually, your problem could well have been that you didn't even have an ini file. ;-) Actually, this ini file is pretty hard to manually generate, I'm surprised you got your code working at all. As for the multiple insert, try adding a mail() call to your code just before the insert() call. Perhaps your script is being called multiple times? Or it's in a loop or something? There really is no way that a single insert can create multiple records unless your backend DB is really screwed up. > > -----Original Message----- > From: Justin Patrin [mailto:papercrane@gmail.com] > Sent: Tuesday, February 22, 2005 1:41 PM > To: Sasha Sklar > Cc: pear-general@lists.php.net > Subject: Re: [PEAR] DataObjects: Rows inserted in triplicate > > On Tue, 22 Feb 2005 13:23:15 -0800, Sasha Sklar > <Sasha.Sklar@craveonline.com> wrote: > > Justin, > > > > Thanks for the info on running the generator. I'm going to give it a > > try, although there is some resistance in my team to using the > generated > > classes. Not logical, I know, but that's work politics. > > The auto-gen classes are just as good as normal manual classes except > they're automatic. :-) It only touches the auto-gen code, so as long > as you put custom functions and such outside of the markers you're > fine. > > > > > We're using PHP 4.3.9. That is the entirety of the script, aside from > > some html for formatting and the configuration code at the top. I'll > > list that and my config file: > > > <snip> > > I've noticed a weird table in the database which I did not create. It > is > > called test_seq. It contains a single row with a single field called > id. > > The id value is equal to the last id in test. If I remove the table > and > > run my script, it is regenerated. > > > > Any ideas? > > Ah....this is DB creating a sequence table because DB_DataObject > thinks that this is a DB generated sequence. What DB backend are you > using? Mysql? Is your ID set up as a auto incremented value? Do you > have it set up as your primary key? > > > > > -----Original Message----- > > From: Justin Patrin [mailto:papercrane@gmail.com] > > Sent: Tuesday, February 22, 2005 1:08 PM > > To: Sasha Sklar > > Cc: pear-general@lists.php.net > > Subject: Re: [PEAR] DataObjects: Rows inserted in triplicate > > > > On Tue, 22 Feb 2005 12:33:52 -0800, Sasha Sklar > > <Sasha.Sklar@craveonline.com> wrote: > > > This is the issue: every insert I perform is generating 3 rows > instead > > > of 1. > > > > > > I'm using DataObjects with manually created classes, I can't use the > > > generator do to permission issues. > > > > > > > What permissions issues? If you can't run it via CLI for some reason > > you can always run the generator from the web. Just set the > > permissions on the class dir (and files) to 777. Here's a simple > > script I use to update some of my DOs from the web: > > > > <?php > > $_SERVER['argv'][1] = '/path/to/DataObject.ini'; > > include('/path/to/PEAR/DB/DataObject/createTables.php'); > > system('chmod 777 /path/to/DataObjects/*'); > > ?> > > > > If you need more help, what's the output of the script you gave? Is > > that the entirety of the script or is there more? What version of PHP > > are you using? > > > -- Justin Patrin

« previous php.pear.general (#17628) next »