SQL error on CREATE TABLE using QUERY method
Closed this issue · 3 comments
When i use query method to create a table, this return me SQL ERROR
without any description;
$this->getBdd()->query("CREATE TABLE IF NOT EXISTS my_table (
id SERIAL NOT NULL,
user_id integer NOT NULL,
coordx double precision NOT NULL,
coordy double precision NOT NULL,
geom GEOMETRY NOT NULL,
create_at timestamp without time zone NOT NULL,
PRIMARY KEY(id)
)")->exec();
As no rows are affected when creating any table returns 0
I have found a "partial" solution commenting some lines of the method exec()
public function exec()
{
if (is_null($this->query)) {
return null;
}
$query = $this->pdo->exec($this->query);
// if (! $query) {
// $this->error = $this->pdo->errorInfo()[2];
// return $this->error();
// }
return $query;
}
I will continue working on my fork and if I find a viable solution I will comment here.
Hi @itsalb3rt ; I guess you're right. Exec method in PDO returns the number of affected rows. For 'CREATE TABLE' command, It will return a value like zero (0), because there is no affected rows.
I'll be fix this issue soon (in two days).
Hi @itsalb3rt , I just fixed this and released new version. You can update library through composer.
Thanks for your feedback.
Hi @itsalb3rt , I just fixed this and released new version. You can update library through composer.
Thanks for your feedback.
Perfect!