mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 18:40:13 -06:00
Use standard SQL quotes for string literals
This commit is contained in:
@@ -35,12 +35,12 @@ ColumnDisplayFormatDialog::ColumnDisplayFormatDialog(const QString& colname, QSt
|
||||
formatFunctions["hex"] = "printf('0x%x', " + sqlb::escapeIdentifier(column_name) + ")";
|
||||
formatFunctions["octal"] = "printf('%o', " + sqlb::escapeIdentifier(column_name) + ")";
|
||||
formatFunctions["round"] = "round(" + sqlb::escapeIdentifier(column_name) + ")";
|
||||
formatFunctions["appleDate"] = "datetime('2001-01-01', " + sqlb::escapeIdentifier(column_name) + " || \" seconds\")";
|
||||
formatFunctions["appleDate"] = "datetime('2001-01-01', " + sqlb::escapeIdentifier(column_name) + " || ' seconds')";
|
||||
formatFunctions["javaEpoch"] = "strftime('%Y-%m-%d %H:%M:%S.', " + sqlb::escapeIdentifier(column_name) +
|
||||
"/1000, 'unixepoch') || (" + sqlb::escapeIdentifier(column_name) + "%1000)";
|
||||
formatFunctions["julian"] = "datetime(" + sqlb::escapeIdentifier(column_name) + ")";
|
||||
formatFunctions["epoch"] = "datetime(" + sqlb::escapeIdentifier(column_name) + ", 'unixepoch')";
|
||||
formatFunctions["winDate"] = "datetime('1899-12-30', " + sqlb::escapeIdentifier(column_name) + " || \" days\")";
|
||||
formatFunctions["winDate"] = "datetime('1899-12-30', " + sqlb::escapeIdentifier(column_name) + " || ' days')";
|
||||
formatFunctions["ddmmyyyyDate"] = "strftime('%d/%m/%Y', " + sqlb::escapeIdentifier(column_name) + ")";
|
||||
formatFunctions["lower"] = "lower(" + sqlb::escapeIdentifier(column_name) + ")";
|
||||
formatFunctions["upper"] = "upper(" + sqlb::escapeIdentifier(column_name) + ")";
|
||||
|
||||
@@ -134,7 +134,7 @@ bool DBBrowserDB::open(const QString& db, bool readOnly)
|
||||
sqlite3_create_collation(_db, "UTF16", SQLITE_UTF16, nullptr, sqlite_compare_utf16);
|
||||
// add UTF16CI (case insensitive) collation (comparison is performed by QString functions)
|
||||
sqlite3_create_collation(_db, "UTF16CI", SQLITE_UTF16, nullptr, sqlite_compare_utf16ci);
|
||||
|
||||
|
||||
// register collation callback
|
||||
Callback<void(void*, sqlite3*, int, const char*)>::func = std::bind(&DBBrowserDB::collationNeeded, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
|
||||
void (*c_callback)(void*, sqlite3*, int, const char*) = static_cast<decltype(c_callback)>(Callback<void(void*, sqlite3*, int, const char*)>::callback);
|
||||
@@ -1672,7 +1672,7 @@ QString DBBrowserDB::getPragma(const QString& pragma)
|
||||
bool DBBrowserDB::setPragma(const QString& pragma, const QString& value)
|
||||
{
|
||||
// Set the pragma value
|
||||
QString sql = QString("PRAGMA %1 = \"%2\";").arg(pragma).arg(value);
|
||||
QString sql = QString("PRAGMA %1 = '%2';").arg(pragma).arg(value);
|
||||
|
||||
// In general, we want to commit changes before running pragmas because most of them can't be rolled back and some of them
|
||||
// even fail when run in a transaction. However, the defer_foreign_keys pragma has neither problem and we need it to be settable
|
||||
|
||||
Reference in New Issue
Block a user