149 Commits

Author SHA1 Message Date
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
Nyall Dawson
1969e09b6f Also avoid detaching QgsFields and QgsAttributes where possible 2015-10-20 20:36:08 +11:00
Nyall Dawson
5ed3d1b73f Use QString::arg multi argument method to avoid extra heap allocations 2015-10-15 17:51:06 +11:00
Nyall Dawson
f628ebd423 Replace foreach with Q_FOREACH
For:
- consistency
- to make it immediately clear that this is a Qt macro and that it
works slightly differently to c++ for loops
2015-09-09 19:17:29 +10:00
Matthias Kuhn
5be0ee734f Remove QgsFeatureRequest::FilterRect from providers/iterators 2015-07-29 12:09:44 +02:00
Matthias Kuhn
156a0e9184 Preserve 0 values from postgres int columns 2015-07-13 09:48:12 +02:00
Juergen E. Fischer
90b3efb93d postgres provider: also cast geography to geometry when using && (fixes #8572) 2015-06-26 16:55:51 +02:00
Matthias Kuhn
038f99b505 Reduce warning noise and fix some doxymentation issues
Some warnings are wrapped in Q_NOWARN_DEPRECATED_*, these are warnings for
issues which are not critical and therefore of limited importance.

The general idea is to leave the space for compiler warnings to the one that
really need to be addressed.

Also removes a no longer required header file of dxflib.

Exposes some ready-to use doxymentation by wrapping it in appropriate comment
structure.

And some more cleanup
2015-06-15 18:42:27 +02:00
Marco Hugentobler
abe9fd0399 Move more wkb type code to QgsWKBTypes. Fix possibility to load curved geometries into QGIS 2015-05-29 10:56:46 +02:00
Martin Dobias
ed65181031 Fix identify tool for PostGIS 1.x layers
curvetoline() function was expected, however:
- in PostGIS < 1.5 such function does not exist
- in PostGIS >=1.5 the function is st_curvetoline()
2015-05-27 21:25:14 +07:00
Juergen E. Fischer
98c601d1ba fix typos 2015-05-25 20:12:02 +02:00
Juergen E. Fischer
5b3a96d9d6 geometry fixes:
* 3d geometries from oracle
* windows build
2015-05-25 16:54:23 +02:00
Marco Hugentobler
68fe5f5791 [FEATURE:] New geometry classes 2015-05-25 08:53:49 +02:00
Juergen E. Fischer
cec5bdeb0d fix some warnings 2015-05-24 18:48:22 +02:00
Matthias Kuhn
a2ae8b4e38 Add unit tests for postgres provider
basically to get a framework to test the expression compiler
2015-05-22 11:57:16 +02:00
Matthias Kuhn
a99deb8b88 [FEATURE] Send filter expressions to postgres provider
This commit allows to filter features already on server side. Only supported
expressions will be sent to the database. Expressions using unsupported
operators or functions will gracefully fallback to local evaluation.

To make use of this feature

 * Enable it in options: data sources
 * QgsFeatureRequest().setFilterExpression( expression )
 * or QgsVectorLayer::getFeatures( expression )
2015-05-22 11:57:16 +02:00
Nyall Dawson
9076ff8d71 Fix some deprecated warnings 2015-05-21 00:56:03 +10:00
Sandro Santilli
449094829a Add support for Pointcloud layers 2015-05-06 22:25:44 +02:00
Juergen E. Fischer
97572244dc postgres provider: also apply filterWhereClause to feature iterators (fixes #12499 & #12500) 2015-04-02 17:47:08 +02:00
Juergen E. Fischer
f17755cec4 indentation update 2015-03-19 22:58:11 +01:00
Sandro Santilli
472fbbed49 Use ST_Force2D from PostGIS-2.1.0 up 2015-03-03 18:26:59 +01:00
Nyall Dawson
c253a9f623 Uninitialized variable fixes 2015-02-10 22:23:01 +11:00
Sandro Mani
40ad3b0993 [FEATURE]: Transactional editing for postgres layers (other datasources possible in the future). Funded by City of Uster 2015-01-19 15:22:20 +01:00