From 12ad272f91f6300d1ed1c875cd5dea78ed6f8d85 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 4 Jun 2010 15:26:50 +0800 Subject: [PATCH] SQL.py - Add functions for listing indexes. Not used anywhere - may be a good reference at some point --- pyfpdb/SQL.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index deb9d527..37d214ff 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -51,6 +51,18 @@ class Sql: WHERE type='table' ORDER BY name;""" + ################################ + # List indexes + ################################ + if db_server == 'mysql': + self.query['list_tables'] = """SHOW INDEXES""" + elif db_server == 'postgresql': + self.query['list_tables'] = """SELECT tablename, indexname FROM PG_INDEXES""" + elif db_server == 'sqlite': + self.query['list_tables'] = """SELECT name FROM sqlite_master + WHERE type='index' + ORDER BY name;""" + ################################################################## # Drop Tables - MySQL, PostgreSQL and SQLite all share same syntax ##################################################################