mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
Allow space characters in table and index names, disallow ` chars
Spaces in table, index and field names are actually allowed by SQLite, so no need to check for them. However, "`" characters cause problems when appearing in SQL statements so disallow them instead.
This commit is contained in:
@@ -52,10 +52,8 @@ void CreateIndexDialog::tableChanged(const QString& new_table)
|
||||
|
||||
void CreateIndexDialog::checkInput()
|
||||
{
|
||||
ui->editIndexName->setText(ui->editIndexName->text().trimmed());
|
||||
|
||||
bool valid = true;
|
||||
if(ui->editIndexName->text().isEmpty() || ui->editIndexName->text().contains(" "))
|
||||
if(ui->editIndexName->text().isEmpty() || ui->editIndexName->text().contains("`"))
|
||||
valid = false;
|
||||
|
||||
int num_columns = 0;
|
||||
|
||||
@@ -149,9 +149,8 @@ void EditTableDialog::updateSqlText()
|
||||
void EditTableDialog::checkInput()
|
||||
{
|
||||
QString normTableName = ui->editTableName->text().trimmed();
|
||||
ui->editTableName->setText(normTableName);
|
||||
bool valid = true;
|
||||
if(normTableName.isEmpty() || normTableName.contains(" "))
|
||||
if(normTableName.isEmpty() || normTableName.contains("`"))
|
||||
valid = false;
|
||||
if(ui->treeWidget->topLevelItemCount() == 0)
|
||||
valid = false;
|
||||
|
||||
@@ -57,6 +57,7 @@ void ImportCsvDialog::accept()
|
||||
{
|
||||
// Remove invalid characters
|
||||
QString thisfield = curList.front();
|
||||
thisfield.replace("`", "");
|
||||
thisfield.replace(" ", "");
|
||||
thisfield.replace('"', "");
|
||||
thisfield.replace("'","");
|
||||
@@ -196,10 +197,8 @@ void ImportCsvDialog::updatePreview()
|
||||
|
||||
void ImportCsvDialog::checkInput()
|
||||
{
|
||||
ui->editName->setText(ui->editName->text().trimmed());
|
||||
|
||||
bool valid = true;
|
||||
if(ui->editName->text().isEmpty() || ui->editName->text().contains(" "))
|
||||
if(ui->editName->text().isEmpty() || ui->editName->text().contains("`"))
|
||||
valid = false;
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
|
||||
|
||||
Reference in New Issue
Block a user