In config I have the following array of options:
'port' => 13306,
'charset' => 'utf8',
'options' => [
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES GREEK',
PDO::ATTR_PERSISTENT => 1,
PDO::ATTR_EMULATE_PREPARES => 0,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
But the result set is still utf8, most probabbly since 'charset' = 'utf8'.
If I issue same command just before the SELECT query like:
!$db->execute('SET NAMES GREEK') && exit('SET NAMES FAILURE. STOP RUN.');
Then it works. The result set is encoded propertly.
I wonder what's the use of global PDO options if it doesn't work? Or am I missing something.
print_r($di->get('config')->database->options);
Phalcon\Config Object
(
[12] => 1
[1002] => SET NAMES GREEK
[20] => 0
[3] => 2
)