|
@@ -143,6 +143,13 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|
def date_interval_sql(self, timedelta):
|
|
def date_interval_sql(self, timedelta):
|
|
return 'INTERVAL %s MICROSECOND' % duration_microseconds(timedelta)
|
|
return 'INTERVAL %s MICROSECOND' % duration_microseconds(timedelta)
|
|
|
|
|
|
|
|
+ def fetch_returned_insert_rows(self, cursor):
|
|
|
|
+ """
|
|
|
|
+ Given a cursor object that has just performed an INSERT...RETURNING
|
|
|
|
+ statement into a table, return the tuple of returned data.
|
|
|
|
+ """
|
|
|
|
+ return cursor.fetchall()
|
|
|
|
+
|
|
def format_for_duration_arithmetic(self, sql):
|
|
def format_for_duration_arithmetic(self, sql):
|
|
return 'INTERVAL %s MICROSECOND' % sql
|
|
return 'INTERVAL %s MICROSECOND' % sql
|
|
|
|
|
|
@@ -173,6 +180,19 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|
def random_function_sql(self):
|
|
def random_function_sql(self):
|
|
return 'RAND()'
|
|
return 'RAND()'
|
|
|
|
|
|
|
|
+ def return_insert_columns(self, fields):
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if not fields:
|
|
|
|
+ return '', ()
|
|
|
|
+ columns = [
|
|
|
|
+ '%s.%s' % (
|
|
|
|
+ self.quote_name(field.model._meta.db_table),
|
|
|
|
+ self.quote_name(field.column),
|
|
|
|
+ ) for field in fields
|
|
|
|
+ ]
|
|
|
|
+ return 'RETURNING %s' % ', '.join(columns), ()
|
|
|
|
+
|
|
def sql_flush(self, style, tables, sequences, allow_cascade=False):
|
|
def sql_flush(self, style, tables, sequences, allow_cascade=False):
|
|
|
|
|
|
|
|
|