Пример #1
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.curs = self.conn.cursor()
     self.DATE = psycopg2.extensions.PYDATE
     self.TIME = psycopg2.extensions.PYTIME
     self.DATETIME = psycopg2.extensions.PYDATETIME
     self.INTERVAL = psycopg2.extensions.PYINTERVAL
Пример #2
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.curs = self.conn.cursor()
     self.DATE = psycopg2.extensions.PYDATE
     self.TIME = psycopg2.extensions.PYTIME
     self.DATETIME = psycopg2.extensions.PYDATETIME
     self.INTERVAL = psycopg2.extensions.PYINTERVAL
Пример #3
0
    def setUp(self):
        ConnectingTestCase.setUp(self)

        cur = self.conn.cursor()
        cur.execute('''
            CREATE TEMPORARY TABLE table1 (
              id int PRIMARY KEY
            )''')
        self.conn.commit()
Пример #4
0
    def setUp(self):
        ConnectingTestCase.setUp(self)

        cur = self.conn.cursor()
        cur.execute('''
            CREATE TEMPORARY TABLE table1 (
              id int PRIMARY KEY
            )''')
        self.conn.commit()
Пример #5
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     curs = self.conn.cursor()
     try:
         curs.execute("delete from test_with")
         self.conn.commit()
     except psycopg2.ProgrammingError:
         # assume table doesn't exist
         self.conn.rollback()
         curs.execute("create table test_with (id integer primary key)")
         self.conn.commit()
    def setUp(self):
        ConnectingTestCase.setUp(self)

        conn = self.connect()
        cur = conn.cursor()
        try:
            cur.execute("drop table isolevel;")
        except psycopg2.ProgrammingError:
            conn.rollback()
        cur.execute("create table isolevel (id integer);")
        conn.commit()
        conn.close()
Пример #7
0
    def setUp(self):
        ConnectingTestCase.setUp(self)

        self.sync_conn = self.conn
        self.conn = self.connect(async_=True)

        self.wait(self.conn)

        curs = self.conn.cursor()
        curs.execute('''
            CREATE TEMPORARY TABLE table1 (
              id int PRIMARY KEY
            )''')
        self.wait(curs)
Пример #8
0
    def setUp(self):
        ConnectingTestCase.setUp(self)

        self.sync_conn = self.conn
        self.conn = self.connect(async=True)

        self.wait(self.conn)

        curs = self.conn.cursor()
        curs.execute('''
            CREATE TEMPORARY TABLE table1 (
              id int PRIMARY KEY
            )''')
        self.wait(curs)
    def setUp(self):
        ConnectingTestCase.setUp(self)
        from psycopg2cffi.extras import NamedTupleConnection

        try:
            from collections import namedtuple
        except ImportError:
            return

        self.conn = self.connect(connection_factory=NamedTupleConnection)
        curs = self.conn.cursor()
        curs.execute("CREATE TEMPORARY TABLE nttest (i int, s text)")
        curs.execute("INSERT INTO nttest VALUES (1, 'foo')")
        curs.execute("INSERT INTO nttest VALUES (2, 'bar')")
        curs.execute("INSERT INTO nttest VALUES (3, 'baz')")
        self.conn.commit()
Пример #10
0
    def setUp(self):
        os.environ["PGDATESTYLE"] = "sql, mdy"
        
        ConnectingTestCase.setUp(self)

        self.sync_conn = self.conn
        self.conn = self.connect(async_=True)

        self.wait(self.conn)

        curs = self.conn.cursor()
        curs.execute('''
            CREATE TEMPORARY TABLE table1 (
              id int PRIMARY KEY
            )''')
        self.wait(curs)
Пример #11
0
    def setUp(self):
        ConnectingTestCase.setUp(self)
        self.curs = self.conn.cursor()
        self.DATE = psycopg2._psycopg.MXDATE
        self.TIME = psycopg2._psycopg.MXTIME
        self.DATETIME = psycopg2._psycopg.MXDATETIME
        self.INTERVAL = psycopg2._psycopg.MXINTERVAL

        psycopg2.extensions.register_type(self.DATE, self.conn)
        psycopg2.extensions.register_type(self.TIME, self.conn)
        psycopg2.extensions.register_type(self.DATETIME, self.conn)
        psycopg2.extensions.register_type(self.INTERVAL, self.conn)
        psycopg2.extensions.register_type(psycopg2.extensions.MXDATEARRAY, self.conn)
        psycopg2.extensions.register_type(psycopg2.extensions.MXTIMEARRAY, self.conn)
        psycopg2.extensions.register_type(psycopg2.extensions.MXDATETIMEARRAY, self.conn)
        psycopg2.extensions.register_type(psycopg2.extensions.MXINTERVALARRAY, self.conn)
    def setUp(self):
        ConnectingTestCase.setUp(self)
        from psycopg2cffi.extras import NamedTupleConnection

        try:
            from collections import namedtuple
        except ImportError:
            return

        self.conn = self.connect(connection_factory=NamedTupleConnection)
        curs = self.conn.cursor()
        curs.execute("CREATE TEMPORARY TABLE nttest (i int, s text)")
        curs.execute("INSERT INTO nttest VALUES (1, 'foo')")
        curs.execute("INSERT INTO nttest VALUES (2, 'bar')")
        curs.execute("INSERT INTO nttest VALUES (3, 'baz')")
        self.conn.commit()
Пример #13
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.conn.set_isolation_level(ISOLATION_LEVEL_SERIALIZABLE)
     curs = self.conn.cursor()
     curs.execute('''
         CREATE TEMPORARY TABLE table1 (
           id int PRIMARY KEY
         )''')
     # The constraint is set to deferrable for the commit_failed test
     curs.execute('''
         CREATE TEMPORARY TABLE table2 (
           id int PRIMARY KEY,
           table1_id int,
           CONSTRAINT table2__table1_id__fk
             FOREIGN KEY (table1_id) REFERENCES table1(id) DEFERRABLE)''')
     curs.execute('INSERT INTO table1 VALUES (1)')
     curs.execute('INSERT INTO table2 VALUES (1, 1)')
     self.conn.commit()
Пример #14
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.conn.set_isolation_level(ISOLATION_LEVEL_SERIALIZABLE)
     curs = self.conn.cursor()
     curs.execute('''
         CREATE TEMPORARY TABLE table1 (
           id int PRIMARY KEY
         )''')
     # The constraint is set to deferrable for the commit_failed test
     curs.execute('''
         CREATE TEMPORARY TABLE table2 (
           id int PRIMARY KEY,
           table1_id int,
           CONSTRAINT table2__table1_id__fk
             FOREIGN KEY (table1_id) REFERENCES table1(id) DEFERRABLE)''')
     curs.execute('INSERT INTO table1 VALUES (1)')
     curs.execute('INSERT INTO table2 VALUES (1, 1)')
     self.conn.commit()
Пример #15
0
    def setUp(self):
        ConnectingTestCase.setUp(self)
        self.curs = self.conn.cursor()
        self.DATE = psycopg2._psycopg.MXDATE
        self.TIME = psycopg2._psycopg.MXTIME
        self.DATETIME = psycopg2._psycopg.MXDATETIME
        self.INTERVAL = psycopg2._psycopg.MXINTERVAL

        psycopg2.extensions.register_type(self.DATE, self.conn)
        psycopg2.extensions.register_type(self.TIME, self.conn)
        psycopg2.extensions.register_type(self.DATETIME, self.conn)
        psycopg2.extensions.register_type(self.INTERVAL, self.conn)
        psycopg2.extensions.register_type(psycopg2.extensions.MXDATEARRAY,
                                          self.conn)
        psycopg2.extensions.register_type(psycopg2.extensions.MXTIMEARRAY,
                                          self.conn)
        psycopg2.extensions.register_type(psycopg2.extensions.MXDATETIMEARRAY,
                                          self.conn)
        psycopg2.extensions.register_type(psycopg2.extensions.MXINTERVALARRAY,
                                          self.conn)
Пример #16
0
    def setUp(self):
        ConnectingTestCase.setUp(self)

        curs = self.conn.cursor()
        # Drop table if it already exists
        try:
            curs.execute("DROP TABLE table1")
            self.conn.commit()
        except psycopg2.DatabaseError:
            self.conn.rollback()
        try:
            curs.execute("DROP TABLE table2")
            self.conn.commit()
        except psycopg2.DatabaseError:
            self.conn.rollback()
        # Create sample data
        curs.execute("""
            CREATE TABLE table1 (
                id int PRIMARY KEY,
                name text)
        """)
        curs.execute("INSERT INTO table1 VALUES (1, 'hello')")
        curs.execute("CREATE TABLE table2 (id int PRIMARY KEY)")
        self.conn.commit()
Пример #17
0
    def setUp(self):
        ConnectingTestCase.setUp(self)

        curs = self.conn.cursor()
        # Drop table if it already exists
        try:
            curs.execute("DROP TABLE table1")
            self.conn.commit()
        except psycopg2.DatabaseError:
            self.conn.rollback()
        try:
            curs.execute("DROP TABLE table2")
            self.conn.commit()
        except psycopg2.DatabaseError:
            self.conn.rollback()
        # Create sample data
        curs.execute("""
            CREATE TABLE table1 (
                id int PRIMARY KEY,
                name text)
        """)
        curs.execute("INSERT INTO table1 VALUES (1, 'hello')")
        curs.execute("CREATE TABLE table2 (id int PRIMARY KEY)")
        self.conn.commit()
 def setUp(self):
     ConnectingTestCase.setUp(self)
     curs = self.conn.cursor()
     curs.execute("CREATE TEMPORARY TABLE ExtrasDictCursorTests (foo text)")
     curs.execute("INSERT INTO ExtrasDictCursorTests VALUES ('bar')")
     self.conn.commit()
Пример #19
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.conn.set_isolation_level(ISOLATION_LEVEL_SERIALIZABLE)
Пример #20
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.lo_oid = None
     self.tmpdir = None
Пример #21
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self._create_temp_table()
Пример #22
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.conn.set_isolation_level(ISOLATION_LEVEL_SERIALIZABLE)
 def setUp(self):
     ConnectingTestCase.setUp(self)
     curs = self.conn.cursor()
     curs.execute("CREATE TEMPORARY TABLE ExtrasDictCursorTests (foo text)")
     curs.execute("INSERT INTO ExtrasDictCursorTests VALUES ('bar')")
     self.conn.commit()
Пример #24
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self.lo_oid = None
     self.tmpdir = None
Пример #25
0
 def setUp(self):
     self._cb = extensions.get_wait_callback()
     extensions.set_wait_callback(extras.wait_select)
     ConnectingTestCase.setUp(self)
Пример #26
0
 def setUp(self):
     self._cb = extensions.get_wait_callback()
     extensions.set_wait_callback(extras.wait_select)
     ConnectingTestCase.setUp(self)
Пример #27
0
 def setUp(self):
     ConnectingTestCase.setUp(self)
     self._create_temp_table()
Пример #28
0
    def setUp(self):
        ConnectingTestCase.setUp(self)

        self.make_test_table()
        self.clear_test_xacts()