Beispiel #1
0
    def setUp(self):
        self.database = tempfile.mktemp()
        conn = firebirdsql.create_database(
                auth_plugin_name=self.auth_plugin_name,
                wire_crypt=self.wire_crypt,
                host=self.host,
                port=self.port,
                database=self.database,
                user=self.user,
                password=self.password,
                page_size=self.page_size)

        cur = conn.cursor()

        cur.execute('CREATE TABLE test_table (a integer)')
        cur.execute('''
            CREATE TRIGGER trig_test_insert_event
                FOR test_table
                    after insert
            AS BEGIN
                post_event 'event_a';
                post_event 'event_b';
                post_event 'event_c';
                post_event 'event_a';
            END''')
        cur.execute('''
            CREATE TRIGGER trig_test_delete_event
                FOR test_table
                    after delete
            AS BEGIN
                post_event 'event_d';
            END''')
        conn.commit()
        conn.close()
    def setUp(self):
        self.database=tempfile.mktemp()
        conn = firebirdsql.create_database(
                auth_plugin_name=self.auth_plugin_name,
                wire_crypt=self.wire_crypt,
                host=self.host,
                port=self.port,
                database=self.database,
                user=self.user,
                password=self.password,
                page_size=self.page_size)

        cur = conn.cursor()

        cur.execute('CREATE TABLE test_table (a integer)')
        cur.execute('''
            CREATE TRIGGER trig_test_insert_event
                FOR test_table
                    after insert
            AS BEGIN
                post_event 'event_a';
                post_event 'event_b';
                post_event 'event_c';
                post_event 'event_a';
            END''')
        conn.commit()
        conn.close()
Beispiel #3
0
 def setUp(self):
     self.database = tempfile.mktemp()
     self.connection = firebirdsql.create_database(host=self.host,
                                                   port=self.port,
                                                   database=self.database,
                                                   user=self.user,
                                                   password=self.password,
                                                   page_size=self.page_size)
Beispiel #4
0
 def _create_database(self, test_database_name, verbosity):
     conn = Database.create_database(
             host=self.connection.settings_dict['HOST'],
             database=self.connection.settings_dict['NAME'],
             user=self.connection.settings_dict['USER'],
             password=self.connection.settings_dict['PASSWORD'],
             page_size=self.connection.settings_dict.get('PAGE_SIZE', 32768),
     )
     conn.close()
Beispiel #5
0
 def setUp(self):
     self.database=tempfile.mktemp()
     self.connection = firebirdsql.create_database(
             host=self.host,
             port=self.port,
             database=self.database,
             user=self.user,
             password=self.password,
             page_size=self.page_size)
Beispiel #6
0
 def setUp(self):
     self.database = tempfile.mktemp()
     self.connection = firebirdsql.create_database(
         auth_plugin_name=self.auth_plugin_name,
         wire_crypt=self.wire_crypt,
         host=self.host,
         port=self.port,
         database=self.database,
         user=self.user,
         password=self.password,
         page_size=self.page_size)
Beispiel #7
0
 def setUp(self):
     self.database=tempfile.mktemp()
     self.connection = firebirdsql.create_database(
             auth_plugin_name=self.auth_plugin_name,
             wire_crypt=self.wire_crypt,
             host=self.host,
             port=self.port,
             database=self.database,
             user=self.user,
             password=self.password,
             page_size=self.page_size)
Beispiel #8
0
    print(msg)

if __name__ == '__main__':
    if sys.platform in ('win32', 'darwin'):
        fbase = os.path.abspath('.') + '/test'
    else:
        import tempfile
        fbase = tempfile.mktemp()
    TEST_HOST = 'localhost'
    TEST_PORT = 3050
    TEST_DATABASE = fbase + '.fdb'
    TEST_DSN = TEST_HOST + '/' + str(TEST_PORT) + ':' + TEST_DATABASE
    print('dsn=', TEST_DSN)
    TEST_USER = '******'
    TEST_PASS = '******'
    conn = firebirdsql.create_database(dsn=TEST_DSN,
                        user=TEST_USER, password=TEST_PASS, page_size=2<<13)
    conn.cursor().execute('''
        CREATE TABLE foo (
            a INTEGER NOT NULL,
            b VARCHAR(30) NOT NULL UNIQUE,
            c VARCHAR(1024),
            d DECIMAL(16,3) DEFAULT -0.123,
            e DATE DEFAULT '1967-08-11',
            f TIMESTAMP DEFAULT '1967-08-11 23:45:01',
            g TIME DEFAULT '23:45:01',
            h BLOB SUB_TYPE 1, 
            i DOUBLE PRECISION DEFAULT 0.0,
            j FLOAT DEFAULT 0.0,
            PRIMARY KEY (a),
            CONSTRAINT CHECK_A CHECK (a <> 0)
        )
Beispiel #9
0
    if sys.platform in ('win32', 'darwin'):
        fbase = os.path.abspath('.') + '/test'
    else:
        import tempfile
        fbase = tempfile.mktemp()
    TEST_HOST = 'localhost'
    TEST_PORT = 3050
    TEST_DATABASE = fbase + '.fdb'
    TEST_DSN = TEST_HOST + '/' + str(TEST_PORT) + ':' + TEST_DATABASE

    print('dsn=', TEST_DSN)
    TEST_USER = '******'
    TEST_PASS = '******'

    conn = firebirdsql.create_database(dsn=TEST_DSN,
                                       user=TEST_USER,
                                       password=TEST_PASS)
    conn.cursor().execute('''
        CREATE TABLE foo (
            a INTEGER NOT NULL,
            b VARCHAR(30) NOT NULL UNIQUE,
            c VARCHAR(1024),
            d DECIMAL(16,3) DEFAULT -0.123,
            e DATE DEFAULT '1967-08-11',
            f TIMESTAMP DEFAULT '1967-08-11 23:45:01',
            g TIME DEFAULT '23:45:01',
            h BLOB SUB_TYPE 0, 
            i DOUBLE PRECISION DEFAULT 0.0,
            j FLOAT DEFAULT 0.0,
            PRIMARY KEY (a),
            CONSTRAINT CHECK_A CHECK (a <> 0)
Beispiel #10
0
    def setUp(self):
        self.database=tempfile.mktemp()
        self.connection = firebirdsql.create_database(
                host=self.host,
                port=self.port,
                database=self.database,
                user=self.user,
                password=self.password,
                page_size=self.page_size)

        cur = self.connection.cursor()
        cur.execute('''
            CREATE TABLE foo (
                a INTEGER NOT NULL,
                b VARCHAR(30) NOT NULL UNIQUE,
                c VARCHAR(1024),
                d DECIMAL(16,3) DEFAULT -0.123,
                e DATE DEFAULT '1967-08-11',
                f TIMESTAMP DEFAULT '1967-08-11 23:45:01',
                g TIME DEFAULT '23:45:01',
                h BLOB SUB_TYPE 1, 
                i DOUBLE PRECISION DEFAULT 0.0,
                j FLOAT DEFAULT 0.0,
                PRIMARY KEY (a),
                CONSTRAINT CHECK_A CHECK (a <> 0)
            )
        ''')
        cur.execute('''
            CREATE TABLE bar_empty (
                k INTEGER NOT NULL,
                abcdefghijklmnopqrstuvwxyz INTEGER
            )
        ''')
        cur.execute('''
            CREATE PROCEDURE foo_proc
              RETURNS (out1 INTEGER, out2 VARCHAR(30))
              AS
              BEGIN
                out1 = 1;
                out2 = 'ABC';
              END
        ''')
        cur.execute('''
            CREATE PROCEDURE bar_proc (param_a INTEGER, param_b VARCHAR(30))
              RETURNS (out1 INTEGER, out2 VARCHAR(30))
              AS
              BEGIN
                out1 = param_a;
                out2 = param_b;
              END
        ''')
        cur.execute('''
            CREATE PROCEDURE baz_proc(param_a INTEGER)
              RETURNS (out1 INTEGER, out2 VARCHAR(30))
              AS
              BEGIN
                SELECT a, b FROM foo
                  WHERE a= :param_a
                  INTO :out1, :out2;
                SUSPEND;
              END
        ''')
        self.connection.commit()