|
@@ 253-276 (lines=24) @@
|
| 250 |
|
* |
| 251 |
|
* @return string |
| 252 |
|
*/ |
| 253 |
|
public static function get_mysql_client_version(DB $dbConnection = null): string |
| 254 |
|
{ |
| 255 |
|
static $MYSQL_CLIENT_VERSION_CACHE = []; |
| 256 |
|
|
| 257 |
|
if ($dbConnection === null) { |
| 258 |
|
$dbConnection = DB::getInstance(); |
| 259 |
|
} |
| 260 |
|
|
| 261 |
|
$cacheKey = implode('--', $dbConnection->getConfig()); |
| 262 |
|
|
| 263 |
|
if (isset($MYSQL_CLIENT_VERSION_CACHE[$cacheKey])) { |
| 264 |
|
return $MYSQL_CLIENT_VERSION_CACHE[$cacheKey]; |
| 265 |
|
} |
| 266 |
|
|
| 267 |
|
$doctrineConnection = $dbConnection->getDoctrineConnection(); |
| 268 |
|
if ($doctrineConnection) { |
| 269 |
|
$doctrineWrappedConnection = $doctrineConnection->getWrappedConnection(); |
| 270 |
|
if ($doctrineWrappedConnection instanceof \Doctrine\DBAL\Driver\PDOConnection) { |
| 271 |
|
return $MYSQL_CLIENT_VERSION_CACHE[$cacheKey] = ''; |
| 272 |
|
} |
| 273 |
|
} |
| 274 |
|
|
| 275 |
|
return $MYSQL_CLIENT_VERSION_CACHE[$cacheKey] = (string)\mysqli_get_client_version($dbConnection->getLink()); |
| 276 |
|
} |
| 277 |
|
|
| 278 |
|
|
| 279 |
|
/** |
|
@@ 286-309 (lines=24) @@
|
| 283 |
|
* |
| 284 |
|
* @return string |
| 285 |
|
*/ |
| 286 |
|
public static function get_mysql_server_version(DB $dbConnection = null): string |
| 287 |
|
{ |
| 288 |
|
static $MYSQL_SERVER_VERSION_CACHE = []; |
| 289 |
|
|
| 290 |
|
if ($dbConnection === null) { |
| 291 |
|
$dbConnection = DB::getInstance(); |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
$cacheKey = implode('--', $dbConnection->getConfig()); |
| 295 |
|
|
| 296 |
|
if (isset($MYSQL_SERVER_VERSION_CACHE[$cacheKey])) { |
| 297 |
|
return $MYSQL_SERVER_VERSION_CACHE[$cacheKey]; |
| 298 |
|
} |
| 299 |
|
|
| 300 |
|
$doctrineConnection = $dbConnection->getDoctrineConnection(); |
| 301 |
|
if ($doctrineConnection) { |
| 302 |
|
$doctrineWrappedConnection = $doctrineConnection->getWrappedConnection(); |
| 303 |
|
if ($doctrineWrappedConnection instanceof \Doctrine\DBAL\Driver\PDOConnection) { |
| 304 |
|
return $MYSQL_SERVER_VERSION_CACHE[$cacheKey] = (string)$doctrineWrappedConnection->getServerVersion(); |
| 305 |
|
} |
| 306 |
|
} |
| 307 |
|
|
| 308 |
|
return $MYSQL_SERVER_VERSION_CACHE[$cacheKey] = (string)\mysqli_get_server_version($dbConnection->getLink()); |
| 309 |
|
} |
| 310 |
|
|
| 311 |
|
/** |
| 312 |
|
* Return all db-fields from a table. |