Skip to content

Commit

Permalink
Fix unreported bug in ORACLE provider
Browse files Browse the repository at this point in the history
Error in spatial index exists check.
  • Loading branch information
elpaso committed Jul 6, 2021
1 parent 7460e4f commit a3b9ced
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/providers/oracle/qgsoracleconn.cpp
Expand Up @@ -1015,6 +1015,10 @@ QString QgsOracleConn::getSpatialIndexName( const QString &ownerName, const QStr
isValid = true;
}
}
else
{
isValid = false;
}
}
else
{
Expand Down
11 changes: 9 additions & 2 deletions tests/src/python/test_qgsproviderconnection_base.py
Expand Up @@ -273,11 +273,18 @@ def _test_operations(self, md, conn):

# Test column names
res = conn.execSql(sql)
self.assertEqual(res.rowCount(), 1)

row_count = res.rowCount()
# Some providers do not support rowCount and return -1
if row_count != -1:
self.assertEqual(row_count, 1)

rows = res.rows()
self.assertEqual(rows, [['QGIS Rocks - \U0001f604', 666, 1.234, 1234, expected_date, QtCore.QDateTime(2019, 7, 8, 12, 0, 12)]])
self.assertEqual(res.columns(), ['string_t', 'long_t', 'double_t', 'integer_t', 'date_t', 'datetime_t'])

self.assertEqual(res.fetchedRowCount(), 1)

# Test iterator
old_rows = rows
res = conn.execSql(sql)
Expand Down Expand Up @@ -348,7 +355,7 @@ def _test_operations(self, md, conn):

# Spatial index
spatial_index_exists = False
# we don't initially know if a spatial index exists -- some formats may create them by default, others not
# we don't initially know if a spatial index exists -- some formats may create them by default, others don't
if capabilities & QgsAbstractDatabaseProviderConnection.SpatialIndexExists:
spatial_index_exists = conn.spatialIndexExists(schema, self.myNewTable, self.geometryColumnName)
if capabilities & QgsAbstractDatabaseProviderConnection.DeleteSpatialIndex:
Expand Down

0 comments on commit a3b9ced

Please sign in to comment.