fdb icon indicating copy to clipboard operation
fdb copied to clipboard

Connection.execute_immediate does not respect the sql_dialect [PYFB62]

Open firebird-automations opened this issue 9 years ago • 1 comments

Submitted by: Lele Gaifax (lelit)

Votes: 1

Is there a reason why the execute_immediate() method on the connection does not respect the connection's dialect?

Here is a simple test script:

import unittest import fdb

class FDBTestCase(unittest.TestCase): DB = '/tmp/fdb_test.fdb' USER = 'lele' PASSWORD = 'lele' DIALECT = 3

def setUp\(self\):
    try:
        c = fdb\.connect\(self\.DB, user=self\.USER, password=self\.PASSWORD,
                        sql\_dialect=self\.DIALECT\)
    except:
        pass
    else:
        c\.drop\_database\(\)

    self\.conn = fdb\.create\_database\("create database '\{\}'"
                                    " user '\{\}'"
                                    " password '\{\}'"
                                    \.format\(self\.DB, self\.USER, self\.PASSWORD\),
                                    sql\_dialect=self\.DIALECT\)

def tearDown\(self\):
    self\.conn\.close\(\)

class TestDialect(FDBTestCase): def testDialect(self): self.assertEqual(self.conn.monitor.db.sql_dialect, self.DIALECT)

class TestExecuteImmediate(FDBTestCase): def testCreate(self): self.conn.execute_immediate('recreate table t (d date)') self.conn.commit()

class TestCursorExecute(FDBTestCase): def testCreate(self): cur = self.conn.cursor() cur.execute('recreate table t (d date)') self.conn.commit()

if __name__ == '__main__': unittest.main()

firebird-automations avatar Jan 22 '16 10:01 firebird-automations

Commented by: Paulo Freitas (paulofreitas)

Seems to be the same issue I got here: PYFB38

Currently I'm using fdb 1.6 and I still can't use BIGINT datatype using the connection.execute_immediate() method. I moved on and switched to use a cursor and call the cursor.execute() method, this way everything works fine.

firebird-automations avatar Jul 17 '16 12:07 firebird-automations