Пример #1
0
        def setUp(self):
            # Create a second connection to the database
            self.conn2 = backend.DatabaseWrapper(**settings.DATABASE_OPTIONS)

            # Put both DB connections into managed transaction mode
            transaction.enter_transaction_management()
            transaction.managed(True)
Пример #2
0
def run_writedata(index=0):
    from django.db import backend
    connection = backend.DatabaseWrapper(**settings.DATABASE_OPTIONS)
    q = queqe_server()
    cursor = connection.cursor()
    print "-----------------------Start Writedata %s" % index
    parseLogDataInFile(connection, cursor)
    try:
        cursor.close()
        connection.close()
    except:
        pass
    q.connection.disconnect()
    print "-----------------------End Writedata %s" % index
Пример #3
0
    def setUp(self):
        # Create a second connection to the default database
        conn_settings = settings.DATABASES[DEFAULT_DB_ALIAS]
        self.conn2 = backend.DatabaseWrapper({
            'HOST': conn_settings['HOST'],
            'NAME': conn_settings['NAME'],
            'OPTIONS': conn_settings['OPTIONS'],
            'PASSWORD': conn_settings['PASSWORD'],
            'PORT': conn_settings['PORT'],
            'USER': conn_settings['USER'],
            'TIME_ZONE': settings.TIME_ZONE,
        })

        # Put both DB connections into managed transaction mode
        transaction.enter_transaction_management()
        transaction.managed(True)
        self.conn2._enter_transaction_management(True)
Пример #4
0
        def setUp(self):
            # Create a second connection to the database
            self.conn2 = backend.DatabaseWrapper({
                'DATABASE_HOST':
                settings.DATABASE_HOST,
                'DATABASE_NAME':
                settings.DATABASE_NAME,
                'DATABASE_OPTIONS':
                settings.DATABASE_OPTIONS,
                'DATABASE_PASSWORD':
                settings.DATABASE_PASSWORD,
                'DATABASE_PORT':
                settings.DATABASE_PORT,
                'DATABASE_USER':
                settings.DATABASE_USER,
                'TIME_ZONE':
                settings.TIME_ZONE,
            })

            # Put both DB connections into managed transaction mode
            transaction.enter_transaction_management()
            transaction.managed(True)
            self.conn2._enter_transaction_management(True)