Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

DB config & Ini file

I just want to make sure I understood correctly.

Ini config like:

[database]

adapter      = Mysql
options.1002 = SET NAMES 'UTF8'
options.8    = 2

Is equivalent for:

'database' => [
    'adapter'      => 'Mysql',
    'options'      => [
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'",
        PDO::ATTR_CASE => PDO::CASE_LOWER
    ],
]

Right?



33.6k
Accepted
answer

Yes, it's equivalent

edited Nov '15

Where did you get the ID's of an 'options' array?

1002 = set names.... etc.

This is my var dump of config service (just 'options' key with values):

[options] => Phalcon\Config Object ( [1002] => SET NAMES GREEK [12] => 1 [20] => 0 [3] => 2 [8] => 2 )

The above actually is a result from config.php which maps to:

PDO::MYSQLATTRINITCOMMAND => 'SET NAMES GREEK', PDO::ATTRPERSISTENT => 1, PDO::ATTREMULATEPREPARES => 0, PDO::ATTRERRMODE => PDO::ERRMODEEXCEPTION, PDO::ATTRCASE => PDO::CASELOWER

And somewhat it doesn't work. Even though I set wrong names ('Greek'), I'm still getting the correct result from the database (which is UTF8 btw, tables are utf8generalci).

If I try that directly on the command line or other app like Adminer the behaviour is correct (i.e. with all the specific chars = ???????????)