Mercurial > p > roundup > code
comparison roundup/backends/back_sqlite.py @ 1906:f255363e6d97
PostgreSQL backend lands.
- that's the postgresql backend in (cleaned up doc, unit testing harness and
the backend module itself)
- also cleaned up the index maintenance code (actual checks for existence
rather than bare-except failure mode)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 11 Nov 2003 11:19:18 +0000 |
| parents | 94e430ad4fdb |
| children | f5c804379c85 |
comparison
equal
deleted
inserted
replaced
| 1905:dc43e339e607 | 1906:f255363e6d97 |
|---|---|
| 1 # $Id: back_sqlite.py,v 1.10 2003-10-07 07:17:54 anthonybaxter Exp $ | 1 # $Id: back_sqlite.py,v 1.11 2003-11-11 11:19:18 richard Exp $ |
| 2 __doc__ = ''' | 2 __doc__ = ''' |
| 3 See https://pysqlite.sourceforge.net/ for pysqlite info | 3 See https://pysqlite.sourceforge.net/ for pysqlite info |
| 4 ''' | 4 ''' |
| 5 import base64, marshal | 5 import base64, marshal |
| 6 from roundup.backends.rdbms_common import * | 6 from roundup.backends.rdbms_common import * |
| 104 self.conn.commit() | 104 self.conn.commit() |
| 105 except sqlite.DatabaseError, error: | 105 except sqlite.DatabaseError, error: |
| 106 if str(error) != 'cannot commit - no transaction is active': | 106 if str(error) != 'cannot commit - no transaction is active': |
| 107 raise | 107 raise |
| 108 | 108 |
| 109 def sql_index_exists(self, table_name, index_name): | |
| 110 self.cursor.execute('pragma index_list(%s)'%table_name) | |
| 111 for entry in self.cursor.fetchall(): | |
| 112 if entry[1] == index_name: | |
| 113 return 1 | |
| 114 return 0 | |
| 115 | |
| 109 def save_dbschema(self, schema): | 116 def save_dbschema(self, schema): |
| 110 ''' Save the schema definition that the database currently implements | 117 ''' Save the schema definition that the database currently implements |
| 111 ''' | 118 ''' |
| 112 s = repr(self.database_schema) | 119 s = repr(self.database_schema) |
| 113 self.sql('insert into schema values (%s)', (s,)) | 120 self.sql('insert into schema values (%s)', (s,)) |
