aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/sqlite
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2023-05-01 10:23:53 +0200
committerMarco Bubke <marco.bubke@qt.io>2023-05-09 13:42:31 +0000
commit849b8cf000fa00acaf59209ebf4b00c184f5b1b4 (patch)
tree6fc31cbe7000e79eb457a9fa466e8ba79298ffc1 /src/libs/sqlite
parent5ab0b37ba17919f277a28eab1daea64a3cc22512 (diff)
QmlDesigner: Improve sqlite id
https://www.sqlite.org/autoinc.html says that "If no negative ROWID values are inserted explicitly, then automatically generated ROWID values will always be greater than zero." So zero is an invalid value. This changes reflect on it and makes it an invalid value too. Null is a special value in SQL and it could cast to zero by accident. To prevent that ambiguty we make zero an invalid value too. You can explicit add negative rowids but that has size overhead because positive values can be compressed. So explicit not positive values are not supported. Change-Id: I417ea9fec1573cfd9f1a98134f8adc567021988c Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/libs/sqlite')
-rw-r--r--src/libs/sqlite/sqliteids.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/sqlite/sqliteids.h b/src/libs/sqlite/sqliteids.h
index a0562b4df4..7613a2df46 100644
--- a/src/libs/sqlite/sqliteids.h
+++ b/src/libs/sqlite/sqliteids.h
@@ -63,7 +63,7 @@ public:
#pragma GCC diagnostic pop
#endif
- constexpr bool isValid() const { return id >= 0; }
+ constexpr bool isValid() const { return id > 0; }
explicit operator bool() const { return isValid(); }
@@ -74,7 +74,7 @@ public:
[[noreturn, deprecated]] InternalIntegerType operator&() const { throw std::exception{}; }
private:
- InternalIntegerType id = -1;
+ InternalIntegerType id = 0;
};
template<typename Container>