From a54a34f8f1accaa34df7ec14959fa9847e2b9309 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 1 Jan 2006 21:17:34 +0000 Subject: [PATCH] factoring out mysql's rowid stuff since its down in the base engine class now --- lib/sqlalchemy/databases/mysql.py | 20 +------------------- lib/sqlalchemy/databases/sqlite.py | 3 +++ lib/sqlalchemy/engine.py | 2 +- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index 9f8bb8a122..4e43f36730 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -100,14 +100,6 @@ class MySQLEngine(ansisql.ANSISQLEngine): def last_inserted_ids(self): return self.context.last_inserted_ids - def rowid_column_name(self): - """returns the ROWID column name for this engine.""" - - # well, for MySQL cant really count on this being there, surprise (not). - # so we do some silly hack down below in MySQLTableImpl to provide - # something for an OID column - return "_rowid" - def supports_sane_rowcount(self): return False @@ -153,17 +145,7 @@ class MySQLTableImpl(sql.TableImpl): """attached to a schema.Table to provide it with a Selectable interface as well as other functions """ - def _rowid_col(self): - if getattr(self, '_mysql_rowid_column', None) is None: - if len(self.table.primary_key) > 0: - c = self.table.primary_key[0] - else: - c = self.table.columns[self.table.columns.keys()[0]] - self._mysql_rowid_column = schema.Column(c.name, c.type, hidden=True) - self._mysql_rowid_column._set_parent(self.table) - - return self._mysql_rowid_column - rowid_column = property(lambda s: s._rowid_col()) + pass class MySQLCompiler(ansisql.ANSICompiler): def limit_clause(self, select): diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py index 0288beae89..5a143a201c 100644 --- a/lib/sqlalchemy/databases/sqlite.py +++ b/lib/sqlalchemy/databases/sqlite.py @@ -107,6 +107,9 @@ class SQLiteSQLEngine(ansisql.ANSISQLEngine): def last_inserted_ids(self): return self.context.last_inserted_ids + def rowid_column_name(self): + return "oid" + def connect_args(self): return ([self.filename], self.opts) diff --git a/lib/sqlalchemy/engine.py b/lib/sqlalchemy/engine.py index 68cf089315..07574a260a 100644 --- a/lib/sqlalchemy/engine.py +++ b/lib/sqlalchemy/engine.py @@ -260,7 +260,7 @@ class SQLEngine(schema.SchemaEngine): def rowid_column_name(self): """returns the ROWID column name for this engine, or None if the engine cant/wont support OID/ROWID.""" - return "oid" + return None def supports_sane_rowcount(self): """Provided to indicate when MySQL is being used, which does not have standard behavior -- 2.47.2