Made psycopg2 backend actually support dictfetch* methods.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3727 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6f87b17a0d
commit
6152b325aa
|
@ -68,23 +68,9 @@ def quote_name(name):
|
||||||
return name # Quoting once is enough.
|
return name # Quoting once is enough.
|
||||||
return '"%s"' % name
|
return '"%s"' % name
|
||||||
|
|
||||||
def dictfetchone(cursor):
|
dictfetchone = util.dictfetchone
|
||||||
"Returns a row from the cursor as a dict"
|
dictfetchmany = util.dictfetchmany
|
||||||
# TODO: cursor.dictfetchone() doesn't exist in psycopg2,
|
dictfetchall = util.dictfetchall
|
||||||
# but no Django code uses this. Safe to remove?
|
|
||||||
return cursor.dictfetchone()
|
|
||||||
|
|
||||||
def dictfetchmany(cursor, number):
|
|
||||||
"Returns a certain number of rows from a cursor as a dict"
|
|
||||||
# TODO: cursor.dictfetchmany() doesn't exist in psycopg2,
|
|
||||||
# but no Django code uses this. Safe to remove?
|
|
||||||
return cursor.dictfetchmany(number)
|
|
||||||
|
|
||||||
def dictfetchall(cursor):
|
|
||||||
"Returns all rows from a cursor as a dict"
|
|
||||||
# TODO: cursor.dictfetchall() doesn't exist in psycopg2,
|
|
||||||
# but no Django code uses this. Safe to remove?
|
|
||||||
return cursor.dictfetchall()
|
|
||||||
|
|
||||||
def get_last_insert_id(cursor, table_name, pk_name):
|
def get_last_insert_id(cursor, table_name, pk_name):
|
||||||
cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name))
|
cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name))
|
||||||
|
|
Loading…
Reference in New Issue