andreossido / laravel-odbc

ODBC integration for Laravel framework
35 stars 29 forks source link

PDO constructor was not called #16

Open Ejaboneta opened 3 years ago

Ejaboneta commented 3 years ago

I'm getting the following error when Telescope is enabled. Any advice? PDO::quote(): SQLSTATE[00000]: No error: PDO constructor was not called

guiteixeirapimentel commented 3 years ago

Using laravel-debugbar with PHP 8 I also get this error. I think it's related to changes in the PDO base class and I could not find any documentation on this. As I'm only using this in a specific scenario, the following change worked:

public function quote(string $string, int $type = \PDO::PARAM_STR){ return '"'.$string.'"'; }

Added this to the ODBCPdo class.

Edit: From the PHP docs (https://www.php.net/manual/pt_BR/pdo.quote.php#:~:text=PDO%3A%3Aquote()%20places,appropriate%20to%20the%20underlying%20driver.)

"Not all PDO drivers implement this method (notably PDO_ODBC). Consider using prepared statements instead."

Maybe that's the problem?