Skip to content

Changed where condition of createbasequery and extended timeout of re… - #20

Open
lendrom wants to merge 1 commit into
geometalab:betafrom
lendrom:beta
Open

Changed where condition of createbasequery and extended timeout of re…#20
lendrom wants to merge 1 commit into
geometalab:betafrom
lendrom:beta

Conversation

@lendrom

@lendrom lendrom commented May 21, 2017

Copy link
Copy Markdown

…quests

Changed 'where' condition from "where":"objectid=objectid" to "where":"1=1" in createBaseQuery method of EsriVectorQueryFactoy. There is a possiblity that table or feature layer's physical structure in the database does not have a field named literally 'objectid'. One example could be query layers published by AGS or external origin tables registered with geodatabase (there are cases, when the field will be named OBJECTID_1 or that some existing column name other than objectid will be used). I'm not sure what is the 'right' way to check the name of a field that has role of objectid but if someone needs to use objectid field name in query, there are several ways to check it . For example, fields that play a role of objectidfield have type set to 'esriFieldTypeOID'. Queries for 'returnIdsOnly' also return property: 'objectIdFieldName', so it could be obtained by querying with 'returnIdsOnly' and where='1=2'.

In createBaseQuery method case there's no need to look for objectid field name as 'objectid=objectid' is only an 'empty' condition. The condition "1=1" is more general and should be equally suitable.

http://desktop.arcgis.com/en/arcmap/10.3/manage-data/using-sql-with-gdbs/object-id.htm

Timeout for queries also changed from 10 to 60 seconds.

…quests

Changed 'where' condition from "where":"objectid=objectid" to "where":"1=1" in createBaseQuery method of EsriVectorQueryFactoy. There is a possiblity that table or feature layer's physical structure in the database does not have a field named literally 'objectid'. One example could be query layers published by AGS or external origin tables registered with geodatabase (there are cases, when the field will be named OBJECTID_1 or that some existing column name other than objectid will be used). I'm not sure what is the 'right' way to check the name of a field that has role of objectid but if someone needs to use objectid field name in query, there are several ways to check it . For example, fields that play a role of objectidfield have type set to 'esriFieldTypeOID'. Queries for 'returnIdsOnly' also return property: 'objectIdFieldName', so it could be obtained by querying with 'returnIdsOnly' and where='1=2'.

In createBaseQuery method case there's no need to look for objectid field name as 'objectid=objectid' is only an 'empty' condition. The condition "1=1"  is more general and should be equally suitable.

http://desktop.arcgis.com/en/arcmap/10.3/manage-data/using-sql-with-gdbs/object-id.htm

Timeout for queries also changed from 10 to 60 seconds.
@sfkeller

sfkeller commented May 21, 2017

Copy link
Copy Markdown

Changes seem to be sensible! Many thanks!
I can merge your pull request but it needs some time to be released over at plugins.qgis.org.
In addition I'd like to combine next release with some other small possible changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants