orm icon indicating copy to clipboard operation
orm copied to clipboard

Add parameter "charset" for connection

Open vjik opened this issue 4 years ago • 0 comments

Now for set charset need use so configuration:

'connections' => [
  'mysql' => [
    'connection' => 'mysql:host=localhost;dbname=xxx;charset=utf8mb4',
    'username' => 'root',
    'password' => 'root',
    'options' => [
      \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8mb4"',
    ],
  ]
]

I suggest add parameter charset that will be added to connection (if need) and used in init command:

'connections' => [
  'mysql' => [
    'connection' => 'mysql:host=localhost;dbname=xxx',
    'username' => 'root',
    'password' => 'root',
    'charset' => 'utf8mb4',
  ]
]

For MySQL together with SET NAMES, maybe need use SET character_set_client=..., SET character_set_connection=..., SET character_set_results=.... But I'm not sure.

vjik avatar Oct 24 '20 07:10 vjik