From 7d85d7a41bf31c686fba697d4c4107cf7eebbda5 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Thu, 1 Aug 2019 14:07:47 +0200 Subject: [PATCH] Correctly detect numbers up to 64 bits when detecting data type This fixes commit 74e0df376a2c12093d3c9524cfa02752cda31481 for integers and floats of more than 32 bits length. See comment by @mgrojo here: https://github.com/sqlitebrowser/sqlitebrowser/commit/74e0df376a2c12093d3c9524cfa02752cda31481#r34532732 --- src/sqlitedb.cpp | 2 +- src/sqlitetablemodel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sqlitedb.cpp b/src/sqlitedb.cpp index e1fe1443..a4d0c7fa 100644 --- a/src/sqlitedb.cpp +++ b/src/sqlitedb.cpp @@ -1444,7 +1444,7 @@ bool DBBrowserDB::updateRecord(const sqlb::ObjectIdentifier& table, const std::s if(sqlite3_bind_blob(stmt, 1, rawValue, value.length(), SQLITE_STATIC)) success = -1; } else if(force_type == SQLITE_INTEGER) { - if(sqlite3_bind_int(stmt, 1, value.toInt())) + if(sqlite3_bind_int64(stmt, 1, value.toLongLong())) success = -1; } else if(force_type == SQLITE_FLOAT) { if(sqlite3_bind_double(stmt, 1, value.toDouble())) diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp index 86bc7203..a98bc857 100644 --- a/src/sqlitetablemodel.cpp +++ b/src/sqlitetablemodel.cpp @@ -475,7 +475,7 @@ bool SqliteTableModel::setTypedData(const QModelIndex& index, bool isBlob, const type = SQLITE_BLOB; } else if(m_vDataTypes.at(column) == SQLITE_INTEGER) { bool ok; - newValue.toInt(&ok); + newValue.toLongLong(&ok); if(ok) type = SQLITE_INTEGER; } else if(m_vDataTypes.at(column) == SQLITE_FLOAT) {