Skip to content

Connection.execute_immediate does not respect the sql_dialect [PYFB62] #79

Open

Description

@firebird-automations

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()

Activity

  1. firebird-automations commented on Jul 17, 2016

    @firebird-automations
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions