Hi Médéric, and Hi devs,

Thanks for the code. I have tested it and created a pull-request.
https://github.com/qgis/QGIS/pull/2668

I'd like to know who is in charged to review DB manager Oracle plugin to assigne it

If it is good, i'll merge it and cherry-pick it to 2.12.

Regards,

Le 13/01/2016 10:18, Médéric Ribreux a écrit :
Le 2016-01-06 12:40, René-Luc Dhont a écrit :
Hi devs,

A customer and I have some troubles with "DB Manager" and "Oracle".
Every times we load an SQL query to layer, we get the log message:
* No key field for query given

To verify where the issue comes from, I wrote n python script to test
loading an SQL query to layer with a keyColumn specified. I can load
the SQL query.

I'd like to know if others have the same issue ?

I didn't know about QStandardItemModel, and I do'nt know if
`uniqueFieldName =
self.uniqueModel.item(self.uniqueCombo.currentIndex()).data()` well
gets defined primary key in dlg_sql_window.sql

Regards,
René-Luc

_______________________________________________
Qgis-developer mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Hello René-Luc,

I have made some tests and found this bug too...
The main problem is that self.uniqueModel is filled with quoted column names. For Oracle provider, giving a quoted uniqueColumn in a uri to create a QgsVectorLayer results in an invalid layer.
If you remove the quotes, the layer becomes valid.

The problem doesn't occur with geomFieldName because for this ComboBox, we use currentText() to grab the column name (geom column is then unquoted).

I can make a pull request for DBManager Oracle Plugin with the following modification in plugin.py: uri.setDataSource(u"", u"({})".format(sql), geomCol, filter, uniqueCol.strip(u'"'))
instead of
uri.setDataSource(u"", u"({})".format(sql), geomCol, filter, uniqueCol)

to deal with quote deletion. I can't find another quick and clean way to do it...

What do you (devs) think ?


_______________________________________________
Qgis-developer mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to