|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-25 05:25 UTC] simonslaws at googlemail dot com
[2006-07-27 13:01 UTC] simonslaws at googlemail dot com
[2006-08-09 07:15 UTC] simonslaws at googlemail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 07:00:01 2025 UTC |
Description: ------------ SDO version: 1.0.2 PHP version: 5.1.4 (PECL form did not list 5.1.4!) The following test seems to work but ugly warnings appear, and it also seems executePreparedQuery() outputs a couple of unexpected spaces when run with PHP's CLI. Reproduce code: --------------- <?php /* MySql statements: CREATE DATABASE sdo_user; USE sdo_user; CREATE TABLE `Mbr` ( `id` INTEGER auto_increment, `name` VARCHAR( 40 ) NULL, PRIMARY KEY ( `id` ) ) COMMENT = 'Members'; CREATE TABLE `Profile` ( `id` INTEGER auto_increment, `parent` VARCHAR( 40 ) NOT NULL, `address` VARCHAR( 100 ) NULL, PRIMARY KEY ( `id` ) ) COMMENT = 'Contact address details'; INSERT INTO Mbr VALUES(NULL, "Jimmy"); */ // Member table structure $mbr = array( 'name' => 'Mbr', 'columns' => array('id', 'name'), 'PK' => 'id' ); // Profile table structure $profile = array ( 'name' => 'Profile', 'columns' => array('id', 'parent', 'address'), 'PK' => 'id', 'FK' => array ('from' => 'parent', 'to' => 'Mbr') ); $table_lib = array($mbr, $profile); // Table containment structure $table_tree = array('parent' => 'Mbr', 'child' => 'Profile'); // Constants define('PDO_DSN', 'mysql:host=localhost;dbname=sdo_user'); define('DATABASE_USER', 'mim'); define('DATABASE_PASSWORD', '????????'); // Get SDO/DAS require 'SDO/DAS/Relational.php'; $dbh = new PDO(PDO_DSN, DATABASE_USER, DATABASE_PASSWORD); $das = new SDO_DAS_Relational($table_lib, 'Mbr', array($table_tree)); $pdo_stmt = $dbh->prepare('select id from Mbr where name=?'); echo ":Odd spaces start (PHP CLI):"; $root = $das->executePreparedQuery($dbh, $pdo_stmt, array('Jimmy'), array('Mbr.id')); echo ":Odd spaces end:"; $mbr = $root['Mbr'][0]; $profile = $mbr->createDataObject('Profile'); $profile->address = 'Somewhere'; $das->applyChanges($dbh, $root); echo "Done\n"; ?> Expected result: ---------------- Done Actual result: -------------- :Odd spaces start (PHP CLI): :Odd spaces end:PHP Notice: Undefined variable: settings_as_array in /usr/local/lib/php/SDO/DAS/Relational/SettingListHelper.php on line 42 Notice: Undefined variable: settings_as_array in /usr/local/lib/php/SDO/DAS/Relational/SettingListHelper.php on line 42 PHP Warning: array_key_exists(): The second argument should be either an array or an object in /usr/local/lib/php/SDO/DAS/Relational/UpdateAction.php on line 80 Warning: array_key_exists(): The second argument should be either an array or an object in /usr/local/lib/php/SDO/DAS/Relational/UpdateAction.php on line 80 Done