From a93fbfd616a03ad29afed063fe2763df78b04874 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 2 Mar 2006 04:50:43 +0000 Subject: [PATCH] magic-removal: Removed introspection table_exists() functions -- they weren't being used, and you can just use get_table_list() git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2465 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/ado_mssql/introspection.py | 3 --- django/db/backends/dummy/introspection.py | 1 - django/db/backends/mysql/introspection.py | 12 +----------- django/db/backends/postgresql/introspection.py | 10 ---------- django/db/backends/sqlite3/introspection.py | 10 ---------- 5 files changed, 1 insertion(+), 35 deletions(-) diff --git a/django/db/backends/ado_mssql/introspection.py b/django/db/backends/ado_mssql/introspection.py index 06755ac2ae..b125cc995f 100644 --- a/django/db/backends/ado_mssql/introspection.py +++ b/django/db/backends/ado_mssql/introspection.py @@ -10,7 +10,4 @@ def get_relations(cursor, table_name): def get_indexes(cursor, table_name): raise NotImplementedError -def table_exists(cursor, table_name): - raise NotImplementedError - DATA_TYPES_REVERSE = {} diff --git a/django/db/backends/dummy/introspection.py b/django/db/backends/dummy/introspection.py index f8cc48b23b..c52a812046 100644 --- a/django/db/backends/dummy/introspection.py +++ b/django/db/backends/dummy/introspection.py @@ -4,6 +4,5 @@ get_table_list = complain get_table_description = complain get_relations = complain get_indexes = complain -table_exists = complain DATA_TYPES_REVERSE = {} diff --git a/django/db/backends/mysql/introspection.py b/django/db/backends/mysql/introspection.py index c18f944d3d..fb97bc4368 100644 --- a/django/db/backends/mysql/introspection.py +++ b/django/db/backends/mysql/introspection.py @@ -27,17 +27,7 @@ def get_indexes(cursor, table_name): for row in cursor.fetchall(): indexes[row[4]] = {'primary_key': (row[2] == 'PRIMARY'), 'unique': not bool(row[1])} return indexes - -def table_exists(cursor, table_name): - """Returns True if the given table exists.""" - try: - cursor.execute("SELECT 1 FROM %s LIMIT 1" % quote_name(table_name)) - except: - transaction.rollback_unless_managed() - return False - else: - return True - + DATA_TYPES_REVERSE = { FIELD_TYPE.BLOB: 'TextField', FIELD_TYPE.CHAR: 'CharField', diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py index 99d74e7f40..c4f759da10 100644 --- a/django/db/backends/postgresql/introspection.py +++ b/django/db/backends/postgresql/introspection.py @@ -67,16 +67,6 @@ def get_indexes(cursor, table_name): col_name = desc[int(row[0])-1][0] indexes[col_name] = {'primary_key': row[2], 'unique': row[1]} return indexes - -def table_exists(cursor, table_name): - """Returns True if the given table exists.""" - try: - cursor.execute("SELECT 1 FROM %s LIMIT 1" % quote_name(table_name)) - except: - transaction.rollback_unless_managed() - return False - else: - return True # Maps type codes to Django Field types. DATA_TYPES_REVERSE = { diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index 413e4b958e..c5fa738249 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -15,16 +15,6 @@ def get_relations(cursor, table_name): def get_indexes(cursor, table_name): raise NotImplementedError -def table_exists(cursor, table_name): - """Returns True if the given table exists.""" - try: - cursor.execute("SELECT 1 FROM %s LIMIT 1" % quote_name(table_name)) - except: - transaction.rollback_unless_managed() - return False - else: - return True - # Maps SQL types to Django Field types. Some of the SQL types have multiple # entries here because SQLite allows for anything and doesn't normalize the # field type; it uses whatever was given.