mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 18:40:13 -06:00
Better identifier quoting
This commit fixes the SQL export which did not quote the field names in the INSERT statements. This also simplifies the code for escaping SQL identifiers.
This commit is contained in:
@@ -734,7 +734,7 @@ bool DBBrowserDB::dump(const QString& filePath,
|
||||
{
|
||||
stream << "INSERT INTO " << sqlb::escapeIdentifier(it->name());
|
||||
if (insertColNames)
|
||||
stream << " (" << cols.join(",") << ")";
|
||||
stream << " (" << sqlb::escapeIdentifier(cols).join(",") << ")";
|
||||
stream << " VALUES (";
|
||||
}
|
||||
else
|
||||
@@ -1139,9 +1139,7 @@ QString DBBrowserDB::emptyInsertStmt(const QString& schemaName, const sqlb::Tabl
|
||||
stmt.append(" DEFAULT VALUES;");
|
||||
} else {
|
||||
stmt.append("(");
|
||||
for(const QString& f : fields)
|
||||
stmt.append(sqlb::escapeIdentifier(f) + ",");
|
||||
stmt.chop(1);
|
||||
stmt.append(sqlb::escapeIdentifier(fields).join(","));
|
||||
stmt.append(") VALUES (");
|
||||
stmt.append(vals.join(","));
|
||||
stmt.append(");");
|
||||
|
||||
Reference in New Issue
Block a user