PEAR::DB no data into database
| From: | Labes Dirk | Date: | Mon, 16 Jun 2003 12:59:56 +0000 |
| Subject: | PEAR::DB no data into database | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5997@lists.php.net to get a copy of this message | ||
Hi,
there is a file with SQL statements.("test.txt")
These statements are into a Oracle database.
I've wrote this php script:
<?php
require_once("DB.php");
$user = "****";
$host = "****";
$pass = "****";
$dsn = "oci8://$user:$pass@$host";
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handle_pear_error');
function handle_pear_error($error_obj)
{
if(get_class($error_obj) == "db_error")
{
print "Database Error:<br>\n";
}
else
{
print "PEAR Error:<br>\n";
}
DIE ($error_obj->getMessage()."\n<br>".$error_obj->getDebugInfo());
}
$db = DB::connect($dsn, array('persistent' => true, 'optimize'
=> 'portability'));
if(DB::isError($db))
{
DIE ("<font
color=\"red\"><b>".$db->getMessage()."</b></font><br>");
}
$db->autoCommit();
$datei = "test.sql";
$c15 = file($datei);
for ($i=0;$i< count($c15);$i++)
{
$query = $c15[$i];
$res = $db->query($query);
}
?>
There are no errors or warnings. But there are is no data in database.
I have checked all Statements. They seems to be o.k.
Greetings
Dirk