Skip to content

Commit 956a63b

Browse files
[11.x] Fix double-quoted string literals on SQLite (#51615)
* fix double-quoted string literals * fix a left one * fix a left one
1 parent 8b769a0 commit 956a63b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class SQLiteGrammar extends Grammar
3838
public function compileSqlCreateStatement($name, $type = 'table')
3939
{
4040
return sprintf('select "sql" from sqlite_master where type = %s and name = %s',
41-
$this->wrap($type),
42-
$this->wrap(str_replace('.', '__', $name))
41+
$this->quoteString($type),
42+
$this->quoteString(str_replace('.', '__', $name))
4343
);
4444
}
4545

@@ -91,7 +91,7 @@ public function compileColumns($table)
9191
return sprintf(
9292
'select name, type, not "notnull" as "nullable", dflt_value as "default", pk as "primary", hidden as "extra" '
9393
.'from pragma_table_xinfo(%s) order by cid asc',
94-
$this->wrap(str_replace('.', '__', $table))
94+
$this->quoteString(str_replace('.', '__', $table))
9595
);
9696
}
9797

@@ -104,12 +104,12 @@ public function compileColumns($table)
104104
public function compileIndexes($table)
105105
{
106106
return sprintf(
107-
'select "primary" as name, group_concat(col) as columns, 1 as "unique", 1 as "primary" '
107+
'select \'primary\' as name, group_concat(col) as columns, 1 as "unique", 1 as "primary" '
108108
.'from (select name as col from pragma_table_info(%s) where pk > 0 order by pk, cid) group by name '
109-
.'union select name, group_concat(col) as columns, "unique", origin = "pk" as "primary" '
109+
.'union select name, group_concat(col) as columns, "unique", origin = \'pk\' as "primary" '
110110
.'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) '
111111
.'group by name, "unique", "primary"',
112-
$table = $this->wrap(str_replace('.', '__', $table)),
112+
$table = $this->quoteString(str_replace('.', '__', $table)),
113113
$table
114114
);
115115
}
@@ -127,7 +127,7 @@ public function compileForeignKeys($table)
127127
.'group_concat("to") as foreign_columns, on_update, on_delete '
128128
.'from (select * from pragma_foreign_key_list(%s) order by id desc, seq) '
129129
.'group by id, "table", on_update, on_delete',
130-
$this->wrap(str_replace('.', '__', $table))
130+
$this->quoteString(str_replace('.', '__', $table))
131131
);
132132
}
133133

0 commit comments

Comments
 (0)