RE: [PEAR] DataObjects: Rows inserted in triplicate

From: Date: Tue, 22 Feb 2005 21:23:15 +0000
Subject: RE: [PEAR] DataObjects: Rows inserted in triplicate
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17625@lists.php.net to get a copy of this message
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. 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: Headers: require_once 'PEAR.php'; $options = &PEAR::getStaticProperty('DB_DataObject', 'options'); $config = parse_ini_file('../DataObjects/data_objects.ini',TRUE); $options = $config['DB_DataObject']; require_once 'DB/DataObject.php'; require_once '../DataObjects/DO_test.php'; Config file [DB_DataObject] database = mysql://7thmoney:rocknroll@localhost/crave schema_location = /home/sasha/host/sasha/DataObjects class_location = /home/sasha/host/sasha/DataObjects require_prefix = DataObjects/ class_prefix = DO_ Here is the output of the script. I've edited out sensitive info: do_test: CONNECT: NEW CONNECTION do_test: CONNECT: // removed do_test: CONNECT: a:1:{s:32:"d88056b1cbdfa32a443243f7d84df57a";O:8:"db_mysql":25:{s:10:"co nnection";i:0;s:7:"phptype";s:5:"mysql";s:8:"dbsyntax";s:5:"mysql";s:14: "prepare_tokens";a:0:{}s:13:"prepare_types";a:0:{}s:8:"num_rows";a:0:{}s :19:"transaction_opcount";i:0;s:10:"autocommit";b:1;s:9:"fetchmode";i:1; s:3:"_db";s:5:"crave";s:6:"_debug";b:0;s:19:"_default_error_mode";N;s:22 :"_default_error_options";N;s:22:"_default_error_handler";s:0:"";s:12:"_ error_class";s:8:"DB_Error";s:16:"_expected_errors";a:0:{}s:8:"features" ;a:4:{s:7:"prepare";b:0;s:8:"pconnect";b:1;s:12:"transactions";b:1;s:5:" limit";s:5:"alter";}s:13:"errorcode_map";a:18:{i:1004;i:-15;i:1005;i:-15 ;i:1006;i:-15;i:1007;i:-5;i:1008;i:-17;i:1022;i:-5;i:1046;i:-14;i:1048;i :-3;i:1050;i:-5;i:1051;i:-18;i:1054;i:-19;i:1062;i:-5;i:1064;i:-2;i:1100 ;i:-21;i:1136;i:-22;i:1146;i:-18;i:1216;i:-3;i:1217;i:-3;}s:16:"prepared _queries";N;s:15:"prepare_maxstmt";i:0;s:10:"last_query";s:0:"";s:22:"fe tchmode_object_class";s:8:"stdClass";s:7:"options";a:7:{s:10:"persistent ";b:0;s:3:"ssl";b:0;s:5:"debug";i:0;s:14:"seqname_format";s:6:"%s_seq";s :8:"autofree";b:0;s:11:"portability";i:0;s:8:"optimize";s:11:"performanc e";}s:3:"dbh";N;s:3:"dsn";a:9:{s:7:"phptype";s:5:"mysql";s:8:"dbsyntax"; s:5:"mysql";s:8:"username";s:8:"REMOVED";s:8:"password";s:9:"REMOVED";s: 8:"protocol";s:3:"tcp";s:8:"hostspec";s:9:"localhost";s:4:"port";b:0;s:6 :"socket";b:0;s:8:"database";s:5:"REMOVED";}}} do_test: CONNECT: USING CACHED CONNECTION do_test: QUERY: INSERT INTO test (test_id , test_value ) VALUES ( 1 , 'bork this shit' ) do_test: query: QUERY DONE IN 0.00199890136719 seconds 1 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? -----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 (#17625) next »