$ cp /usr/share/pear/docs/DB_DataObject/docs/example.ini test.ini
database=pgsql://postgres@127.0.0.1/test schema_location=/var/www/html/test class_location=/var/www/html/test db_driver=DB +createTables.php で既存のDBを解析し、クラスを作成する $ php -q /usr/share/pear/DB/DataObject/createTables.php /var/www/html/test/test.ini
<?
require_once('DB/DataObject.php');
$options = &PEAR::getStaticProperty('DB_DataObject','options');
$options = array(
'database'=>'pgsql://postgres@127.0.0.1/test',
'schema_location' => '/var/www/html/test',
'class_location' => '/var/www/html/test',
'class_prefix' => 'DataObjects_',
'debug'=>0
);
$o = DB_DataObject::factory('public.ads_master');
$o->find();
while($o->fetch()){
echo "{$o->ads_id} | {$o->ads}<br/>\n";
}
?>
PukiWiki 1.5.3 © 2001-2020 PukiWiki Development Team. Powered by PHP 7.4.33. HTML convert time: 0.040 sec.
![[PukiWiki] [PukiWiki]](image/owl.png)