@@ -33,9 +33,8 @@ class MySqlDriver implements Nette\Database\ISupplementalDriver
3333 public function __construct (Nette \Database \Connection $ connection , array $ options )
3434 {
3535 $ this ->connection = $ connection ;
36- $ charset = isset ($ options ['charset ' ])
37- ? $ options ['charset ' ]
38- : (version_compare ($ connection ->getPdo ()->getAttribute (\PDO ::ATTR_SERVER_VERSION ), '5.5.3 ' , '>= ' ) ? 'utf8mb4 ' : 'utf8 ' );
36+ $ charset = $ options ['charset ' ]
37+ ?? (version_compare ($ connection ->getPdo ()->getAttribute (\PDO ::ATTR_SERVER_VERSION ), '5.5.3 ' , '>= ' ) ? 'utf8mb4 ' : 'utf8 ' );
3938 if ($ charset ) {
4039 $ connection ->query ("SET NAMES ' $ charset' " );
4140 }
@@ -50,7 +49,7 @@ public function __construct(Nette\Database\Connection $connection, array $option
5049 */
5150 public function convertException (\PDOException $ e )
5251 {
53- $ code = isset ( $ e ->errorInfo [1 ]) ? $ e -> errorInfo [ 1 ] : NULL ;
52+ $ code = $ e ->errorInfo [1 ] ?? NULL ;
5453 if (in_array ($ code , [1216 , 1217 , 1451 , 1452 , 1701 ], TRUE )) {
5554 return Nette \Database \ForeignKeyConstraintViolationException::from ($ e );
5655
@@ -157,7 +156,7 @@ public function getTables()
157156 foreach ($ this ->connection ->query ('SHOW FULL TABLES ' ) as $ row ) {
158157 $ tables [] = [
159158 'name ' => $ row [0 ],
160- 'view ' => isset ($ row [1 ]) && $ row [ 1 ] === 'VIEW ' ,
159+ 'view ' => ($ row [1 ] ?? NULL ) === 'VIEW ' ,
161160 ];
162161 }
163162 return $ tables ;
0 commit comments