Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't update or delete if primary key is string. #56

Open
nasanjargal-b opened this issue Dec 4, 2019 · 0 comments
Open

Doesn't update or delete if primary key is string. #56

nasanjargal-b opened this issue Dec 4, 2019 · 0 comments
Projects

Comments

@nasanjargal-b
Copy link

nasanjargal-b commented Dec 4, 2019

I found and fix the error of doesn't update or delete if primary key is string.

I solved this issue as below:

sqlgeneratorbase.cpp

*QString SqlGeneratorBase::updateRecord(Table t, QString tableName)

    sql = QString("UPDATE %1 SET %2 WHERE %3=%4")
            .arg(tableName)
            .arg(values.join(", "))
            .arg(key)
            .arg(val.type() == QVariant::String ? "\'" + val.toString() + "\'" : val.toString());

*QString SqlGeneratorBase::deleteRecord(Table t, QString tableName)

    QString sql = QString("DELETE FROM %1 WHERE %2='%3'")
            .arg(tableName)
            .arg(t->primaryKey())
            .arg(val.type() == QVariant::String ? "\'" + val.toString() + "\'" : val.toString());
@HamedMasafi HamedMasafi added this to In Progress in Nut Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Nut
  
In Progress
Development

No branches or pull requests

1 participant