1
            $sql = "REPLACE INTO `myTable` VALUES (:symbol1, :symbol1), (:symbol1, :symbol2)";
            $statement = $this->pdoObject->prepare($sql);
            $statement->execute(array(':symbol1' => $symbol1, ':symbol2' => $symbol2));

The above throws a PDOException:

SQLSTATE[HY000]: General error: 10 disk I/O error

I don't see an error in the statement.

reggie
  • 3,523
  • 14
  • 62
  • 97
  • Isn't is a MySQL error? – Stepashka Nov 09 '15 at 11:23
  • **Table and Column names cannot be replaced by parameters in PDO.** – Saty Nov 09 '15 at 11:23
  • "Isn't is a MySQL error?" - no, but a sqlite error. – VolkerK Nov 09 '15 at 11:24
  • Possible duplicate of [PHP PDO - Bind table name?](http://stackoverflow.com/questions/15182910/php-pdo-bind-table-name) – Saty Nov 09 '15 at 11:24
  • @Saty: the statement does neither. – VolkerK Nov 09 '15 at 11:24
  • I am not binding the table name. – reggie Nov 09 '15 at 11:32
  • 1
    Unfortunately the PDO_sqlite extension doesn't return the extended error code as there are [26 different extended codes for I/O errors](https://www.sqlite.org/c3ref/c_abort_rollback.html) alone. Don't focus on PDO but on the sqlite error itself. There are several answers here on SO and dba.stackexchange.com for "sqlite disk I/o error" that address a range of possible causes. Could be as simple as having the "wrong" file permissions, as bad as your hdd failing or anything inbetween like e.g. the journal_mode. – VolkerK Nov 09 '15 at 11:37
  • Thanks. I checked the permissions of the database and making it read-and-writable by the user www-data seems to have fixed the problem. – reggie Nov 09 '15 at 11:52
  • Wow, still getting these errors afterall... – reggie Nov 09 '15 at 12:00
  • Have you tried a database that is ceated by the php script? Does the error only come up when the statement replaces a record (instead of inserting a new one)? Does the same happen with a plain INSERT statement? And an UPDATE statement? And a DELETE statement? SELECT works as expected? – VolkerK Nov 09 '15 at 12:06
  • I deleted the contents of the /tmp folder and also restarted the system. So far, the error has not returned. – reggie Nov 09 '15 at 12:17
  • Seems related: https://dba.stackexchange.com/questions/53090/occasional-disk-i-o-errors-in-sqlite – Ryan May 10 '18 at 19:25

0 Answers0