Skip to content

Commit

Permalink
Merge branch 'master' into v3.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rp- committed Jan 30, 2015
2 parents 76f900b + d0f3de3 commit 634c51b
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/sqlitedb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,24 +565,32 @@ QString DBBrowserDB::emptyInsertStmt(const sqlb::Table& t, int pk_value) const
QStringList vals;
QStringList fields;
foreach(sqlb::FieldPtr f, t.fields()) {
if( f->primaryKey() && f->isInteger() )
{
fields << f->name();

if(pk_value != -1)
vals << QString::number(pk_value);
else
if(f->primaryKey()) {
if(f->isInteger())
{
if(f->notnull())
{
int64_t maxval = this->max(t, f);
vals << QString::number(maxval + 1);
}
fields << f->name();

if(pk_value != -1)
vals << QString::number(pk_value);
else
{
vals << "NULL";
if(f->notnull())
{
int64_t maxval = this->max(t, f);
vals << QString::number(maxval + 1);
}
else
{
vals << "NULL";
}
}
}
else
{
fields << f->name();

vals << "''";
}
} else if(f->notnull() && f->defaultValue().length() == 0) {
fields << f->name();

Expand Down

0 comments on commit 634c51b

Please sign in to comment.