needs to be tweaked vs. when ROW NUMBER OVER ORDER BY is being used, but currently
fixes [ticket:436]
self.strings[column] = self.preparer.format_column(column)
else:
if column.table.oid_column is column:
- n = self.dialect.oid_column_name()
+ n = self.dialect.oid_column_name(column)
if n is not None:
self.strings[column] = "%s.%s" % (self.preparer.format_table(column.table, use_schema=False), n)
elif len(column.table.primary_key) != 0:
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
- def oid_column_name(self):
- return "rowid"
+ def oid_column_name(self, column):
+ if not isinstance(column.table, sql.TableClause) and not isinstance(column.table, sql.Select):
+ return None
+ else:
+ return "rowid"
def create_execution_context(self):
return OracleExecutionContext(self)
else:
return self.context.last_inserted_ids
- def oid_column_name(self):
+ def oid_column_name(self, column):
if self.use_oids:
return "oid"
else:
def last_inserted_ids(self):
return self.context.last_inserted_ids
- def oid_column_name(self):
+ def oid_column_name(self, column):
return "oid"
def dbapi(self):
which comes from the types module. Subclasses will usually use the adapt_type()
method in the types module to make this job easy."""
raise NotImplementedError()
- def oid_column_name(self):
- """returns the oid column name for this dialect, or None if the dialect cant/wont support OID/ROWID."""
+ def oid_column_name(self, column):
+ """return the oid column name for this dialect, or None if the dialect cant/wont support OID/ROWID.
+
+ the Column instance which represents OID for the query being compiled is passed, so that the dialect
+ can inspect the column and its parent selectable to determine if OID/ROWID is not selected for a particular
+ selectable (i.e. oracle doesnt support ROWID for UNION, GROUP BY, DISTINCT, etc.)
+ """
raise NotImplementedError()
def supports_sane_rowcount(self):
"""Provided to indicate when MySQL is being used, which does not have standard behavior
if type(typeobj) is type:
typeobj = typeobj()
return typeobj
- def oid_column_name(self):
+ def oid_column_name(self, column):
return None
def supports_sane_rowcount(self):
return True