mirror of
https://github.com/mbirth/tcl_update_db.git
synced 2024-12-26 04:24:07 +00:00
Cleanup.
This commit is contained in:
parent
7deee59c3a
commit
4f880c7c06
0
lib/TclUpdates/GotuObject.php
Executable file → Normal file
0
lib/TclUpdates/GotuObject.php
Executable file → Normal file
9
lib/TclUpdates/SQLiteWriter.php
Executable file → Normal file
9
lib/TclUpdates/SQLiteWriter.php
Executable file → Normal file
@ -10,9 +10,9 @@ class SQLiteWriter
|
||||
public function __construct()
|
||||
{
|
||||
$this->dbFile = 'otadb.db3';
|
||||
$this->pdo = new \PDO('sqlite:' . $this->dbFile, 0666, $sqlerror);
|
||||
$this->pdo = new \PDO('sqlite:' . $this->dbFile);
|
||||
if ($this->pdo === false) {
|
||||
return $sqlerror;
|
||||
return false;
|
||||
}
|
||||
$this->pdo->exec('PRAGMA foreign_keys=on;');
|
||||
}
|
||||
@ -119,9 +119,8 @@ class SQLiteWriter
|
||||
));
|
||||
if ($ok) {
|
||||
$key = $this->pdo->lastInsertId();
|
||||
echo "Added entry " . $key . PHP_EOL;
|
||||
} else {
|
||||
echo "FAILED inserting." . PHP_EOL;
|
||||
return $key;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,17 @@ foreach ($file_list as $file) {
|
||||
echo 'XML not valid in ' . $filename . '!' . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
echo 'Processing ' . $filename . PHP_EOL;
|
||||
echo 'Processing ' . $filename . ' ...';
|
||||
$g = GotuObject::fromXmlParser($xp);
|
||||
//print_r($g);
|
||||
if ($g->tv) {
|
||||
$sqlw->addGotu($g, $file_date);
|
||||
$result = $sqlw->addGotu($g, $file_date);
|
||||
if ($result !== false) {
|
||||
echo ' added as #' . $result . PHP_EOL;
|
||||
} else {
|
||||
echo ' NOT ADDED.' . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
echo ' not a check XML' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user