121 Commits

Author SHA1 Message Date
Nyall Dawson
47ffb588fe Fix some providers not requesting all required attributes needed
for client side order by clauses
2017-05-26 08:06:13 +10:00
Nyall Dawson
3584a5f914 Nicer initialization of members in iterators/sources 2017-04-24 08:59:32 +10:00
Mathieu Pellerin
1ca73f4f29 harmonize all providers to use lowercase qgis as settings key (#4252)
(fixes ArcGisRest browser / connection dialog)
2017-03-13 15:07:16 +07:00
Nyall Dawson
fbe4be884b Dynamically adjust postgres feature queue size
Lower the default queue size, but automatically adjust it
based on how long each fetch takes. This change keeps fetching
responsive even for slow connections or databases. The current
approach with a fixed queue size can result in very slow feature
fetching, which prevents UI updates for multiple seconds.
2017-03-05 08:47:32 +10:00
Juergen E. Fischer
a10c890383 More QgsSettings updates:
* revives WMS
* QgsSettings::clear() added
* section added to QgsSettings::contains()
* type parameter added to sip binding of QgsSettings.value()
* TODO: customization & evis
2017-03-04 02:37:59 +01:00
Denis Rouzaud
2e7de50b42 run astyle on src/* 2017-03-03 09:09:37 +01:00
Nyall Dawson
b5480633e4 Standardise names for static variables
All non-const variables are prefixed with "s", all const
statics are ALL_CAPS
2017-01-14 16:40:24 +10:00
Denis Rouzaud
4467487e1c respect CamelCase for enums and their values 2017-01-11 14:10:11 +01:00
Nyall Dawson
e656c63ab7 Remove duplicate QgsFeature::setFeatureId method
Leave just QgsFeature::setId and document api break
2017-01-11 10:05:31 +01:00
Harrissou Sant-anna
ef85cdcf83 Replace "eg" by "e.g." or "for example" 2016-12-30 00:03:22 +01:00
Nyall Dawson
4166a3ea62 Fix most clazy qstring-unneeded-heap-allocations warnings
By flipping string literals to QStringLiteral/QLatin1String

see

https://woboq.com/blog/qstringliteral.html
2016-10-24 15:26:24 +10:00
Matthias Kuhn
b6779f63ff Rename QgsFields::fieldNameIndex() to lookupField()
To have two clearly different names for tolerant/intolerant index lookup
2016-10-01 15:39:03 +02:00
Patrick Valsecchi
abc55f4c42 Add support for arrays in PostgresQL
Fix parsing of PostgresQL hstore. Had problems when the key or values were
containing comas.
2016-09-12 10:33:00 +02:00
Martin Dobias
46f7c644da Fix postgres pkey map in Qt5 (fixes #15223)
Switching from QVariant to QVariantList solves the underlying Qt issue:
- comparison of QVariantList objects works fine
- comparison of QVariantList objects wrapped in QVariant does not work

The extra wrapping of QVariantList into another QVariant seems unnecessary anyway,
so we may as well save a tiny bit of memory and cpu
2016-08-11 17:10:57 +02:00
Nyall Dawson
ed4d34fdbc QgsFields returns QgsField value instead of const references
(since QgsField is implicitly shared)
2016-08-05 06:08:07 +10:00
Matthias Kuhn
bb79d13e82 Remove deprecated Qgis::WKBType and API cleanup (#3325)
* Remove deprecated Qgis::WKBType and API cleanup

Renames QgsWKBTypes to QgsWkbTypes

Replaces usage of the enums:

* Qgis::WKBType with QgsWkbTypes::Type
* Qgis::GeometryType with QgsWkbTypes::GeometryType

Their values should be forward compatible (a fact that was already
explited up to now by casting between the types)

Renames some SSLxxx to SslXxx and URIxxx to UriXxx

* Fix build warnings and simplify type handling

* Add a fixer to rewrite imports

* The forgotten rebase conflictThe forgotten rebase conflicts

* QgsDataSourcURI > QgsDataSourceUri

* QgsWKBTypes > QgsWkbTypes

* Qgis.WKBGeom > QgsWkbTypes.Geom

* Further python fixes

* Guess what... Qgis::wkbDimensions != QgsWkbTypes::wkbDimensions

* Fix tests

* Python 3 updates

* [travis] pull request caching cannot be disabled

so at least use it in r/w mode

* Fix python3 print in plugins
2016-08-04 09:10:08 +02:00
Nyall Dawson
bd7d913379 Refine QgsFeature geometry getters/setters
All pointer based methods have been removed.

Now we have only:

  void setGeometry( const QgsGeometry& geom )

and

  QgsGeometry geometry() const

Benefits include avoiding a whole lot of tricky pointer lifetime
issues, potential memory leaks, and finally closing #777, which
has survived for over 9 years!...

Impacts on PyQGIS code:
- no more need for the messy
  g = QgsGeometry( feature.geometry() )
  workaround, just use g = feature.geometry() instead
- IMPORTANT: you can no longer test whether a feature has geometry
 using `if f.geometry():`, since QgsFeature::geometry() will
 *always* return an object. Instead, use
 `if not f.geometry().isEmpty():`, or preferably the new method
 `if not f.hasGeometry():`

Fix #777
2016-08-01 16:25:46 +10:00
Nyall Dawson
aceddae65a QgsFeature cleanup, part 1
Deprecate some QgsFeature methods which take or return pointers,
update other classes as required
2016-07-31 21:23:07 +10:00
Nyall Dawson
1a2231f10c Rename QGis class to Qgis, for capitalisation consistency 2016-07-21 22:01:38 +10:00
Nyall Dawson
df0d5969aa Fix virtual fields which depend on other virtual fields may not be
calculated in some circumstances (fix #14939)
2016-06-10 11:18:25 +10:00
Sandro Santilli
9a96414444 Fix storing attribute of feature with negative identifier and test
The test was also bogus in that it expected an inappropriate FID.
2016-06-09 11:48:30 +02:00
Sandro Santilli
92dda429d0 Do not loose signed semantic on converting int32 pk to fid
Fixes again editing of features with negative identifiers.
Now a test fails, but it is the test being broken this time
(testSignedIdentifiers). The test was added as part of
2bd7f446b4dd368968f23b990262c5e8a5a83f80, which fixed a crash
when using signed identifiers.
2016-06-09 11:48:29 +02:00
Sandro Santilli
e763b41c08 Use FidMap for int64 primary keys
Also rename pktInt64 to pktUint64, in case we'll be able to know
in advance the database contains only positive integers (not
implemented in this commit).
2016-06-09 11:48:29 +02:00
Sandro Santilli
a7a0eefe72 Support negative short integer primary keys on PostgreSQL
See http://hub.qgis.org/issues/14262

NOTE: signed int64 keys would still fail
2016-06-09 11:48:28 +02:00
Marco Hugentobler
0aec8e9892 Postgres simplification does not work with curved types 2016-05-27 14:38:42 +02:00
Nyall Dawson
858914eef5 Ensure that providers fetch geometry for a QgsFeatureRequest
with an expression filter which requires geometry
2016-05-16 23:09:18 +10:00
Nyall Dawson
92a18087b3 Add safeguard tests to ensure no regressions in expression compilation
(ie check that expressions are successfully compiled where expected)

Add compilation support for "NOT..." type expressions
2016-04-15 07:52:02 +10:00
Matthias Kuhn
2e515a2ccc [postgres] Avoid deadlocks in transactional editing
Can currently be triggered by using the field calculator to update a selection.
While an iterator is active and the connection is locked, an update statement
waits unsuccessfully for the same (locked) connection.

This commit only locks the connection while an iterator is actually fetching
data and not for its entire lifetime.
2016-04-14 09:39:51 +02:00
Nyall Dawson
402ee9d4cf Fix missing features when combining FilterExpression requests with
subsets of attributes and the filter expression requires fields
which are not included in the attribute subset

Note: I've only fixed the providers which implement the vector
provider conformance unit tests. Other providers (eg GRASS) should
also implement a similar fix.
2016-03-30 16:31:55 +11:00
Nyall Dawson
4825856fd7 Fix provider ordering by test to correctly also test compiled order by
...and as a result, disable compiled order by support for postgres
due to bugs exposed by the test
2016-01-31 20:42:11 +11:00
Larry Shaffer
e7a1e2c2ec Clean up with prepare commit script 2016-01-13 21:29:09 +01:00
Luigi Pirelli
68478a7363 [auth] PKI support to postgres provider 2016-01-13 21:26:52 +01:00
Matthias Kuhn
168c6f70bc Rename OrderBys -> OrderBy and OrderBy -> OrderByClause
And some sip fixes
2015-12-22 09:12:32 +01:00
Matthias Kuhn
3dc832a32b Don't crash providers when destrucing with fake open connection 2015-12-22 09:12:32 +01:00
Nyall
dbb0919749 Handle order by parsing failures in postgres provider 2015-12-21 10:49:18 +11:00
Nyall Dawson
ec35dbee92 Fix some warnings when building with clang and -Weverything 2015-12-20 21:43:51 +11:00
Matthias Kuhn
e555323f34 Add compiler setting check to order by compilation 2015-12-18 18:38:18 +01:00
Matthias Kuhn
c0f2b29017 Compile order by for postgres 2015-12-18 18:36:44 +01:00
Nyall Dawson
18614e11e3 Avoid container detachments by using const methods wherever possible
eg QList::at() instead of QList:[], constFind instead of find, ...
2015-12-16 20:15:46 +11:00
Nyall Dawson
576875e998 Followup 320c696 use clang-modernize to replace 0/NULL use with nullptr 2015-12-15 11:24:51 +11:00
Nyall Dawson
89b9b67974 Handle type conversion failures for compiled expressions 2015-12-10 20:49:17 +11:00
Nyall Dawson
9cc9d424ce Add extra check for deprecations to documentation test
This check tests that if a function has been declared deprecated
with either Q_DECL_DEPRECATED or has a @deprecated Doxygen note
then it MUST have both the Q_DECL_DEPRECATD and @deprecated note.

It's important that both are used, as Q_DECL_DEPRECATED allows
throwing a warning if that method is used in code, while the
@deprecated doxygen note gives an indication to devs/PyQGIS users
of why it's deprecated and what should be used instead.

Ideally we'd also test for SIP /Deprecated/ tags, but I can't
find any reliable way to do this.
2015-12-07 21:55:36 +11:00
Nyall Dawson
edb16d0014 [FEATURE] Feature limit support for feature requests
Limits the maximum number of features returned by the iterator.
Some providers (postgres, spatialite, MS SQL) pass the limit on
to the provider to result in faster queries.
2015-12-05 10:24:42 +11:00
Michael Douchin
706e651484 Postgresql provider - Use postgis 2.2 ST_RemoveRepeatedPoints for simplification 2015-12-01 14:31:53 +01:00
Nyall Dawson
91571736a8 Make expression compilation optional, but enabled by default
Remove the previous postgres specific option and replace with an
enabled-by-default option which applies to all expression
compilation.
2015-11-18 15:16:38 +11:00
Nyall Dawson
5f65f872dd Create QgsSqlExpressionCompiler as base class for expression compilers
Switch Postgres and OGR compilers to use the new base class. New class
should make it easier to add additional expression compilers (eg
spatialite, MS SQL, etc)
2015-11-18 14:02:18 +11:00
Juergen E. Fischer
04abaf3bfa fix 81bbb82 2015-11-10 21:31:22 +00:00
Juergen E. Fischer
81bbb8235c postgres provider: avoid additional fetch after all features have already been processed 2015-11-10 12:26:38 +00:00
Nyall Dawson
b7e1cae4f0 Switch double quoted single character to single quotes for some
QString methods

Using single quotes is a significant performance boost. Rough
benchmarks indicate the QString single quote methods take
about 15% of the time the double quote variants take.
2015-11-02 17:55:08 +11:00
Hugo Mercier
c7aeb774ce PostGIS: Allow to load TIN, PS and Triangle layers
The postgres provider is modified so that layers with
TIN, PolyhedralSurface and Triangle geometries can be loaded.
Geometries are converted to MultiPolygons (and Polygons for Triangles).

The postgres test is completed to cover the loading of different types
of layers
2015-10-21 09:41:49 +02:00