Mercurial > p > roundup > code
comparison roundup/backends/back_mysql.py @ 2077:3e0961d6d44d
Added the "actor" property.
Metakit backend not done (still not confident I know how it's supposed
to work ;)
Currently it will come up as NULL in the RDBMS backends for older items.
The *dbm backends will look up the journal. I hope to remedy the former
before 0.7's release.
Fixed a bunch of migration issues in the rdbms backends while I was at it
(index changes for key prop changes) and simplified the class table update
code for RDBMSes that have "alter table" in their command set (ie. not
sqlite) ... migration from "version 1" to "version 2" still hasn't
actually been tested yet though.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 15 Mar 2004 05:50:20 +0000 |
| parents | b1704ba7be41 |
| children | c091cacdc505 |
comparison
equal
deleted
inserted
replaced
| 2076:2a4309450202 | 2077:3e0961d6d44d |
|---|---|
| 126 self.cursor.execute('CREATE INDEX otks_key_idx ON otks(otk_key)') | 126 self.cursor.execute('CREATE INDEX otks_key_idx ON otks(otk_key)') |
| 127 self.cursor.execute('CREATE TABLE sessions (s_key VARCHAR(255), ' | 127 self.cursor.execute('CREATE TABLE sessions (s_key VARCHAR(255), ' |
| 128 's_last_use FLOAT(20), s_user VARCHAR(255))') | 128 's_last_use FLOAT(20), s_user VARCHAR(255))') |
| 129 self.cursor.execute('CREATE INDEX sessions_key_idx ON sessions(s_key)') | 129 self.cursor.execute('CREATE INDEX sessions_key_idx ON sessions(s_key)') |
| 130 | 130 |
| 131 def add_actor_column(self): | |
| 132 # update existing tables to have the new actor column | |
| 133 tables = self.database_schema['tables'] | |
| 134 for name in tables.keys(): | |
| 135 self.cursor.execute('ALTER TABLE _%s add __actor ' | |
| 136 'VARCHAR(255)'%name) | |
| 137 | |
| 131 def __repr__(self): | 138 def __repr__(self): |
| 132 return '<myroundsql 0x%x>'%id(self) | 139 return '<myroundsql 0x%x>'%id(self) |
| 133 | 140 |
| 134 def sql_fetchone(self): | 141 def sql_fetchone(self): |
| 135 return self.cursor.fetchone() | 142 return self.cursor.fetchone() |
| 238 continue | 245 continue |
| 239 index_sql = 'drop index %s on %s'%(index_name, table_name) | 246 index_sql = 'drop index %s on %s'%(index_name, table_name) |
| 240 if __debug__: | 247 if __debug__: |
| 241 print >>hyperdb.DEBUG, 'drop_index', (self, index_sql) | 248 print >>hyperdb.DEBUG, 'drop_index', (self, index_sql) |
| 242 self.cursor.execute(index_sql) | 249 self.cursor.execute(index_sql) |
| 250 | |
| 251 def drop_class_table_key_index(self, cn, key): | |
| 252 table_name = '_%s'%cn | |
| 253 index_name = '_%s_%s_idx'%(cn, key) | |
| 254 if not self.sql_index_exists(table_name, index_name): | |
| 255 return | |
| 256 sql = 'drop index %s on %s'%(index_name, table_name) | |
| 257 if __debug__: | |
| 258 print >>hyperdb.DEBUG, 'drop_index', (self, sql) | |
| 259 self.cursor.execute(sql) | |
| 243 | 260 |
| 244 class MysqlClass: | 261 class MysqlClass: |
| 245 # we're overriding this method for ONE missing bit of functionality. | 262 # we're overriding this method for ONE missing bit of functionality. |
| 246 # look for "I can't believe it's not a toy RDBMS" below | 263 # look for "I can't believe it's not a toy RDBMS" below |
| 247 def filter(self, search_matches, filterspec, sort=(None,None), | 264 def filter(self, search_matches, filterspec, sort=(None,None), |
