formatting
This commit is contained in:
@@ -122,5 +122,3 @@ class AlterTableSQLRewriter extends AbstractSQLRewriter
|
||||
return $sql;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ class DescribeSQLRewriter extends AbstractSQLRewriter
|
||||
* @param string $sql The SQL statement
|
||||
* @return string|null The table name if found, or null otherwise
|
||||
*/
|
||||
protected function extractTableName($sql) {
|
||||
protected function extractTableName($sql)
|
||||
{
|
||||
$pattern = "/DESCRIBE ['\"`]?([^'\"`]+)['\"`]?/i";
|
||||
if (preg_match($pattern, $sql, $matches)) {
|
||||
return $matches[1];
|
||||
@@ -29,7 +30,8 @@ class DescribeSQLRewriter extends AbstractSQLRewriter
|
||||
* @param string $tableName The table name
|
||||
* @return string The generated SQL query
|
||||
*/
|
||||
function generatePostgresDescribeTable($tableName) {
|
||||
public function generatePostgresDescribeTable($tableName)
|
||||
{
|
||||
$sql = <<<SQL
|
||||
SELECT
|
||||
f.attnum AS number,
|
||||
|
||||
@@ -15,7 +15,8 @@ class ShowFullColumnsSQLRewriter extends AbstractSQLRewriter
|
||||
* @param string $sql The SQL statement
|
||||
* @return string|null The table name if found, or null otherwise
|
||||
*/
|
||||
protected function extractTableNameFromShowColumns($sql) {
|
||||
protected function extractTableNameFromShowColumns($sql)
|
||||
{
|
||||
$pattern = "/SHOW FULL COLUMNS FROM ['\"`]?([^'\"`]+)['\"`]?/i";
|
||||
if (preg_match($pattern, $sql, $matches)) {
|
||||
return $matches[1];
|
||||
@@ -29,7 +30,8 @@ class ShowFullColumnsSQLRewriter extends AbstractSQLRewriter
|
||||
* @param string $tableName The table name
|
||||
* @return string The generated SQL query
|
||||
*/
|
||||
function generatePostgresShowColumns($tableName) {
|
||||
public function generatePostgresShowColumns($tableName)
|
||||
{
|
||||
$sql = <<<SQL
|
||||
SELECT
|
||||
a.attname AS "Field",
|
||||
|
||||
@@ -15,7 +15,8 @@ class ShowIndexSQLRewriter 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 INDEX FROM ['\"`]?([^'\"`]+)['\"`]?/i";
|
||||
if (preg_match($pattern, $sql, $matches)) {
|
||||
return $matches[1];
|
||||
@@ -29,7 +30,8 @@ class ShowIndexSQLRewriter extends AbstractSQLRewriter
|
||||
* @param string $tableName The table name
|
||||
* @return string The generated SQL query
|
||||
*/
|
||||
function generatePostgresShowIndexFrom($tableName) {
|
||||
public function generatePostgresShowIndexFrom($tableName)
|
||||
{
|
||||
$sql = <<<SQL
|
||||
SELECT bc.relname AS "Table",
|
||||
CASE WHEN i.indisunique THEN '0' ELSE '1' END AS "Non_unique",
|
||||
|
||||
@@ -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\";";
|
||||
|
||||
Reference in New Issue
Block a user