mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	Merge pull request #38940 from elpaso/bugfix-gh38092-executesql-feedback-followup
Be smart when adding limit: followup #8092
This commit is contained in:
		
						commit
						063b8daab3
					
				@ -121,7 +121,8 @@ class CursorAdapter():
 | 
			
		||||
            uri = QgsDataSourceUri(self.connection.uri())
 | 
			
		||||
 | 
			
		||||
            # TODO: make this part provider-agnostic
 | 
			
		||||
            uri.setTable('(SELECT row_number() OVER () AS __rid__, * FROM (' + self.sql + ' LIMIT 1) as foo)')
 | 
			
		||||
            sql = self.sql if self.sql.upper().find(' LIMIT ') >= 0 else self.sql + ' LIMIT 1 '
 | 
			
		||||
            uri.setTable('(SELECT row_number() OVER () AS __rid__, * FROM (' + sql + ') as foo)')
 | 
			
		||||
            uri.setKeyColumn('__rid__')
 | 
			
		||||
            # TODO: fetch provider name from connection (QgsAbstractConnectionProvider)
 | 
			
		||||
            # TODO: re-use the VectorLayer for fetching rows in batch mode
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user