Skip to content

Commit 7a71eea

Browse files
committed
#864 Increase default and maximum SQL info sizes
1 parent 207ebc9 commit 7a71eea

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

jaybird-native/src/main/java/org/firebirdsql/gds/ng/jna/JnaStatement.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: Copyright 2014-2024 Mark Rotteveel
1+
// SPDX-FileCopyrightText: Copyright 2014-2025 Mark Rotteveel
22
// SPDX-FileCopyrightText: Copyright 2018 Artyom Smirnov
33
// SPDX-FileCopyrightText: Copyright 2019 Vasiliy Yashkov
44
// SPDX-License-Identifier: LGPL-2.1-or-later
@@ -439,14 +439,13 @@ public byte[] getSqlInfo(byte[] requestItems, int bufferLength) throws SQLExcept
439439

440440
@Override
441441
public int getDefaultSqlInfoSize() {
442-
// TODO Test for an optimal buffer size
443442
return getMaxSqlInfoSize();
444443
}
445444

446445
@Override
447446
public int getMaxSqlInfoSize() {
448-
// TODO Is this the actual max, or is it 65535?
449-
return 32767;
447+
// Theoretically, also Firebird 2.1, but not supported since before Jaybird 5
448+
return getDatabase().getServerVersion().isEqualOrAbove(2, 5) ? 65535 : 32767;
450449
}
451450

452451
@Override

src/main/org/firebirdsql/gds/ng/wire/version10/V10Statement.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: Copyright 2013-2024 Mark Rotteveel
1+
// SPDX-FileCopyrightText: Copyright 2013-2025 Mark Rotteveel
22
// SPDX-FileCopyrightText: Copyright 2019 Vasiliy Yashkov
33
// SPDX-License-Identifier: LGPL-2.1-or-later
44
package org.firebirdsql.gds.ng.wire.version10;
@@ -635,13 +635,11 @@ protected void processAllocateResponse(GenericResponse response) throws SQLExcep
635635

636636
@Override
637637
public int getDefaultSqlInfoSize() {
638-
// TODO Test for an optimal buffer size
639638
return getMaxSqlInfoSize();
640639
}
641640

642641
@Override
643642
public int getMaxSqlInfoSize() {
644-
// TODO Is this the actual max for the v10 protocol, or is it 65535?
645643
return 32767;
646644
}
647645
}

src/main/org/firebirdsql/gds/ng/wire/version12/V12Statement.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: Copyright 2014-2017 Mark Rotteveel
1+
// SPDX-FileCopyrightText: Copyright 2014-2025 Mark Rotteveel
22
// SPDX-License-Identifier: LGPL-2.1-or-later
33
package org.firebirdsql.gds.ng.wire.version12;
44

@@ -20,4 +20,10 @@ public V12Statement(FbWireDatabase database) {
2020
super(database);
2121
}
2222

23+
@Override
24+
public int getMaxSqlInfoSize() {
25+
// Theoretically, also protocol 11 (Firebird 2.1), but not supported since before Jaybird 5
26+
return 65535;
27+
}
28+
2329
}

src/main/org/firebirdsql/gds/ng/wire/version13/V13Statement.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-FileCopyrightText: Copyright 2015 Hajime Nakagami
2-
// SPDX-FileCopyrightText: Copyright 2015-2023 Mark Rotteveel
2+
// SPDX-FileCopyrightText: Copyright 2015-2025 Mark Rotteveel
33
// SPDX-License-Identifier: LGPL-2.1-or-later
44
package org.firebirdsql.gds.ng.wire.version13;
55

@@ -84,4 +84,17 @@ protected void writeSqlData(XdrOutputStream xdrOut, BlrCalculator blrCalculator,
8484
}
8585
}
8686
}
87+
88+
@Override
89+
public int getDefaultSqlInfoSize() {
90+
return 512 * 1024;
91+
}
92+
93+
@Override
94+
public int getMaxSqlInfoSize() {
95+
// It can be higher: 0xFFFE_FFFF serverside, and Integer.MAX_VALUE - 8 due to Java array size limitations
96+
// 16 MiB is probably already excessive
97+
return 16 * 1024 * 1024;
98+
}
99+
87100
}

0 commit comments

Comments
 (0)