cvs: pear /DB_DataObject DataObject.php /DB_DataObject/DataObject Generator.php createTables.php /DB_DataObject/tests simple.phpt test.ini

From: Date: Thu, 01 Jan 2004 02:46:45 +0000
Subject: cvs: pear /DB_DataObject DataObject.php /DB_DataObject/DataObject Generator.php createTables.php /DB_DataObject/tests simple.phpt test.ini
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-15247@lists.php.net to get a copy of this message
alan_k Wed Dec 31 21:46:45 2003 EDT Modified files: /pear/DB_DataObject DataObject.php /pear/DB_DataObject/DataObject Generator.php createTables.php /pear/DB_DataObject/tests simple.phpt test.ini Log: fix bug #507 Index: pear/DB_DataObject/DataObject.php diff -u pear/DB_DataObject/DataObject.php:1.171 pear/DB_DataObject/DataObject.php:1.172 --- pear/DB_DataObject/DataObject.php:1.171 Tue Dec 23 06:39:30 2003 +++ pear/DB_DataObject/DataObject.php Wed Dec 31 21:46:43 2003 @@ -20,7 +20,7 @@ * @package DB_DataObject * @category DB * - * $Id: DataObject.php,v 1.171 2003/12/23 11:39:30 alan_k Exp $ + * $Id: DataObject.php,v 1.172 2004/01/01 02:46:43 alan_k Exp $ */ /* ===================================================================================== @@ -56,7 +56,7 @@ /* * Define this before you include DataObjects.php to disable overload - if it segfaults due to Zend optimizer.. */ -//define('DB_DATAOBJECT_NO_OVERLOAD') +//define('DB_DATAOBJECT_NO_OVERLOAD',true) /** @@ -818,7 +818,7 @@ foreach($items as $k => $v) { // if we are using autoincrement - skip the column... - if ($key && ($k == $key)) { + if ($key && ($k == $key) && $useNative) { continue; } Index: pear/DB_DataObject/DataObject/Generator.php diff -u pear/DB_DataObject/DataObject/Generator.php:1.39 pear/DB_DataObject/DataObject/Generator.php:1.40 --- pear/DB_DataObject/DataObject/Generator.php:1.39 Tue Dec 16 04:28:45 2003 +++ pear/DB_DataObject/DataObject/Generator.php Wed Dec 31 21:46:44 2003 @@ -14,7 +14,7 @@ // +----------------------------------------------------------------------+ // | Author: Alan Knowles <alan@akbkhome.com> // +----------------------------------------------------------------------+ -// $Id: Generator.php,v 1.39 2003/12/16 09:28:45 alan_k Exp $ +// $Id: Generator.php,v 1.40 2004/01/01 02:46:44 alan_k Exp $ /** * Generation tools for DB_DataObject @@ -224,7 +224,7 @@ $keys_out = "\n[{$this->table}__keys]\n"; $keys_out_primary = ''; $keys_out_secondary = ''; - if (@$_DB_DATAOBJECT['CONFIG']['debug']) { + if (@$_DB_DATAOBJECT['CONFIG']['debug'] > 2) { echo "TABLE STRUCTURE FOR {$this->table}\n"; print_r($defs); } Index: pear/DB_DataObject/DataObject/createTables.php diff -u pear/DB_DataObject/DataObject/createTables.php:1.17 pear/DB_DataObject/DataObject/createTables.php:1.18 --- pear/DB_DataObject/DataObject/createTables.php:1.17 Mon Nov 17 01:11:23 2003 +++ pear/DB_DataObject/DataObject/createTables.php Wed Dec 31 21:46:44 2003 @@ -16,7 +16,7 @@ // | Author: Alan Knowles <alan@akbkhome.com> // +----------------------------------------------------------------------+ // -// $Id: createTables.php,v 1.17 2003/11/17 06:11:23 alan_k Exp $ +// $Id: createTables.php,v 1.18 2004/01/01 02:46:44 alan_k Exp $ // require_once 'DB/DataObject/Generator.php'; @@ -40,7 +40,7 @@ PEAR::raiseError("\nERROR: could not read ini file\n\n", null, PEAR_ERROR_DIE); exit; } -DB_DataObject::debugLevel(5); +DB_DataObject::debugLevel(1); $generator = new DB_DataObject_Generator; $generator->start(); \ No newline at end of file Index: pear/DB_DataObject/tests/simple.phpt diff -u pear/DB_DataObject/tests/simple.phpt:1.5 pear/DB_DataObject/tests/simple.phpt:1.6 --- pear/DB_DataObject/tests/simple.phpt:1.5 Sat Dec 13 00:28:40 2003 +++ pear/DB_DataObject/tests/simple.phpt Wed Dec 31 21:46:45 2003 @@ -1,10 +1,15 @@ --TEST-- DB::DataObject test --SKIPIF-- -<?php if (!@include(dirname(__FILE__)."/../DataObject.php")) print "skip"; ?> +<?php +//define('DB_DATAOBJECT_NO_OVERLOAD',true); + +if (!@include(dirname(__FILE__)."/../DataObject.php")) print "skip"; ?> --FILE-- <?php // -*- C++ -*- + + // Test for: DB::parseDSN() include_once dirname(__FILE__)."/../DataObject.php"; include_once 'PEAR.php'; @@ -16,6 +21,10 @@ DB_DataObject::debugLevel(3); // create a record + + + + class test extends DB_DataObject { var $__table = 'test'; @@ -26,6 +35,7 @@ function createDB() { $this->query('DROP TABLE IF EXISTS test'); + $this->query('DROP TABLE IF EXISTS test2'); $this->query( @@ -37,6 +47,18 @@ firstname varchar(255) NOT NULL default '', lastname varchar(255) NOT NULL default '' )"); + + // table 2 = manual sequences. + $this->query( + "CREATE TABLE test2 ( + id int(11) NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL default '', + username varchar(32) NOT NULL default '', + password varchar(13) binary NOT NULL default '', + firstname varchar(255) NOT NULL default '', + lastname varchar(255) NOT NULL default '' + )"); + } function test1() { @@ -107,11 +129,26 @@ echo "\n\n\n******changing database stuff.\n"; $t = new test; - $x = & $t->getDatabaseConnection(); + $t->query('BEGIN'); + $t->username = 'xxx'; + $t->insert(); + $t->query('COMMIT'); + + echo "\n\n\n******sequences.\n"; + + $t = new test2; + + $t->username = 'yyyy'; + $id = $t->insert(); + echo "\nRET: $id\n"; + - $x->autocommit = 0; - $y = & $t->getDatabaseConnection(); - print_r($y); + $t->dumpTest('test2'); + + + + + } @@ -123,8 +160,8 @@ echo "INSERT got $r\n"; } - function dumpTest() { - $t = new test; + function dumpTest($table = 'test') { + $t = new $table; $t->find(); if (!$t->N) { echo "NO RESULTS!\n"; @@ -149,6 +186,14 @@ } +class test2 extends test { + var $__table = 'test2'; + function sequenceKey() { + return array('id',false); + } +} + + $t = new test; $t->doTests(); Index: pear/DB_DataObject/tests/test.ini diff -u pear/DB_DataObject/tests/test.ini:1.1 pear/DB_DataObject/tests/test.ini:1.2 --- pear/DB_DataObject/tests/test.ini:1.1 Wed Dec 11 22:49:11 2002 +++ pear/DB_DataObject/tests/test.ini Wed Dec 31 21:46:45 2003 @@ -9,3 +9,15 @@ [test__keys] id =1 + + +[test2] +id = 1 +name = 2 +username = 2 +password = 2 +firstname = 2 +lastname = 2 + +[test2__keys] +id =1

« previous php.pear.cvs (#15247) next »