Skip to content

Commit 634c51b

Browse files
committed
Merge branch 'master' into v3.5.x
2 parents 76f900b + d0f3de3 commit 634c51b

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

src/sqlitedb.cpp

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -565,24 +565,32 @@ QString DBBrowserDB::emptyInsertStmt(const sqlb::Table& t, int pk_value) const
565565
QStringList vals;
566566
QStringList fields;
567567
foreach(sqlb::FieldPtr f, t.fields()) {
568-
if( f->primaryKey() && f->isInteger() )
569-
{
570-
fields << f->name();
571-
572-
if(pk_value != -1)
573-
vals << QString::number(pk_value);
574-
else
568+
if(f->primaryKey()) {
569+
if(f->isInteger())
575570
{
576-
if(f->notnull())
577-
{
578-
int64_t maxval = this->max(t, f);
579-
vals << QString::number(maxval + 1);
580-
}
571+
fields << f->name();
572+
573+
if(pk_value != -1)
574+
vals << QString::number(pk_value);
581575
else
582576
{
583-
vals << "NULL";
577+
if(f->notnull())
578+
{
579+
int64_t maxval = this->max(t, f);
580+
vals << QString::number(maxval + 1);
581+
}
582+
else
583+
{
584+
vals << "NULL";
585+
}
584586
}
585587
}
588+
else
589+
{
590+
fields << f->name();
591+
592+
vals << "''";
593+
}
586594
} else if(f->notnull() && f->defaultValue().length() == 0) {
587595
fields << f->name();
588596

0 commit comments

Comments
 (0)