Skip to content

Commit 915006f

Browse files
committed
Additional types for Firebird
I'd missed these in my original PR. Additionally, this marks blobs of the text subtype as such and as there's the possibility of additional types being added in future that the adapter doesn't know about, it now prints 'UNKNOWN' for unknown types. I'm working on getting the timezone test working properly, but currently it's crashing with an assertion error from within the driver.
1 parent a132802 commit 915006f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • sqlit/domains/connections/providers/firebird

sqlit/domains/connections/providers/firebird/adapter.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,13 @@ def get_trigger_definition(
273273
13: "TIME",
274274
14: "CHAR",
275275
16: "BIGINT",
276+
23: "BOOLEAN",
277+
24: "DECFLOAT(16)",
278+
25: "DECFLOAT(34)",
279+
26: "INT128",
276280
27: "DOUBLE PRECISION",
281+
28: "TIME WITH TIME ZONE",
282+
29: "TIMESTAMP WITH TIME ZONE",
277283
35: "TIMESTAMP",
278284
37: "VARCHAR",
279285
261: "BLOB",
@@ -302,7 +308,7 @@ def get_columns(
302308

303309
# Find the fields themselves.
304310
cursor.execute(
305-
"SELECT rf.rdb$field_name, f.rdb$field_type, f.rdb$character_length "
311+
"SELECT rf.rdb$field_name, f.rdb$field_type, f.rdb$character_length, f.rdb$field_sub_type "
306312
"FROM rdb$relation_fields AS rf "
307313
"JOIN rdb$fields AS f ON f.rdb$field_name = rf.rdb$field_source "
308314
"WHERE rdb$relation_name = ? "
@@ -313,8 +319,10 @@ def get_columns(
313319
for row in cursor.fetchall():
314320
if row[1] in [14, 37]: # CHAR, VARCHAR
315321
data_type = f"{self._types[row[1]]}({row[2]})"
322+
if row[1] == 261 and row[3] == 1:
323+
data_type = "BLOB (text)"
316324
else:
317-
data_type = self._types[row[1]]
325+
data_type = self._types.get(row[1], "UNKNOWN")
318326
name = row[0].rstrip()
319327
columns.append(ColumnInfo(name=name, data_type=data_type, is_primary_key=name in pk_fields))
320328
return columns

0 commit comments

Comments
 (0)