summaryrefslogtreecommitdiff
path: root/django/db/backends/oracle/introspection.py
diff options
context:
space:
mode:
authorJosh Smeaton <josh.smeaton@gmail.com>2015-02-10 10:54:51 +1100
committerShai Berger <shai@platonix.com>2015-02-10 23:24:34 +0200
commit1fbe8a2de334bfec5e9b77e36f8a3c1cf2cd70be (patch)
tree03e42cd4c487d6ee5952c048df212b1bb49796ce /django/db/backends/oracle/introspection.py
parent1b8af4cfa023161924a45fb572399d2f3071bf5b (diff)
downloaddjango-1fbe8a2de334bfec5e9b77e36f8a3c1cf2cd70be.tar.gz
Fixed #24200 -- Made introspection bypass statement cache
Diffstat (limited to 'django/db/backends/oracle/introspection.py')
-rw-r--r--django/db/backends/oracle/introspection.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/db/backends/oracle/introspection.py b/django/db/backends/oracle/introspection.py
index 3596368b6b..c058418ec3 100644
--- a/django/db/backends/oracle/introspection.py
+++ b/django/db/backends/oracle/introspection.py
@@ -33,6 +33,8 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
except AttributeError:
pass
+ cache_bust_counter = 1
+
def get_field_type(self, data_type, description):
# If it's a NUMBER with scale == 0, consider it an IntegerField
if data_type == cx_Oracle.NUMBER:
@@ -59,7 +61,10 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
def get_table_description(self, cursor, table_name):
"Returns a description of the table, with the DB-API cursor.description interface."
- cursor.execute("SELECT * FROM %s WHERE ROWNUM < 2" % self.connection.ops.quote_name(table_name))
+ self.cache_bust_counter += 1
+ cursor.execute("SELECT * FROM {} WHERE ROWNUM < 2 AND {} > 0".format(
+ self.connection.ops.quote_name(table_name),
+ self.cache_bust_counter))
description = []
for desc in cursor.description:
name = force_text(desc[0]) # cx_Oracle always returns a 'str' on both Python 2 and 3