Bug report #6235
Problem with primary keys in MSSQL provider
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Tamas Szekeres | ||
Category: | Data Provider/MSSQL | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | all | Easy fix?: | No |
Pull Request or Patch supplied: | Yes | Resolution: | fixed |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 15544 |
Description
Table has bigint primary key. When loading it to QGIS all field values are displayed as "ERROR", but identify tool works fine. Also table reports correct number of features and field types detected correctly. Seems this related with possible integer overflow in nextFeature() method (line 523).
From Qt docsWarning: If the value is convertible to a LongLong but is too large to be represented in an int, the resulting arithmetic overflow will not be reflected in ok. A simple workaround is to use QString::toInt(). Fixing this bug has been postponed to Qt 5 in order to avoid breaking existing code.
Here is simple patch that should fix it
Associated revisions
History
#1 Updated by Alexander Bruy over 12 years ago
- Category changed from Data Provider to Data Provider/MSSQL
#2 Updated by Evgeniy Nikulin about 12 years ago
I tried the patch on qgis trunk (Fedora 17 x86_64) and MS SQL Server 2008 - it works. My tables with bigint keys well displayed in the table of attributes.
#3 Updated by Alexander Bruy about 12 years ago
- Status changed from Open to Closed
Fixed in changeset a21ad0f7a19cce63529e561581f293159c0bec2c.
#4 Updated by Alexander Bruy about 12 years ago
- Resolution set to fixed