From 956a63b13666cb0ee70f60669a0a503ba1efccca Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Wed, 29 May 2024 22:05:30 +0330 Subject: [PATCH] [11.x] Fix double-quoted string literals on SQLite (#51615) * fix double-quoted string literals * fix a left one * fix a left one --- .../Database/Schema/Grammars/SQLiteGrammar.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php index ba03d206e96f..e9506a2950be 100644 --- a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -38,8 +38,8 @@ class SQLiteGrammar extends Grammar public function compileSqlCreateStatement($name, $type = 'table') { return sprintf('select "sql" from sqlite_master where type = %s and name = %s', - $this->wrap($type), - $this->wrap(str_replace('.', '__', $name)) + $this->quoteString($type), + $this->quoteString(str_replace('.', '__', $name)) ); } @@ -91,7 +91,7 @@ public function compileColumns($table) return sprintf( 'select name, type, not "notnull" as "nullable", dflt_value as "default", pk as "primary", hidden as "extra" ' .'from pragma_table_xinfo(%s) order by cid asc', - $this->wrap(str_replace('.', '__', $table)) + $this->quoteString(str_replace('.', '__', $table)) ); } @@ -104,12 +104,12 @@ public function compileColumns($table) public function compileIndexes($table) { return sprintf( - 'select "primary" as name, group_concat(col) as columns, 1 as "unique", 1 as "primary" ' + 'select \'primary\' as name, group_concat(col) as columns, 1 as "unique", 1 as "primary" ' .'from (select name as col from pragma_table_info(%s) where pk > 0 order by pk, cid) group by name ' - .'union select name, group_concat(col) as columns, "unique", origin = "pk" as "primary" ' + .'union select name, group_concat(col) as columns, "unique", origin = \'pk\' as "primary" ' .'from (select il.*, ii.name as col from pragma_index_list(%s) il, pragma_index_info(il.name) ii order by il.seq, ii.seqno) ' .'group by name, "unique", "primary"', - $table = $this->wrap(str_replace('.', '__', $table)), + $table = $this->quoteString(str_replace('.', '__', $table)), $table ); } @@ -127,7 +127,7 @@ public function compileForeignKeys($table) .'group_concat("to") as foreign_columns, on_update, on_delete ' .'from (select * from pragma_foreign_key_list(%s) order by id desc, seq) ' .'group by id, "table", on_update, on_delete', - $this->wrap(str_replace('.', '__', $table)) + $this->quoteString(str_replace('.', '__', $table)) ); }