Skip to content

Commit

Permalink
Don't hide errors. And different SQL format works in MySQL and Postgr…
Browse files Browse the repository at this point in the history
…esql.
  • Loading branch information
jarofgreen committed Apr 14, 2011
1 parent 008be93 commit a41917b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/WriteDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ public function __construct($configData = array()) {
public function write() {

$pdo = new PDO($this->dsn, $this->userName, $this->password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$stat = $pdo->prepare("INSERT INTO ".$this->tableName." SET ".$this->timeFieldName."=:d");
$stat = $pdo->prepare("INSERT INTO ".$this->tableName." (".$this->timeFieldName.") VALUES (:d)");

foreach($this->dataManager->getData() as $item) {
$stat->bindValue('d', $item->getDateTimeAs('Y-m-d H:i:s'), PDO::PARAM_STR);
Expand Down

0 comments on commit a41917b

Please sign in to comment.