Skip to content

Commit 83db9ac

Browse files
committed
Refine DECFLOAT skip logic to check protocol version
1 parent bf52708 commit 83db9ac

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

test/decfloat-integration.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,22 @@ describe('DECFLOAT Support Integration (Firebird 4.0+)', () => {
1717
beforeAll(async () => {
1818
try {
1919
db = await fromCallback(cb => Firebird.attach(config, cb));
20-
// Check if server supports DECFLOAT types
21-
await fromCallback(cb => db.query('SELECT CAST(123.45 AS DECFLOAT(16)) FROM RDB$DATABASE', cb));
22-
supportsDecFloat = true;
23-
} catch (err) {
24-
console.warn('Firebird server does not support DECFLOAT types, skipping integration tests.');
25-
if (db) {
26-
await fromCallback(cb => db.detach(cb));
27-
db = null;
20+
const protocolVersion = db.connection.accept.protocolVersion;
21+
22+
// DECFLOAT is available from Protocol 16 (Firebird 4.0)
23+
if (protocolVersion >= 16) {
24+
try {
25+
// Check if server supports DECFLOAT types
26+
await fromCallback(cb => db.query('SELECT CAST(123.45 AS DECFLOAT(16)) FROM RDB$DATABASE', cb));
27+
supportsDecFloat = true;
28+
} catch (err) {
29+
console.warn('Firebird server reported protocol >= 16 but DECFLOAT cast failed, skipping.');
30+
}
31+
} else {
32+
console.warn('Firebird server protocol < 16, skipping DECFLOAT integration tests.');
2833
}
34+
} catch (err) {
35+
console.warn('Could not connect to Firebird server, skipping DECFLOAT integration tests.');
2936
}
3037
});
3138

0 commit comments

Comments
 (0)