'Make sure transaction closure is enforced even when the queries are performed
through a single cursor reference retrieved in the beginning
(this is to show why it is wrong to set the transaction dirty only when a cursor
is fetched from the connection).'

@skipUnlessDBFeature('supports_transactions')
def test_reuse_cursor_reference(self):

    @commit_on_success
    def reuse_cursor_ref():
        '\n                                                Fetch    a    cursor,    perform    an    query,    rollback    to    close    the    transaction,\n                                                then    write    a    record    (in    a    new    transaction)    using    the    same    cursor    object\n                                                (reference).    All    this    under    commit_on_success,    so    the    second    insert    should\n                                                be    committed.\n                                                '
        cursor = connection.cursor()
        cursor.execute('INSERT    into    transactions_regress_mod    (id,fld)    values    (1,2)')
        transaction.rollback()
        cursor.execute('INSERT    into    transactions_regress_mod    (id,fld)    values    (1,2)')
    reuse_cursor_ref()
    transaction.rollback()
    try:
        obj = Mod.objects.get(pk=1)
        self.assertEqual(obj.fld, 2)
    except Mod.DoesNotExist:
        self.fail('After    ending    a    transaction,    cursor    use    no    longer    sets    dirty')
