@@ -23,14 +23,14 @@ class MySqlDriver implements Nette\Database\Driver
2323 ERROR_DATA_TRUNCATED = 1265 ;
2424
2525 private Nette \Database \Connection $ connection ;
26- private bool $ supportBooleans ;
26+ private bool $ convertBoolean ;
2727
2828
2929 /**
3030 * Driver options:
3131 * - charset => character encoding to set (default is utf8mb4)
3232 * - sqlmode => see http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
33- * - supportBooleans => converts INT(1) to boolean
33+ * - convertBoolean => converts INT(1) to boolean
3434 */
3535 public function initialize (Nette \Database \Connection $ connection , array $ options ): void
3636 {
@@ -44,7 +44,7 @@ public function initialize(Nette\Database\Connection $connection, array $options
4444 $ connection ->query ('SET sql_mode=? ' , $ options ['sqlmode ' ]);
4545 }
4646
47- $ this ->supportBooleans = (bool ) ($ options ['supportBooleans ' ] ?? false );
47+ $ this ->convertBoolean = (bool ) ($ options [ ' convertBoolean ' ] ?? $ options ['supportBooleans ' ] ?? false );
4848 }
4949
5050
@@ -202,7 +202,7 @@ public function getColumnTypes(\PDOStatement $statement): array
202202 if (isset ($ meta ['native_type ' ])) {
203203 $ types [$ meta ['name ' ]] = match (true ) {
204204 $ meta ['native_type ' ] === 'NEWDECIMAL ' && $ meta ['precision ' ] === 0 => Nette \Database \IStructure::FIELD_INTEGER ,
205- $ meta ['native_type ' ] === 'TINY ' && $ meta ['len ' ] === 1 && $ this ->supportBooleans => Nette \Database \IStructure::FIELD_BOOL ,
205+ $ meta ['native_type ' ] === 'TINY ' && $ meta ['len ' ] === 1 && $ this ->convertBoolean => Nette \Database \IStructure::FIELD_BOOL ,
206206 $ meta ['native_type ' ] === 'TIME ' => Nette \Database \IStructure::FIELD_TIME_INTERVAL ,
207207 default => Nette \Database \Helpers::detectType ($ meta ['native_type ' ]),
208208 };
0 commit comments