Here is my part of code:
$string = null;
if (! feof($handle)) {
while (($buffer = fgets($handle)) !== false) {
list (
$id,$link
) = explode(' ',$buffer);
$string .= "('$id','$link'),";
if ($x === 100) {
$string = rtrim($string, ',');
$string .= ';';
try {
$this->model->multiInsert($string);
} catch (PDOException $e) {
var_dump($e->errorInfo);
}
$string = null;
$x = 0;
} else {
$x++;
}
}
if (! feof($handle)) {
// error
}
fclose($handle);
}
Hello everyone. I have got a PDO exception `HY000` (without any error description) while I try to parse huge text file.
Here is my part of code:
[...]
try {
$this->model->multiInsert($string);
} catch (PDOException $e) {
$options = array(
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, // generic attribute
\PDO::ATTR_PERSISTENT => TRUE, // we want to use persistent connections
\PDO::MYSQL_ATTR_COMPRESS => TRUE, // MySQL-specific attribute
);
$db = new \DB\SQL('mysql:host=localhost;port=3306;dbname=mysqldb','username','password', $options);
self::$DB = new \DB\SQL(
$f3->get('dsn'),
$f3->get('db_user'),
$f3->get('db_password'), [
\PDO::ATTR_PERSISTENT => true,
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_WARNING,
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
]);
As you see I have got an exception mode enabled. Regarding to your question about `error` or `exception`, I have an exception in the `try catch` block.
For now I didn`t find any solution... Considering the suggestion of mr. PJH, my sql query is syntactically correct, there is no error, and as I said with `$this->db->pdo()->exec()`
works fine.
As mr. PJH said, I`ve got a generic database error...
--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/1d240340-66cc-45ad-8742-0f32f38ef466%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Though I do see that you are building a multi record insert, is the performance gain significant?