Open tablecell opened 7 years ago
- adapter://user:password@protocol+host:110//usr/db_file.db?mode=0644
- adapter://user:password@host/database_name
- adapter://user:password@host
- adapter://user@host
- adapter://host/database
- adapter://host
- adapter(dbsyntax)
- adapter
found nothing config charsetHere's how I do it (mysql):
$config = new \Spot\Config();
$config->addConnection('fromString', 'mysql://user:password@localhost/database?charset=utf8mb4');
//check the collation to see if it worked
echo $cfg->connection('fromString')->query("SELECT COLLATION('foo') AS charset;")->fetchColumn();
//outputs "utf8mb4_general_ci"
To be perfectly honest, that's not actually how I do it. I prefer the array-syntax:
$config = new \Spot\Config();
$config->addConnection('fromArray', [
'dbname' => 'database',
'user' => 'user',
'password' => 'password',
'host' => 'localhost',
'driver' => 'pdo_mysql',
'charset' => 'utf8mb4'
]);
//check the collation to see if it worked
echo $cfg->connection('fromArray')->query("SELECT COLLATION('foo') AS charset;")->fetchColumn();
//outputs "utf8mb4_general_ci"