mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Allow "getting" and setting case_sensitive_like pragma (#1494)
* Allow "getting" and setting case_sensitive_like pragma In order to allow case insensitive filtering, the pragma case_sensitive_like is added to the GUI. Given that this pragma cannot be read, a special SELECT request is made in DBBrowserDB::getPragma for inferring its value. See issue #1489. * Warning in the pragma case_sensitive_like This pragma has some peculiarities, so it is convenient to warn the user about it through a tool-tip in the value.
This commit is contained in:
@@ -1881,6 +1881,7 @@ void MainWindow::loadPragmas()
|
||||
pragmaValues.temp_store = db.getPragma("temp_store").toInt();
|
||||
pragmaValues.user_version = db.getPragma("user_version").toInt();
|
||||
pragmaValues.wal_autocheckpoint = db.getPragma("wal_autocheckpoint").toInt();
|
||||
pragmaValues.case_sensitive_like = db.getPragma("case_sensitive_like").toInt();
|
||||
|
||||
updatePragmaUi();
|
||||
}
|
||||
@@ -1904,6 +1905,7 @@ void MainWindow::updatePragmaUi()
|
||||
ui->comboboxPragmaTempStore->setCurrentIndex(pragmaValues.temp_store);
|
||||
ui->spinPragmaUserVersion->setValue(pragmaValues.user_version);
|
||||
ui->spinPragmaWalAutoCheckpoint->setValue(pragmaValues.wal_autocheckpoint);
|
||||
ui->checkboxPragmaCaseSensitiveLike->setChecked(pragmaValues.case_sensitive_like);
|
||||
}
|
||||
|
||||
void MainWindow::savePragmas()
|
||||
@@ -1933,6 +1935,7 @@ void MainWindow::savePragmas()
|
||||
db.setPragma("temp_store", ui->comboboxPragmaTempStore->currentIndex(), pragmaValues.temp_store);
|
||||
db.setPragma("user_version", ui->spinPragmaUserVersion->value(), pragmaValues.user_version);
|
||||
db.setPragma("wal_autocheckpoint", ui->spinPragmaWalAutoCheckpoint->value(), pragmaValues.wal_autocheckpoint);
|
||||
db.setPragma("case_sensitive_like", ui->checkboxPragmaCaseSensitiveLike->isChecked(), pragmaValues.case_sensitive_like);
|
||||
|
||||
updatePragmaUi();
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ private:
|
||||
int temp_store;
|
||||
int user_version;
|
||||
int wal_autocheckpoint;
|
||||
int case_sensitive_like;
|
||||
} pragmaValues;
|
||||
|
||||
enum StatementType
|
||||
|
||||
@@ -823,6 +823,29 @@ You can drag SQL statements from an object row and drop them into other applicat
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="labelPragmaCaseSensitiveLike">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="https://www.sqlite.org/pragma.html#pragma_case_sensitive_like">Case Sensitive Like</a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>checkboxPragmaCaseSensitiveLike</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<widget class="QCheckBox" name="checkboxPragmaCaseSensitiveLike">
|
||||
<property name="toolTip">
|
||||
<string>Warning: this pragma is not readable and this value has been inferred. Writing the pragma might overwrite a redefined LIKE provided by an SQLite extension.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -1646,7 +1646,12 @@ QString DBBrowserDB::getPragma(const QString& pragma)
|
||||
if(!isOpen())
|
||||
return QString();
|
||||
|
||||
QString sql = QString("PRAGMA %1").arg(pragma);
|
||||
QString sql;
|
||||
if (pragma=="case_sensitive_like")
|
||||
sql = "SELECT 'x' NOT LIKE 'X'";
|
||||
else
|
||||
sql = QString("PRAGMA %1").arg(pragma);
|
||||
|
||||
sqlite3_stmt* vm;
|
||||
const char* tail;
|
||||
QString retval;
|
||||
|
||||
Reference in New Issue
Block a user