File tree 2 files changed +41
-1
lines changed
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,35 @@ QgsOracleProvider::~QgsOracleProvider()
207
207
disconnectDb ();
208
208
}
209
209
210
+ QString QgsOracleProvider::getWorkspace () const
211
+ {
212
+ return mUri .param ( " dbworkspace" );
213
+ }
214
+
215
+ void QgsOracleProvider::setWorkspace ( const QString &workspace )
216
+ {
217
+ QgsDataSourceUri prevUri ( mUri );
218
+
219
+ disconnectDb ();
220
+
221
+ if ( workspace.isEmpty () )
222
+ mUri .removeParam ( " dbworkspace" );
223
+ else
224
+ mUri .setParam ( " dbworkspace" , workspace );
225
+
226
+ mConnection = QgsOracleConn::connectDb ( mUri );
227
+ if ( !mConnection )
228
+ {
229
+ mUri = prevUri;
230
+ QgsDebugMsg ( QString ( " restoring previous uri:%1" ).arg ( mUri .uri () ) );
231
+ mConnection = QgsOracleConn::connectDb ( mUri );
232
+ }
233
+ else
234
+ {
235
+ setDataSourceUri ( mUri .uri () );
236
+ }
237
+ }
238
+
210
239
QgsAbstractFeatureSource *QgsOracleProvider::featureSource () const
211
240
{
212
241
return new QgsOracleFeatureSource ( this );
@@ -2381,7 +2410,7 @@ bool QgsOracleProvider::getGeometryDetails()
2381
2410
}
2382
2411
2383
2412
if ( exec ( qry, QString ( mUseEstimatedMetadata
2384
- ? " SELECT DISTINCT gtype FROM (SELECT t.%1.sdo_gtype AS gtype FROM %2 t WHERE t.%1 IS NOT NULL AND rownum<1000 ) WHERE rownum<=2"
2413
+ ? " SELECT DISTINCT gtype FROM (SELECT t.%1.sdo_gtype AS gtype FROM %2 t WHERE t.%1 IS NOT NULL AND rownum<100 ) WHERE rownum<=2"
2385
2414
: " SELECT DISTINCT t.%1.sdo_gtype FROM %2 t WHERE t.%1 IS NOT NULL AND rownum<=2" ).arg ( quotedIdentifier ( geomCol ) ).arg ( mQuery ) ) )
2386
2415
{
2387
2416
if ( qry.next () )
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ enum QgsOraclePrimaryKeyType
56
56
class QgsOracleProvider : public QgsVectorDataProvider
57
57
{
58
58
Q_OBJECT
59
+ Q_PROPERTY ( QString workspace READ getWorkspace WRITE setWorkspace )
59
60
60
61
public:
61
62
@@ -283,6 +284,16 @@ class QgsOracleProvider : public QgsVectorDataProvider
283
284
*/
284
285
virtual bool isSaveAndLoadStyleToDBSupported () const override { return true ; }
285
286
287
+ /* *
288
+ * Switch to oracle workspace
289
+ */
290
+ void setWorkspace ( const QString &workspace );
291
+
292
+ /* *
293
+ * Retrieve oracle workspace name
294
+ */
295
+ QString getWorkspace () const ;
296
+
286
297
private:
287
298
QString whereClause ( QgsFeatureId featureId ) const ;
288
299
QString pkParamWhereClause () const ;
You can’t perform that action at this time.
0 commit comments