File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
python/plugins/processing Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,12 @@ def linkTestfile(f, t):
9292 name = vector .ogrLayerName (tmpdir + '|layername=f2|layerid=0' )
9393 self .assertEqual (name , 'f2' ) # layername takes precedence
9494
95+ name = vector .ogrLayerName ('dbname=\' /tmp/x.sqlite\' table="t" (geometry) sql=' )
96+ self .assertEqual (name , 't' )
97+
98+ name = vector .ogrLayerName ('dbname=\' /tmp/x.sqlite\' table="s.t" (geometry) sql=' )
99+ self .assertEqual (name , 's.t' )
100+
95101 def testFeatures (self ):
96102 ProcessingConfig .initialize ()
97103
Original file line number Diff line number Diff line change @@ -513,6 +513,19 @@ def ogrConnectionString(uri):
513513
514514
515515def ogrLayerName (uri ):
516+ if 'host' in uri :
517+ regex = re .compile ('table="(.+?)\.(.+?)"' )
518+ r = regex .search (uri )
519+ return '"' + r .groups ()[0 ] + '.' + r .groups ()[1 ] + '"'
520+ elif 'dbname' in uri :
521+ regex = re .compile ('table="(.+?)"' )
522+ r = regex .search (uri )
523+ return r .groups ()[0 ]
524+ elif 'layername' in uri :
525+ regex = re .compile ('(layername=)([^|]*)' )
526+ r = regex .search (uri )
527+ return r .groups ()[1 ]
528+
516529 fields = uri .split ('|' )
517530 ogruri = fields [0 ]
518531 fields = fields [1 :]
You can’t perform that action at this time.
0 commit comments