easydb icon indicating copy to clipboard operation
easydb copied to clipboard

setAttribute not working

Open alix78 opened this issue 1 year ago • 2 comments

hello i am trying to change the default fetch mod to : object using:

$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);

but there is no effects on the result, its still return results as an array.

alix78 avatar Aug 08 '22 12:08 alix78

also trying to use this options: `$db_connection_attributes = [ PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'",

PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ ]; `

like this :

$db = \ParagonIE\EasyDB\Factory::fromArray([ 'mysql:host='.TDB_HOST.';dbname='.TDB_NAME, TDB_USER, TDB_PASS ], '', $db_connection_attributes);

dose not work also..

alix78 avatar Aug 08 '22 13:08 alix78

What method are you using to get results as an array?

Most of EasyDB's APIs explicitly return an array, always, regardless of what PDO is configured to do. Check the docblocks for the methods you intend to use.

paragonie-security avatar Aug 30 '22 18:08 paragonie-security

Please let us know if you're still having problems.

paragonie-security avatar Dec 15 '22 09:12 paragonie-security