formatting

This commit is contained in:
Matthew Bucci
2023-11-07 15:29:37 -08:00
parent c60d8f90b1
commit dad1f0d264
8 changed files with 104 additions and 61 deletions
+4 -2
View File
@@ -15,7 +15,8 @@ class ShowVariablesSQLRewriter extends AbstractSQLRewriter
* @param string $sql The SQL statement
* @return string|null The table name if found, or null otherwise
*/
protected function extractVariableName($sql) {
protected function extractVariableName($sql)
{
$pattern = "/SHOW VARIABLES LIKE ['\"`]?([^'\"`]+)['\"`]?/i";
if (preg_match($pattern, $sql, $matches)) {
return $matches[1];
@@ -29,7 +30,8 @@ class ShowVariablesSQLRewriter extends AbstractSQLRewriter
* @param string $tableName The table name
* @return string The generated SQL query
*/
function generatePostgres($sql, $variableName) {
public function generatePostgres($sql, $variableName)
{
if ($variableName == "sql_mode") {
// Act like MySQL default configuration, where sql_mode is ""
return "SELECT '$variableName' AS \"Variable_name\", '' AS \"Value\";";