File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,20 @@ def testConnect(self):
109
109
pass
110
110
self .assertFalse (connection_succeeded , 'exception should have been raised' )
111
111
112
+ def testExecuteRegExp (self ):
113
+ """This test checks for REGEXP syntax support, which is enabled in Qgis.utils' spatialite_connection()"""
114
+
115
+ connection_name = 'testListLayer'
116
+ plugin = createDbPlugin ('spatialite' )
117
+ uri = QgsDataSourceUri ()
118
+ uri .setDatabase (self .test_spatialite )
119
+ self .assertTrue (plugin .addConnection (connection_name , uri ))
120
+
121
+ connection = createDbPlugin ('spatialite' , connection_name )
122
+ connection .connect ()
123
+ db = connection .database ()
124
+ db .connector ._execute (None , 'SELECT \' ABC\' REGEXP \' [CBA]\' ' )
125
+
112
126
def testListLayer (self ):
113
127
connection_name = 'testListLayer'
114
128
plugin = createDbPlugin ('spatialite' )
Original file line number Diff line number Diff line change @@ -701,6 +701,16 @@ def testCreateAttributeIndex(self):
701
701
self .assertEqual (set (indexed_columns ), set (['name' , 'number' ]))
702
702
con .close ()
703
703
704
+ def testSubsetStringRegexp (self ):
705
+ """Check that the provider supports the REGEXP syntax"""
706
+
707
+ testPath = "dbname=%s table='test_filter' (geometry) key='id'" % self .dbname
708
+ vl = QgsVectorLayer (testPath , 'test' , 'spatialite' )
709
+ self .assertTrue (vl .isValid ())
710
+ vl .setSubsetString ('"name" REGEXP \' [txe]\' ' )
711
+ self .assertEqual (vl .featureCount (), 4 )
712
+ del (vl )
713
+
704
714
def testSubsetStringExtent_bug17863 (self ):
705
715
"""Check that the extent is correct when applied in the ctor and when
706
716
modified after a subset string is set """
You can’t perform that action at this time.
0 commit comments