- New DBAPI support for pymysql, a pure Python port
of MySQL-python. [ticket:1991]
+- firebird
+ - Some adjustments so that Interbase is supported as well.
+ FB/Interbase version idents are parsed into a structure
+ such as (8, 1, 1, 'interbase') or (2, 1, 588, 'firebird')
+ so they can be distinguished. [ticket:1885]
+
- drizzle
- New dialect for Drizzle, a MySQL variant. Uses MySQL-python
for the DBAPI. [ticket:2003]
ibm-db_ thirdparty thirdparty thirdparty thirdparty thirdparty thirdparty
**Drizzle**
mysql-python_ ``drizzle+mysqldb``\* yes development no yes yes
-**Firebird**
+**Firebird / Interbase**
kinterbasdb_ ``firebird+kinterbasdb``\* yes development no yes yes
**Informix**
informixdb_ ``informix+informixdb``\* yes development no unknown unknown
def initialize(self, connection):
super(FBDialect, self).initialize(connection)
- self._version_two = self.server_version_info > (2, )
+ self._version_two = ('firebird' in self.server_version_info and \
+ self.server_version_info >= (2, )
+ ) or \
+ ('interbase' in self.server_version_info and \
+ self.server_version_info >= (6, )
+ )
+
if not self._version_two:
# TODO: whatever other pre < 2.0 stuff goes here
self.ischema_names = ischema_names.copy()
def get_columns(self, connection, table_name, schema=None, **kw):
# Query to extract the details of all the fields of the given table
tblqry = """
- SELECT DISTINCT r.rdb$field_name AS fname,
+ SELECT r.rdb$field_name AS fname,
r.rdb$null_flag AS null_flag,
t.rdb$type_name AS ftype,
f.rdb$field_sub_type AS stype,
'type' : coltype,
'nullable' : not bool(row['null_flag']),
'default' : defvalue,
- 'autoincrement':default is None
+ 'autoincrement':defvalue is None
}
if orig_colname.lower() == orig_colname:
FBCompiler, FBExecutionContext
from sqlalchemy import util, types as sqltypes
from sqlalchemy.util.compat import decimal
+from re import match
+
class _FBNumeric_kinterbasdb(sqltypes.Numeric):
def bind_processor(self, dialect):
# that for backward compatibility reasons returns a string like
# LI-V6.3.3.12981 Firebird 2.0
# where the first version is a fake one resembling the old
- # Interbase signature. This is more than enough for our purposes,
- # as this is mainly (only?) used by the testsuite.
-
- from re import match
+ # Interbase signature.
fbconn = connection.connection
version = fbconn.server_version
- m = match('\w+-V(\d+)\.(\d+)\.(\d+)\.(\d+) \w+ (\d+)\.(\d+)', version)
+
+ return self._parse_version_info(version)
+
+ def _parse_version_info(self, version):
+ m = match('\w+-V(\d+)\.(\d+)\.(\d+)\.(\d+)( \w+ (\d+)\.(\d+))?', version)
if not m:
raise AssertionError(
"Could not determine version from string '%s'" % version)
- return tuple([int(x) for x in m.group(5, 6, 4)])
+
+ if m.group(5) != None:
+ return tuple([int(x) for x in m.group(6, 7, 4)] + ['firebird'])
+ else:
+ return tuple([int(x) for x in m.group(1, 2, 3)] + ['interbase'])
def is_disconnect(self, e):
if isinstance(e, (self.dbapi.OperationalError,
select([func.count(t.c.id)], func.length(t.c.name)
== 5).execute().first()[0] == 1
- def test_server_version_info(self):
- version = testing.db.dialect.server_version_info
- assert len(version) == 3, 'Got strange version info: %s' \
- % repr(version)
+ def test_version_parsing(self):
+ for string, result in [
+ ("WI-V1.5.0.1234 Firebird 1.5", (1, 5, 1234, 'firebird')),
+ ("UI-V6.3.2.18118 Firebird 2.1", (2, 1, 18118, 'firebird')),
+ ("LI-V6.3.3.12981 Firebird 2.0", (2, 0, 12981, 'firebird')),
+ ("WI-V8.1.1.333", (8, 1, 1, 'interbase')),
+ ("WI-V8.1.1.333 Firebird 1.5", (1, 5, 333, 'firebird')),
+ ]:
+ eq_(
+ testing.db.dialect._parse_version_info(string),
+ result
+ )
@testing.provide_metadata
def test_rowcount_flag(self):