12 | * This interface allows checks for features of the Firebird client API.
13 | *
14 | *
15 | * @author Mark Rotteveel
16 | * @since 4.0
17 | */
18 | @InternalApi
19 | public interface FbClientFeatureAccess {
20 |
21 | /**
22 | * Checks for presence of a client feature.
23 | *
24 | * @param clientFeature Client feature
25 | * @return {@code true} if the feature is present, {@code false} otherwise
26 | */
27 | boolean hasFeature(FbClientFeature clientFeature);
28 |
29 | /**
30 | * @return an unmodifiable set with supported client features
31 | */
32 | Set getFeatures();
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/jaybird-native/src/main/java/org/firebirdsql/gds/ng/jna/NativeLibraryLoadException.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2019-2023 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.gds.ng.jna;
4 |
5 | /**
6 | * Thrown when a native library could not be loaded.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 4.0
10 | */
11 | public class NativeLibraryLoadException extends RuntimeException {
12 |
13 | public NativeLibraryLoadException(String message, Throwable cause) {
14 | super(message, cause);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/jaybird-native/src/main/java/org/firebirdsql/gds/ng/jna/NativePropertyNames.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2023-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.gds.ng.jna;
4 |
5 | /**
6 | * Property names which are exclusively for use with jaybird-native.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 6
10 | */
11 | @SuppressWarnings("java:S115")
12 | public final class NativePropertyNames {
13 |
14 | // NOTE: Only used/works for first native or embedded connection
15 | public static final String nativeLibraryPath = "nativeLibraryPath";
16 |
17 | private NativePropertyNames() {
18 | // no instances
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/jaybird-native/src/main/java/org/firebirdsql/gds/ng/jna/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Implementation of the {@code org.firebirdsql.gds.ng} API for accessing Firebird using fbclient (native and embedded),
5 | * using the JNA (Java Native Access) library.
6 | *
7 | * @since 3
8 | */
9 | @InternalApi
10 | package org.firebirdsql.gds.ng.jna;
11 |
12 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/jaybird-native/src/main/java/org/firebirdsql/jna/embedded/classpath/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Supporting classes for implementations of {@link org.firebirdsql.jna.embedded.spi} to provide Firebird Embedded on
5 | * the classpath.
6 | *
7 | * @since 5
8 | */
9 | package org.firebirdsql.jna.embedded.classpath;
--------------------------------------------------------------------------------
/jaybird-native/src/main/java/org/firebirdsql/jna/embedded/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Provides look up of Firebird Embedded library SPIs as defined by {@link org.firebirdsql.jna.embedded.spi}.
5 | *
6 | * @since 5
7 | */
8 | package org.firebirdsql.jna.embedded;
--------------------------------------------------------------------------------
/jaybird-native/src/main/java/org/firebirdsql/jna/embedded/spi/DisposableFirebirdEmbeddedLibrary.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2020-2023 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jna.embedded.spi;
4 |
5 | /**
6 | * Firebird Embedded library that needs to be disposed on exit.
7 | *
8 | * This can be used for additional cleanup on exit.
9 | *
10 | *
11 | * @author Mark Rotteveel
12 | * @since 5
13 | */
14 | public interface DisposableFirebirdEmbeddedLibrary extends FirebirdEmbeddedLibrary {
15 |
16 | /**
17 | * Will be called by the native resource tracker (if enabled) on exit of the JVM.
18 | *
19 | * Implementations that need to delete files from the file system should take into account the possibility that
20 | * files cannot be deleted on exit, and should try to apply a strategy to cleanup old files on the next run.
21 | *
10 | * It is recommend to implement {@link DisposableFirebirdEmbeddedLibrary} for implementations that require additional
11 | * cleanup on exit.
12 | *
13 | *
14 | * @author Mark Rotteveel
15 | * @since 5
16 | */
17 | public interface FirebirdEmbeddedLibrary {
18 |
19 | /**
20 | * @return Path of the Firebird Embedded main library file
21 | */
22 | Path getEntryPointPath();
23 |
24 | /**
25 | * Version of the Firebird Embedded library.
26 | *
27 | * @return Version of the Firebird Embedded library
28 | * @see FirebirdEmbeddedLibrary#getVersion()
29 | */
30 | String getVersion();
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/jaybird-native/src/main/java/org/firebirdsql/jna/embedded/spi/FirebirdEmbeddedLoadingException.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2020-2023 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jna.embedded.spi;
4 |
5 | /**
6 | * Exception to signal errors when loading or identifying a Firebird Embedded library.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 5
10 | */
11 | public class FirebirdEmbeddedLoadingException extends Exception {
12 |
13 | private static final long serialVersionUID = 1L;
14 |
15 | public FirebirdEmbeddedLoadingException(String message) {
16 | super(message);
17 | }
18 |
19 | public FirebirdEmbeddedLoadingException(String message, Throwable cause) {
20 | super(message, cause);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/jaybird-native/src/main/java/org/firebirdsql/jna/embedded/spi/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2020-2023 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Defines a service provider interface to obtain Firebird Embedded library files from the class path.
5 | *
6 | * See also {@link org.firebirdsql.jna.embedded.spi.FirebirdEmbeddedProvider}.
7 | *
6 | * It is possible — but considered internal API — to define and override encodings by providing
7 | * an implementation of the {@link org.firebirdsql.encodings.EncodingSet} SPI. See that class for details.
8 | *
9 | *
10 | * @since 3
11 | */
12 | @InternalApi
13 | package org.firebirdsql.encodings;
14 |
15 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/event/DatabaseEvent.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2005 Gabriel Reid
2 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later
4 | package org.firebirdsql.event;
5 |
6 | /**
7 | * An interface for retrieving information about events that have occurred
8 | *
9 | * @author Gabriel Reid
10 | */
11 | public interface DatabaseEvent {
12 |
13 | /**
14 | * Get the name of the event that occurred.
15 | *
16 | * @return The event name
17 | */
18 | String getEventName();
19 |
20 | /**
21 | * Get the number of times the event occurred.
22 | *
23 | * @return The number of times the event occurred
24 | */
25 | int getEventCount();
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/event/DatabaseEventImpl.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2005 Gabriel Reid
2 | // SPDX-FileCopyrightText: Copyright 2013-2023 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later
4 | package org.firebirdsql.event;
5 |
6 | record DatabaseEventImpl(String name, int count) implements DatabaseEvent {
7 |
8 | @Override
9 | public int getEventCount() {
10 | return count();
11 | }
12 |
13 | @Override
14 | public String getEventName() {
15 | return name();
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/event/EventListener.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2005 Gabriel Reid
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.event;
4 |
5 | /**
6 | * An interface for callbacks in response to Firebird events
7 | *
8 | * @author Gabriel Reid
9 | */
10 | public interface EventListener {
11 |
12 | /**
13 | * Called when a database event occurs.
14 | *
15 | * @param event Object with information about the event that has occurred
16 | */
17 | void eventOccurred(DatabaseEvent event);
18 |
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/event/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Provides support for listening to Firebird events.
5 | */
6 | package org.firebirdsql.event;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/BatchParameterBuffer.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds;
4 |
5 | /**
6 | * Represents a batch parameter buffer, for Firebird 4 and higher batch configuration.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 5
10 | */
11 | public interface BatchParameterBuffer extends ParameterBuffer {
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ConnectionParameterBuffer.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2015-2023 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds;
4 |
5 | import org.firebirdsql.encodings.Encoding;
6 |
7 | /**
8 | * @author Mark Rotteveel
9 | */
10 | public interface ConnectionParameterBuffer extends ParameterBuffer {
11 |
12 | /**
13 | * @return The tag mapping.
14 | */
15 | ParameterTagMapping getTagMapping();
16 |
17 | /**
18 | * @return The default encoding of string properties in this parameter buffer.
19 | */
20 | Encoding getDefaultEncoding();
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/DatabaseParameterBuffer.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2003 Ryan Baldwin
2 | // SPDX-FileCopyrightText: Copyright 2003-2008 Roman Rokytskyy
3 | // SPDX-FileCopyrightText: Copyright 2014-2023 Mark Rotteveel
4 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
5 | package org.firebirdsql.gds;
6 |
7 | /**
8 | * Instance of this interface represents a Database Parameter Buffer from the
9 | * Firebird API documentation and specifies the attributes for the
10 | * current connection.
11 | *
12 | * Additionally, it is possible to change some database properties in a permanent
13 | * way, however this approach is not recommended. Please use instead management
14 | * API.
15 | */
16 | public interface DatabaseParameterBuffer extends ConnectionParameterBuffer {
17 |
18 | /**
19 | * Make a deep copy of this object.
20 | *
21 | * @return deep copy of this object.
22 | */
23 | DatabaseParameterBuffer deepCopy();
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/EventHandle.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2005 Gabriel Reid
2 | // SPDX-FileCopyrightText: Copyright 2015 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
4 | package org.firebirdsql.gds;
5 |
6 | /**
7 | * Handle to internal event-handling structures.
8 | */
9 | public interface EventHandle {
10 |
11 | /**
12 | * Get the name of the event for which this handle is set to listen for
13 | *
14 | * @return The name of the event
15 | */
16 | String getEventName();
17 |
18 | /**
19 | * Get the count of event occurrences for the most recent occurrence(s)
20 | * of the event for which this handle is registered.
21 | *
22 | * @return The event count
23 | */
24 | int getEventCount();
25 |
26 | /**
27 | * Get the internal event id number for this handle
28 | *
29 | * @return The internal event id
30 | */
31 | int getEventId();
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/EventHandler.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2005 Gabriel Reid
2 | // SPDX-FileCopyrightText: Copyright 2015-2017 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
4 | package org.firebirdsql.gds;
5 |
6 | /**
7 | * A callback handler interface for event handling.
8 | */
9 | public interface EventHandler {
10 |
11 | /**
12 | * Called when a database event occurs.
13 | *
14 | * Implementations should take care to only perform short processing on the current thread. If longer or
15 | * complicated processing is necessary, please offload it to another thread or executor.
16 | *
17 | *
18 | * @param eventHandle
19 | * The event handle
20 | */
21 | void eventOccurred(EventHandle eventHandle);
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ServiceParameterBuffer.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2003 Ryan Baldwin
2 | // SPDX-FileCopyrightText: Copyright 2004-2005 Roman Rokytskyy
3 | // SPDX-FileCopyrightText: Copyright 2014-2023 Mark Rotteveel
4 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
5 | package org.firebirdsql.gds;
6 |
7 | /**
8 | * Instance of this interface represents a Service Parameter Buffer from the
9 | * Firebird API documentation and specifies the attributes for the Services API
10 | * connection.
11 | */
12 | public interface ServiceParameterBuffer extends ConnectionParameterBuffer {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/impl/GDSServerVersionException.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2005 Roman Rokytskyy
2 | // SPDX-FileCopyrightText: Copyright 2011-2023 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
4 | package org.firebirdsql.gds.impl;
5 |
6 | import java.io.Serial;
7 | import java.sql.SQLNonTransientException;
8 |
9 | /**
10 | * Exception is thrown when server returns a version string in a format that this driver does not understand.
11 | */
12 | public class GDSServerVersionException extends SQLNonTransientException {
13 |
14 | @Serial
15 | private static final long serialVersionUID = -7437228877120690612L;
16 |
17 | public GDSServerVersionException(String message) {
18 | super(message + "; Expected engine version format: " +
19 | "-...[-] ");
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/impl/argument/TypedArgument.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022-2023 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.gds.impl.argument;
4 |
5 | import java.io.Serial;
6 |
7 | /**
8 | * Argument with an argument type.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 5
12 | */
13 | public abstract class TypedArgument extends Argument {
14 |
15 | @Serial
16 | private static final long serialVersionUID = -6422646924006860740L;
17 |
18 | final ArgumentType argumentType;
19 |
20 | TypedArgument(int type, ArgumentType argumentType) {
21 | super(type);
22 | this.argumentType = argumentType;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/impl/argument/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Arguments (code, type information and value) for {@link org.firebirdsql.gds.impl.ParameterBufferBase}.
5 | */
6 | @InternalApi
7 | package org.firebirdsql.gds.impl.argument;
8 |
9 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/impl/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * This package contains classes for the pluggable GDS implementations.
5 | */
6 | @InternalApi
7 | package org.firebirdsql.gds.impl;
8 |
9 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/impl/wire/EncryptedStreamSupport.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2019 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.gds.impl.wire;
4 |
5 | import org.firebirdsql.util.InternalApi;
6 |
7 | import javax.crypto.Cipher;
8 | import java.io.IOException;
9 |
10 | /**
11 | * Interface to support enabling encryption on a stream.
12 | *
13 | * @author Mark Rotteveel
14 | * @since 4.0
15 | */
16 | @InternalApi
17 | interface EncryptedStreamSupport {
18 |
19 | /**
20 | * Wraps the underlying stream for encryption using the provided {@code cipher}.
21 | *
22 | * An implementation wrapping a stream that also implements {@code EncryptedStreamSupport} may delegate this call to
23 | * that wrapped stream.
24 | *
25 | *
26 | * @param cipher
27 | * Cipher for the stream
28 | * @throws IOException
29 | * If the underlying stream is already wrapped
30 | */
31 | void setCipher(Cipher cipher) throws IOException;
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/impl/wire/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Pure-java implementation of {@link org.firebirdsql.gds.impl.GDSFactoryPlugin} and supporting classes.
5 | */
6 | @InternalApi
7 | package org.firebirdsql.gds.impl.wire;
8 |
9 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/CursorFlag.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2021 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.gds.ng;
4 |
5 | /**
6 | * Cursor flags.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 5
10 | */
11 | public enum CursorFlag {
12 |
13 | CURSOR_TYPE_SCROLLABLE(0x1),
14 | ;
15 |
16 | private final int flagValue;
17 |
18 | CursorFlag(int flagValue) {
19 | this.flagValue = flagValue;
20 | }
21 |
22 | public int flagValue() {
23 | return flagValue;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/FetchDirection.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng;
4 |
5 | /**
6 | * Direction of fetch.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 5
10 | */
11 | public enum FetchDirection {
12 |
13 | /**
14 | * Fetch forward (to end of cursor).
15 | */
16 | FORWARD,
17 | /**
18 | * Fetch reverse (to start of cursor).
19 | */
20 | REVERSE,
21 | /**
22 | * Fetch in place (doesn't change position).
23 | */
24 | IN_PLACE,
25 | /**
26 | * Fetch direction unknown (e.g. fetch FIRST or LAST).
27 | */
28 | UNKNOWN
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/IConnectionProperties.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013-2023 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng;
4 |
5 | import org.firebirdsql.jaybird.props.DatabaseConnectionProperties;
6 |
7 | /**
8 | * Connection properties for the Firebird connection.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 3.0
12 | */
13 | public interface IConnectionProperties extends IAttachProperties, DatabaseConnectionProperties {
14 |
15 | /**
16 | * @return An immutable version of this instance as an implementation of {@link IConnectionProperties}
17 | */
18 | @Override
19 | IConnectionProperties asImmutable();
20 |
21 | /**
22 | * @return A new, mutable, instance as an implementation of {@link IConnectionProperties} with all properties
23 | * copied.
24 | */
25 | @Override
26 | IConnectionProperties asNewMutable();
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/IServiceProperties.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2015-2023 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng;
4 |
5 | import org.firebirdsql.jaybird.props.ServiceConnectionProperties;
6 |
7 | /**
8 | * Connection properties for a Firebird service attachment.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 3.0
12 | */
13 | public interface IServiceProperties extends IAttachProperties, ServiceConnectionProperties {
14 |
15 | /**
16 | * @return An immutable version of this instance as an implementation of {@link IServiceProperties}
17 | */
18 | @Override
19 | IServiceProperties asImmutable();
20 |
21 | /**
22 | * @return A new, mutable, instance as an implementation of {@link IServiceProperties} with all properties copied.
23 | */
24 | @Override
25 | IServiceProperties asNewMutable();
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/LockCloseable.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng;
4 |
5 | /**
6 | * Unlocks the lock on {@link #close()}, intended for use with try-with-resources.
7 | *
8 | * Implementations do not guard against multiple invocations of {@code close()}. That means, each call to {@code close}
9 | * will result in an {@link java.util.concurrent.locks.Lock#unlock()} or equivalent.
10 | *
11 | *
12 | * @author Mark Rotteveel
13 | * @since 5
14 | */
15 | @FunctionalInterface
16 | public interface LockCloseable extends AutoCloseable {
17 |
18 | /**
19 | * Lock closeable that can be used as a no-op (e.g. if there is no lock, and thus nothing to unlock).
20 | */
21 | LockCloseable NO_OP = () -> { };
22 |
23 | /**
24 | * Performs an {@link java.util.concurrent.locks.Lock#unlock()} or equivalent on the lock.
25 | */
26 | @Override
27 | void close();
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/OperationCloseHandle.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2019 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng;
4 |
5 | /**
6 | * Close handle for {@link org.firebirdsql.gds.ng.monitor.Operation} implementations.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 4.0
10 | */
11 | public interface OperationCloseHandle extends AutoCloseable {
12 |
13 | @Override
14 | void close();
15 |
16 | /**
17 | * @return {@code true} if the operation was cancelled
18 | */
19 | boolean isCancelled();
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/WarningMessageCallback.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013-2016 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng;
4 |
5 | import java.sql.SQLWarning;
6 |
7 | /**
8 | * Callback interface for passing warnings.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 3.0
12 | */
13 | public interface WarningMessageCallback {
14 |
15 | /**
16 | * Signals the warning to the callback
17 | *
18 | * @param warning
19 | * Warning of type SQLWarning
20 | */
21 | void processWarning(SQLWarning warning);
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/dbcrypt/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * SPI for Firebird database encryption callback.
5 | *
6 | * NOTE: This SPI is currently only internal to Jaybird, consider the API as unstable.
7 | *
8 | * Implementations are required to use {@code WeakReference} to hold the listener. It is strongly suggested to use
9 | * {@link ExceptionListenerDispatcher} in your implementation.
10 | *
11 | *
12 | * @author Mark Rotteveel
13 | * @since 3.0
14 | */
15 | public interface ExceptionListenable {
16 |
17 | /**
18 | * Adds an exception listener to this object.
19 | *
20 | * Implementations use {@code WeakReference}.
21 | *
22 | *
23 | * @param listener
24 | * Listener to register
25 | */
26 | void addExceptionListener(ExceptionListener listener);
27 |
28 | /**
29 | * Removes an exception listener to this object.
30 | *
31 | * @param listener
32 | * Listener to remove
33 | */
34 | void removeExceptionListener(ExceptionListener listener);
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/listeners/TransactionListener.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013-2016 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.listeners;
4 |
5 | import org.firebirdsql.gds.ng.FbTransaction;
6 | import org.firebirdsql.gds.ng.TransactionState;
7 |
8 | /**
9 | * @author Mark Rotteveel
10 | * @since 3.0
11 | */
12 | public interface TransactionListener {
13 |
14 | /**
15 | * Signals that the transaction state changed.
16 | *
17 | * @param transaction {@link org.firebirdsql.gds.ng.FbTransaction} that changed state
18 | */
19 | void transactionStateChanged(FbTransaction transaction, TransactionState newState, TransactionState previousState);
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/listeners/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Listener interfaces and supporting classes for the {@link org.firebirdsql.gds.ng} API.
5 | *
6 | * @since 3
7 | */
8 | @InternalApi
9 | package org.firebirdsql.gds.ng.listeners;
10 |
11 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/monitor/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Interfaces for operation monitoring (experimental feature).
5 | *
6 | * @since 4
7 | */
8 | package org.firebirdsql.gds.ng.monitor;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/tz/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Mapping between Firebird and Java time zones and supporting classes.
5 | *
6 | * @since 4
7 | */
8 | @InternalApi
9 | package org.firebirdsql.gds.ng.tz;
10 |
11 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/BatchCompletionResponse.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | import org.firebirdsql.gds.ng.BatchCompletion;
6 |
7 | /**
8 | * Data from the {@link org.firebirdsql.gds.impl.wire.WireProtocolConstants#op_batch_cs} response.
9 | *
10 | * @param batchCompletion
11 | * batch completion information
12 | * @author Mark Rotteveel
13 | * @since 5
14 | */
15 | public record BatchCompletionResponse(BatchCompletion batchCompletion) implements Response {
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/FbWireBlob.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | import org.firebirdsql.gds.ng.FbBlob;
6 |
7 | /**
8 | * @author Mark Rotteveel
9 | * @since 3.0
10 | */
11 | public interface FbWireBlob extends FbBlob {
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/FbWireService.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2015 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | import org.firebirdsql.gds.ng.FbService;
6 |
7 | /**
8 | * @author Mark Rotteveel
9 | * @since 3.0
10 | */
11 | public interface FbWireService extends FbService, FbWireAttachment {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/FbWireStatement.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013-2016 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | import org.firebirdsql.gds.ng.FbStatement;
6 |
7 | /**
8 | * Interface for Statements created for the wire protocol implementation.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 3.0
12 | */
13 | public interface FbWireStatement extends FbStatement {
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/FbWireTransaction.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013-2016 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | import org.firebirdsql.gds.ng.FbTransaction;
6 |
7 | /**
8 | * Interface for transactions created for the wire protocol implementation.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 3.0
12 | */
13 | public interface FbWireTransaction extends FbTransaction {
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/FetchResponse.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | import org.firebirdsql.gds.ISCConstants;
6 |
7 | /**
8 | * @param status
9 | * fetch status ({@link ISCConstants#FETCH_OK} or {@link ISCConstants#FETCH_NO_MORE_ROWS}
10 | * @param count
11 | * number of rows following (in practice, either {@code 0} or {@code 1})
12 | * @author Mark Rotteveel
13 | * @since 3.0
14 | */
15 | public record FetchResponse(int status, int count) implements Response {
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/GenericResponse.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | import java.sql.SQLException;
6 |
7 | /**
8 | * @param objectHandle
9 | * object handle associated with the response
10 | * @param blobId
11 | * blob id or status value
12 | * @param data
13 | * data
14 | * @param exception
15 | * exception or warning (or {@code null} for no exception or warning)
16 | * @author Mark Rotteveel
17 | * @since 3.0
18 | */
19 | @SuppressWarnings("java:S6218")
20 | public record GenericResponse(int objectHandle, long blobId, byte[] data, SQLException exception) implements Response {
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/InlineBlobResponse.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2025 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | import org.jspecify.annotations.NullMarked;
6 |
7 | /**
8 | * Response instance for an inline blob ({@code op_inline_blob}) response.
9 | *
10 | * @param transactionHandle
11 | * transaction handle the inline blob is valid for
12 | * @param blobId
13 | * blob id
14 | * @param info
15 | * byte array with blob info
16 | * @param data
17 | * byte array with blob data (without segments)
18 | * @author Mark Rotteveel
19 | * @since 7
20 | */
21 | @NullMarked
22 | public record InlineBlobResponse(int transactionHandle, long blobId, byte[] info, byte[] data) implements Response {
23 |
24 | public InlineBlob toInlineBlob(FbWireDatabase database) {
25 | return new InlineBlob(database, blobId, transactionHandle, info, data);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/Response.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013-2016 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | /**
6 | * @author Mark Rotteveel
7 | * @since 3.0
8 | */
9 | public interface Response {
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/SqlResponse.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2013-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire;
4 |
5 | /**
6 | * @param count
7 | * number of rows following (either {@code 0} or {@code 1})
8 | * @author Mark Rotteveel
9 | * @since 3.0
10 | */
11 | public record SqlResponse(int count) implements Response {
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/auth/AuthenticationPluginSpi.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2015 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.gds.ng.wire.auth;
4 |
5 | /**
6 | * Service provider interface for authentication plugins.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 3.0
10 | */
11 | public interface AuthenticationPluginSpi {
12 |
13 | /**
14 | * @return Name of the plugin as used by Firebird
15 | */
16 | String getPluginName();
17 |
18 | /**
19 | * @return Plugin instance
20 | */
21 | AuthenticationPlugin createPlugin();
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/auth/legacy/LegacyAuthenticationPluginSpi.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2015-2018 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.gds.ng.wire.auth.legacy;
4 |
5 | import org.firebirdsql.gds.ng.wire.auth.AuthenticationPlugin;
6 | import org.firebirdsql.gds.ng.wire.auth.AuthenticationPluginSpi;
7 |
8 | /**
9 | * Legacy authentication plugin service provider.
10 | *
11 | * @author Mark Rotteveel
12 | */
13 | public class LegacyAuthenticationPluginSpi implements AuthenticationPluginSpi {
14 |
15 | public static final String LEGACY_AUTH_NAME = "Legacy_Auth";
16 |
17 | @Override
18 | public String getPluginName() {
19 | return LEGACY_AUTH_NAME;
20 | }
21 |
22 | @Override
23 | public AuthenticationPlugin createPlugin() {
24 | return new LegacyAuthenticationPlugin();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/auth/legacy/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Implementation of {@link org.firebirdsql.gds.ng.wire.auth} for the {@code Legacy_Auth} authentication plugin.
5 | *
6 | * Also used for Firebird 2.5 and earlier authentication.
7 | *
8 | * NOTE: This class is currently only internal to Jaybird, consider the API as unstable.
9 | *
10 | *
11 | * @author Mark Rotteveel
12 | * @since 6
13 | */
14 | public interface CryptConnectionInfo {
15 |
16 | /**
17 | * Protocol version of the connection.
18 | *
19 | * The protocol version is masked, so use the relevant {@code PROTOCOL_VERSIONnn} constants from
20 | * {@link org.firebirdsql.gds.impl.wire.WireProtocolConstants} or equivalents for checks.
21 | *
8 | * NOTE: This plugin is currently only internal to Jaybird, consider the API as unstable.
9 | *
10 | *
11 | * @author Mark Rotteveel
12 | * @since 4.0
13 | */
14 | public interface EncryptionPlugin {
15 |
16 | /**
17 | * @return Encryption identifier
18 | */
19 | EncryptionIdentifier encryptionIdentifier();
20 |
21 | /**
22 | * Initializes the encryption for incoming and outgoing communication.
23 | *
24 | * @return Object with the result of initialization
25 | */
26 | EncryptionInitInfo initializeEncryption();
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/gds/ng/wire/crypt/FBSQLEncryptException.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2017 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.gds.ng.wire.crypt;
4 |
5 | import java.sql.SQLInvalidAuthorizationSpecException;
6 |
7 | /**
8 | * Exception that indicates encryption could not be initialized.
9 | *
10 | * This exception is thrown when wire encryption cannot be initialized, for example if the current authentication
11 | * plugin does not support generating a session key, or if no matching cipher can be found.
12 | *
6 | * This package contains classes defining the Firebird API for Java language that applications can use to access
7 | * databases directly without JDBC interfaces. This is probably most efficient way to access the database, but also it
8 | * is the most complicated one and requires deep knowledge of the Firebird API. For better understanding please refer
9 | * to the "InterBase 6 API Guide" published by Borland and released together with the open-sourcing the InterBase code,
10 | * a predecessor of Firebird.
11 | *
12 | *
13 | * Please refer to the documentation in the javadoc comments as well as to the source code for more information.
14 | *
6 | * For historic reasons, a lot of constants are currently defined in {@link org.firebirdsql.gds.ISCConstants} instead
7 | * of here. These may be moved to here in future releases on a case-by-case basis.
8 | *
9 | *
10 | * Constants for the Firebird wire protocol are defined in {@link org.firebirdsql.gds.impl.wire.WireProtocolConstants}.
11 | *
8 | * The literal {@code UNKNOWN} is signalled as a {@link BooleanLiteralToken}.
9 | *
10 | *
11 | * @author Mark Rotteveel
12 | * @since 5
13 | */
14 | final class NullLiteralToken extends AbstractToken implements LiteralToken {
15 |
16 | NullLiteralToken(int pos, CharSequence src, int start, int end) {
17 | super(pos, src, start, end);
18 | }
19 |
20 | public NullLiteralToken(int pos, CharSequence tokenText) {
21 | super(pos, tokenText);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/parser/OpenToken.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2021-2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jaybird.parser;
4 |
5 | /**
6 | * Signals an open token in the token stream.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 5
10 | */
11 | interface OpenToken extends Token {
12 |
13 | /**
14 | * Is this token closed by the provided close token.
15 | *
16 | * @param closeToken
17 | * Close token
18 | * @return {@code true} if {@code closeToken} closes this token, {@code false} otherwise
19 | */
20 | boolean closedBy(CloseToken closeToken);
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/parser/OperatorToken.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2021-2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jaybird.parser;
4 |
5 | /**
6 | * Signals an operator in the token stream.
7 | *
8 | * The term operator is taken very broadly, and includes mathematical operators ({@code + - / *}, boolean operators
9 | * ({@code and or is not} and comparison operators ({@code = <> > < >= <= != ~= ^= !< ~< ^< !> ~> ^>} and the prefix of
10 | * those operators ({@code ! ~ ^} if they appear individually in the statement (which is a syntax error in Firebird).
11 | *
10 | * Used by {@link SqlParser} to notify the visitors of tokens.
11 | *
12 | *
13 | * @author Mark Rotteveel
14 | * @since 5
15 | */
16 | @InternalApi
17 | public interface TokenVisitor {
18 |
19 | /**
20 | * Notifies the visitor of a token.
21 | *
22 | * @param token
23 | * Token
24 | * @param visitorRegistrar
25 | * Visitor registrar (can be used to remove itself, or add other visitors)
26 | */
27 | void visitToken(Token token, VisitorRegistrar visitorRegistrar);
28 |
29 | /**
30 | * Signals that the last token was produced and the statement text was fully parsed.
31 | *
32 | * @param visitorRegistrar
33 | * Visitor registrar (can be used to remove itself, or add other visitors)
34 | */
35 | void complete(VisitorRegistrar visitorRegistrar);
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/parser/UnexpectedEndOfInputException.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2021-2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jaybird.parser;
4 |
5 | import org.firebirdsql.util.InternalApi;
6 |
7 | /**
8 | * Thrown when the tokenizer required a character, but instead the end of input was reached.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 5
12 | */
13 | @InternalApi
14 | public class UnexpectedEndOfInputException extends RuntimeException {
15 |
16 | private static final long serialVersionUID = 5393338512797009183L;
17 |
18 | public UnexpectedEndOfInputException(String message) {
19 | super(message);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/parser/VisitorRegistrar.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2021-2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jaybird.parser;
4 |
5 | import org.firebirdsql.util.InternalApi;
6 |
7 | /**
8 | * Registrar for visitors that allows runtime removal or addition of visitors.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 5
12 | */
13 | @InternalApi
14 | public interface VisitorRegistrar {
15 |
16 | /**
17 | * Adds a visitor.
18 | *
19 | * @param tokenVisitor
20 | * Token visitor
21 | */
22 | void addVisitor(TokenVisitor tokenVisitor);
23 |
24 | /**
25 | * Removes a visitor - if already registered.
26 | *
27 | * @param tokenVisitor
28 | * Token visitor
29 | */
30 | void removeVisitor(TokenVisitor tokenVisitor);
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/parser/WhitespaceToken.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2021-2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jaybird.parser;
4 |
5 | /**
6 | * Signals one or more whitespace characters in a token stream.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 5
10 | */
11 | final class WhitespaceToken extends AbstractToken {
12 |
13 | WhitespaceToken(int pos, CharSequence src, int start, int end) {
14 | super(pos, src, start, end);
15 | }
16 |
17 | public WhitespaceToken(int pos, CharSequence tokenText) {
18 | super(pos, tokenText);
19 | }
20 |
21 | @Override
22 | public boolean isWhitespaceOrComment() {
23 | return true;
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/parser/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2021-2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Statement parser for generated keys support.
5 | *
6 | * DO NOT USE! This packages is for driver-internal purposes only.
7 | *
8 | *
9 | * The parser in this package is not a full implementation of the Firebird SQL dialect. It only serves to obtain the
10 | * statement information necessary for internal purposes of Jaybird (like generated keys support).
11 | *
12 | */
13 | @InternalApi
14 | package org.firebirdsql.jaybird.parser;
15 |
16 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/props/def/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Definition of a connection property and supporting classes.
5 | *
6 | * @since 5
7 | */
8 | package org.firebirdsql.jaybird.props.def;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/props/internal/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Internal API for connection properties and the definition of properties supported by Jaybird.
5 | *
6 | * @since 5
7 | */
8 | @InternalApi
9 | package org.firebirdsql.jaybird.props.internal;
10 |
11 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/props/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * APIs and constants for connection properties for attachments to a Firebird database or service API.
5 | *
6 | * @since 5
7 | */
8 | package org.firebirdsql.jaybird.props;
9 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/props/spi/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * SPI to register connection properties with Jaybird.
5 | *
6 | * See {@link org.firebirdsql.jaybird.props.spi.ConnectionPropertyDefinerSpi} for more information.
7 | *
8 | *
9 | * @since 5
10 | */
11 | package org.firebirdsql.jaybird.props.spi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/util/Cleaners.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2023 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jaybird.util;
4 |
5 | import java.lang.ref.Cleaner;
6 |
7 | /**
8 | * Factory for {@link Cleaner} for use within Jaybird.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 6
12 | */
13 | public final class Cleaners {
14 |
15 | private static final Cleaner jbCleaner = Cleaner.create();
16 | private static final Cleaner.Cleanable NO_OP = () -> {};
17 |
18 | private Cleaners() {
19 | // no instances
20 | }
21 |
22 | /**
23 | * @return {@link Cleaner} for use within Jaybird
24 | */
25 | public static Cleaner getJbCleaner() {
26 | return jbCleaner;
27 | }
28 |
29 | /**
30 | * @return A {@link java.lang.ref.Cleaner.Cleanable} which does nothing
31 | */
32 | public static Cleaner.Cleanable getNoOp() {
33 | return NO_OP;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/util/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2023-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Utility classes which are strictly for use within Jaybird itself.
5 | *
6 | * @author Mark Rotteveel
7 | * @since 6
8 | */
9 | @InternalApi
10 | @NullMarked
11 | package org.firebirdsql.jaybird.util;
12 |
13 | import org.firebirdsql.util.InternalApi;
14 | import org.jspecify.annotations.NullMarked;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/xca/FBIncorrectXidException.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2005 Roman Rokytskyy
2 | // SPDX-FileCopyrightText: Copyright 2020-2023 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later
4 | package org.firebirdsql.jaybird.xca;
5 |
6 | import java.io.Serial;
7 |
8 | /**
9 | * This error is thrown when message read from the RDB$TRANSACTIONS table does not represent a serialized Xid.
10 | */
11 | public class FBIncorrectXidException extends Exception {
12 |
13 | @Serial
14 | private static final long serialVersionUID = -4422195562607053359L;
15 |
16 | public FBIncorrectXidException(String reason) {
17 | super(reason);
18 | }
19 |
20 | public FBIncorrectXidException(String reason, Throwable cause) {
21 | super(reason, cause);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jaybird/xca/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * XCA (or ex-connector-architecture), is an internal API of Jaybird for connection management.
5 | *
6 | * Historically it was derived from the JavaEE Connector Architecture specification, but that tie has been cut
7 | * since Jaybird 5.
8 | *
9 | *
10 | * All classes, interfaces and other constructs in this package should be considered internal API of Jaybird, and may
11 | * change radically between point releases. Do not use it in your own code.
12 | *
13 | */
14 | @InternalApi
15 | package org.firebirdsql.jaybird.xca;
16 |
17 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/FBDriverNotCapableException.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2003 Roman Rokytskyy
2 | // SPDX-FileCopyrightText: Copyright 2011-2023 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later
4 | package org.firebirdsql.jdbc;
5 |
6 | import java.io.Serial;
7 | import java.sql.SQLFeatureNotSupportedException;
8 |
9 | /**
10 | * Tell that driver is not able to serve the request due to missing capabilities.
11 | *
12 | * @author Roman Rokytskyy
13 | */
14 | public class FBDriverNotCapableException extends SQLFeatureNotSupportedException {
15 |
16 | @Serial
17 | private static final long serialVersionUID = 4813885566272454052L;
18 |
19 | /**
20 | * Create instance of this class for the specified reason.
21 | *
22 | * @param reason reason that will be displayed.
23 | */
24 | public FBDriverNotCapableException(String reason) {
25 | super(reason, SQLStateConstants.SQL_STATE_FEATURE_NOT_SUPPORTED);
26 | }
27 |
28 | /**
29 | * Create instance of this class.
30 | */
31 | public FBDriverNotCapableException() {
32 | this("Not yet implemented.");
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/FirebirdClob.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.jdbc;
4 |
5 | import java.sql.Clob;
6 |
7 | /**
8 | * Firebird Clob abstraction. This interface defines methods to read and write Clob content.
9 | *
10 | * @author Mark Rotteveel
11 | */
12 | public interface FirebirdClob extends Clob {
13 | /* Empty interface retained for potential future extension */
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/FirebirdDriver.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2005 Roman Rokytskyy
2 | // SPDX-FileCopyrightText: Copyright 2020-2023 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
4 | package org.firebirdsql.jdbc;
5 |
6 | import java.sql.Driver;
7 |
8 | /**
9 | * Extension of {@link java.sql.Driver} for Jaybird.
10 | *
11 | * Currently empty, but retained in case we want to add extensions.
12 | *
13 | */
14 | public interface FirebirdDriver extends Driver {
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/FirebirdParameterMetaData.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2007 Roman Rokytskyy
2 | // SPDX-FileCopyrightText: Copyright 2011-2012 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
4 | package org.firebirdsql.jdbc;
5 |
6 | import java.sql.ParameterMetaData;
7 |
8 | /**
9 | * Firebird extension to the {@link java.sql.ParameterMetaData} interface.
10 | */
11 | public interface FirebirdParameterMetaData extends ParameterMetaData {
12 |
13 | }
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/FirebirdResultSetMetaData.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2009 Roman Rokytskyy
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.jdbc;
4 |
5 | import java.sql.ResultSetMetaData;
6 | import java.sql.SQLException;
7 |
8 | /**
9 | * Firebird-specific extensions to the {@link ResultSetMetaData} interface.
10 | *
11 | * @author Roman Rokytskyy
12 | */
13 | public interface FirebirdResultSetMetaData extends ResultSetMetaData {
14 |
15 | /**
16 | * Gets the designated column's table alias.
17 | *
18 | * @param column the first column is 1, the second is 2, ...
19 | * @return table alias or "" if not applicable
20 | * @exception SQLException if a database access error occurs
21 | */
22 | String getTableAlias(int column) throws SQLException;
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/FirebirdRowId.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.jdbc;
4 |
5 | import java.sql.RowId;
6 |
7 | /**
8 | * Firebird-specific extensions to the {@link java.sql.RowId} interface.
9 | */
10 | public interface FirebirdRowId extends RowId {
11 | /* Empty interface retained for potential future extension */
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/FirebirdSavepoint.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2005 Roman Rokytskyy
2 | // SPDX-FileCopyrightText: Copyright 2011-2015 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
4 | package org.firebirdsql.jdbc;
5 |
6 | import java.sql.Savepoint;
7 |
8 | /**
9 | * Firebird-specific extensions to the {@link java.sql.Savepoint} interface.
10 | */
11 | public interface FirebirdSavepoint extends Savepoint {
12 | /* Empty interface retained for backwards compatibility and potential future extension */
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/JaybirdTypeCodes.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2018-2020 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.jdbc;
4 |
5 | import org.firebirdsql.util.Volatile;
6 |
7 | /**
8 | * Type codes specific for Jaybird.
9 | *
10 | * @author Mark Rotteveel
11 | */
12 | @Volatile(reason = "Defined type codes may receive a different value when standardized in JDBC")
13 | public final class JaybirdTypeCodes {
14 |
15 | // TODO Remove when standardized in JDBC
16 |
17 | @Volatile(reason = "To be standardized by future version of JDBC, type code may change")
18 | public static final int DECFLOAT = -6001;
19 |
20 | private JaybirdTypeCodes() {
21 | // no instances
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/escape/ConstantSQLFunction.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2018 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jdbc.escape;
4 |
5 | /**
6 | * Implementation of {@link SQLFunction} for constants or functions without parameters.
7 | *
8 | * @author Mark Rotteveel
9 | * @since 4.0
10 | */
11 | final class ConstantSQLFunction implements SQLFunction {
12 |
13 | private final String functionConstant;
14 |
15 | ConstantSQLFunction(String functionConstant) {
16 | this.functionConstant = functionConstant;
17 | }
18 |
19 | @Override
20 | public String apply(String... parameters) throws FBSQLParseException {
21 | if (parameters.length > 0) {
22 | throw new FBSQLParseException(
23 | "Invalid number of arguments, expected no arguments, received " + parameters.length);
24 | }
25 | return functionConstant;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/escape/FBSQLParseException.java:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: Copyright 2001-2002 David Jencks
3 | SPDX-FileCopyrightText: Copyright 2002-2003 Roman Rokytskyy
4 | SPDX-FileCopyrightText: Copyright 2012-2024 Mark Rotteveel
5 | SPDX-License-Identifier: LGPL-2.1-or-later
6 | */
7 | package org.firebirdsql.jdbc.escape;
8 |
9 | import org.firebirdsql.jdbc.SQLStateConstants;
10 |
11 | import java.io.Serial;
12 | import java.sql.SQLSyntaxErrorException;
13 |
14 | /**
15 | * This exception is thrown by FBEscapedParser when it cannot parse the
16 | * escaped syntax.
17 | *
18 | * @author Roman Rokytskyy
19 | */
20 | public class FBSQLParseException extends SQLSyntaxErrorException {
21 |
22 | @Serial
23 | private static final long serialVersionUID = 4217078230221445003L;
24 |
25 | public FBSQLParseException(String msg) {
26 | super(msg, SQLStateConstants.SQL_STATE_INVALID_ESCAPE_SEQ);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/escape/LocateFunction.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2018 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jdbc.escape;
4 |
5 | /**
6 | * Implements the {@code LOCATE} JDBC escape
7 | *
8 | * @author Mark Rotteveel
9 | * @since 4.0
10 | */
11 | final class LocateFunction implements SQLFunction {
12 |
13 | private static final SQLFunction POSITION_FROM_START = new PatternSQLFunction("POSITION({0},{1})");
14 | private static final SQLFunction POSITION_FROM_INDEX = new PatternSQLFunction("POSITION({0},{1},{2})");
15 |
16 | @Override
17 | public String apply(String... parameters) throws FBSQLParseException {
18 | switch (parameters.length) {
19 | case 2:
20 | return POSITION_FROM_START.apply(parameters);
21 | case 3:
22 | return POSITION_FROM_INDEX.apply(parameters);
23 | default:
24 | throw new FBSQLParseException("Expected 2 or 3 parameters for LOCATE, received " + parameters.length);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/escape/SQLFunction.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2018 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jdbc.escape;
4 |
5 | /**
6 | * SQL function call for processing JDBC function escapes
7 | *
8 | * @author Mark Rotteveel
9 | * @since 4.0
10 | */
11 | interface SQLFunction {
12 |
13 | /**
14 | * Render this function call with the supplied parameters.
15 | *
16 | * @param parameters
17 | * Parameters for the function call.
18 | * @return Rendered function call, or {@code null} to fallback to server-side handling
19 | * @throws FBSQLParseException
20 | * Optionally, if the number of parameters or values of parameters are invalid
21 | */
22 | String apply(String... parameters) throws FBSQLParseException;
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/escape/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Implementation of JDBC escapes for the Jaybird Firebird JDBC driver.
5 | */
6 | @InternalApi
7 | @NullMarked
8 | package org.firebirdsql.jdbc.escape;
9 |
10 | import org.firebirdsql.util.InternalApi;
11 | import org.jspecify.annotations.NullMarked;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/field/BlobListenableField.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jdbc.field;
4 |
5 | import org.firebirdsql.jdbc.FBObjectListener;
6 | import org.firebirdsql.util.InternalApi;
7 | import org.jspecify.annotations.NullMarked;
8 |
9 | /**
10 | * Field which expects a blob listener.
11 | *
12 | * @author Mark Rotteveel
13 | * @since 5
14 | */
15 | @InternalApi
16 | @NullMarked
17 | public interface BlobListenableField {
18 |
19 | /**
20 | * Sets the blob listener of the field.
21 | *
22 | * @param blobListener
23 | * blob listener
24 | */
25 | void setBlobListener(FBObjectListener.BlobListener blobListener);
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/field/FBCloseableField.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2020 Vasiliy Yashkov
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jdbc.field;
4 |
5 | import java.sql.SQLException;
6 |
7 | /**
8 | * Instances of this field have open resources and must be cleaned up.
9 | *
10 | * @author Vasiliy Yashkov
11 | * @since 5
12 | */
13 | public interface FBCloseableField {
14 |
15 | /**
16 | * Close this field. This method tells field implementation to release all
17 | * resources allocated when field methods were called.
18 | *
19 | * @throws SQLException
20 | * if field cannot be closed.
21 | */
22 | void close() throws SQLException;
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/field/FBRowIdField.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2017-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jdbc.field;
4 |
5 | import org.firebirdsql.gds.ng.fields.FieldDescriptor;
6 | import org.jspecify.annotations.NullMarked;
7 |
8 | import java.sql.SQLException;
9 |
10 | /**
11 | * Field for row id fields (DB_KEY/RDB$DB_KEY).
12 | *
13 | * The implementation inherits from {@link FBBinaryField} so it can still behave in a backwards-compatible manner
14 | * with previous Jaybird versions (except for the behavior of {@link #getObject()}).
15 | *
16 | *
17 | * @author Mark Rotteveel
18 | * @since 4.0
19 | */
20 | class FBRowIdField extends FBBinaryField {
21 |
22 | @NullMarked
23 | FBRowIdField(FieldDescriptor fieldDescriptor, FieldDataProvider dataProvider, int requiredType)
24 | throws SQLException {
25 | super(fieldDescriptor, dataProvider, requiredType);
26 | }
27 |
28 | @Override
29 | public Object getObject() throws SQLException {
30 | return getRowId();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/field/FBTimeTzField.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2019-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.jdbc.field;
4 |
5 | import org.firebirdsql.gds.ng.fields.FieldDescriptor;
6 | import org.jspecify.annotations.NullMarked;
7 |
8 | import java.sql.SQLException;
9 | import java.time.OffsetTime;
10 |
11 | /**
12 | * Field for {@code TIME WITH TIME ZONE}.
13 | *
14 | * @author Mark Rotteveel
15 | * @since 4.0
16 | */
17 | class FBTimeTzField extends AbstractWithTimeZoneField {
18 |
19 | @NullMarked
20 | FBTimeTzField(FieldDescriptor fieldDescriptor, FieldDataProvider dataProvider, int requiredType)
21 | throws SQLException {
22 | super(fieldDescriptor, dataProvider, requiredType);
23 | }
24 |
25 | @Override
26 | public Object getObject() throws SQLException {
27 | return getOffsetTime();
28 | }
29 |
30 | @Override
31 | public String getString() throws SQLException {
32 | OffsetTime offsetTime = getOffsetTime();
33 | return offsetTime != null ? offsetTime.toString() : null;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/field/FieldDataProvider.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2004 Roman Rokytskyy
2 | // SPDX-FileCopyrightText: Copyright 2018-2024 Mark Rotteveel
3 | // SPDX-License-Identifier: LGPL-2.1-or-later
4 | package org.firebirdsql.jdbc.field;
5 |
6 | import org.jspecify.annotations.Nullable;
7 |
8 | /**
9 | * Provider of the row data.
10 | *
11 | * @author Roman Rokytskyy
12 | */
13 | public interface FieldDataProvider {
14 |
15 | /**
16 | * Get raw content of the filed. This method returns the array of bytes sent
17 | * by the server back.
18 | *
19 | * @return contents of the field or null if NULL value was
20 | * sent from the server.
21 | */
22 | byte @Nullable [] getFieldData();
23 |
24 | /**
25 | * Set raw content of the field.
26 | *
27 | * @param data raw content of the field.
28 | */
29 | void setFieldData(byte @Nullable [] data);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/field/TypeConversionException.java:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: Copyright 2002-2003 Roman Rokytskyy
3 | SPDX-FileCopyrightText: Copyright 2002 David Jencks
4 | SPDX-FileCopyrightText: Copyright 2003 Blas Rodriguez Somoza
5 | SPDX-FileCopyrightText: Copyright 2011-2024 Mark Rotteveel
6 | SPDX-License-Identifier: LGPL-2.1-or-later
7 | */
8 | package org.firebirdsql.jdbc.field;
9 |
10 | import org.firebirdsql.jdbc.SQLStateConstants;
11 |
12 | import java.io.Serial;
13 | import java.sql.SQLNonTransientException;
14 |
15 | /**
16 | * This exception is thrown when the requested type conversion cannot be
17 | * performed.
18 | * @author Roman Rokytskyy
19 | * @version 1.0
20 | */
21 | public class TypeConversionException extends SQLNonTransientException {
22 |
23 | @Serial
24 | private static final long serialVersionUID = 9145386635318036933L;
25 |
26 | public TypeConversionException(String msg) {
27 | super(msg, SQLStateConstants.SQL_STATE_INVALID_CONVERSION);
28 | }
29 |
30 | public TypeConversionException(String msg, Throwable cause) {
31 | super(msg, SQLStateConstants.SQL_STATE_INVALID_CONVERSION, cause);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/field/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Implementation of fields for getting or setting result set columns or prepared statement parameters.
5 | */
6 | @InternalApi
7 | package org.firebirdsql.jdbc.field;
8 |
9 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/metadata/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2019-2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * The classes in this packages support or provide parts of the implementation of {@link java.sql.DatabaseMetaData}.
5 | *
6 | * This package is an implementation detail and not part of the public API of Jaybird. Its contents may change
7 | * drastically between point release or may even be removed without notice. Do not rely on it directly, but instead use
8 | * {@link java.sql.DatabaseMetaData}.
9 | *
10 | *
11 | * @author Mark Rotteveel
12 | * @since 4
13 | */
14 | @InternalApi
15 | package org.firebirdsql.jdbc.metadata;
16 |
17 | import org.firebirdsql.util.InternalApi;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/jdbc/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Implementation of the JDBC API for the Firebird database.
5 | *
8 | */
9 | package org.firebirdsql.jdbc;
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/util/InternalApi.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2018-2019 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.util;
4 |
5 | import java.lang.annotation.Documented;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 |
9 | /**
10 | * Indicates that the annotated package, class, method or value is for internal use only.
11 | *
12 | * Future versions may radically change, move, or make inaccessible this type.
13 | *
14 | *
15 | * @author Mark Rotteveel
16 | */
17 | @Documented
18 | @Retention(RetentionPolicy.SOURCE)
19 | public @interface InternalApi {
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/util/Volatile.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2018 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
3 | package org.firebirdsql.util;
4 |
5 | import java.lang.annotation.Documented;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 |
9 | /**
10 | * Indicates that the annotated class, method or value is volatile, and may change in a next version.
11 | *
12 | * @author Mark Rotteveel
13 | */
14 | @Documented
15 | @Retention(RetentionPolicy.SOURCE)
16 | public @interface Volatile {
17 |
18 | String reason();
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/org/firebirdsql/util/package-info.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022-2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | /**
4 | * Utility classes for use by Jaybird.
5 | *
6 | * With the exception of {@link org.firebirdsql.util.FirebirdSupportInfo}, all other classes are internal API and should
7 | * not be used outside of Jaybird. These other classes may be removed to a different package in a future release.
8 | *
9 | */
10 | @InternalApi
11 | @NullMarked
12 | package org.firebirdsql.util;
13 |
14 | import org.jspecify.annotations.NullMarked;
--------------------------------------------------------------------------------
/src/resources/META-INF/services/java.sql.Driver:
--------------------------------------------------------------------------------
1 | org.firebirdsql.jdbc.FBDriver
--------------------------------------------------------------------------------
/src/resources/META-INF/services/org.firebirdsql.encodings.EncodingSet:
--------------------------------------------------------------------------------
1 | org.firebirdsql.encodings.DefaultEncodingSet
--------------------------------------------------------------------------------
/src/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin:
--------------------------------------------------------------------------------
1 | org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin
2 |
--------------------------------------------------------------------------------
/src/resources/META-INF/services/org.firebirdsql.gds.ng.wire.ProtocolDescriptor:
--------------------------------------------------------------------------------
1 | org.firebirdsql.gds.ng.wire.version10.Version10Descriptor
2 | org.firebirdsql.gds.ng.wire.version11.Version11Descriptor
3 | org.firebirdsql.gds.ng.wire.version12.Version12Descriptor
4 | org.firebirdsql.gds.ng.wire.version13.Version13Descriptor
5 | org.firebirdsql.gds.ng.wire.version15.Version15Descriptor
6 | org.firebirdsql.gds.ng.wire.version16.Version16Descriptor
7 | org.firebirdsql.gds.ng.wire.version18.Version18Descriptor
8 | org.firebirdsql.gds.ng.wire.version19.Version19Descriptor
9 |
--------------------------------------------------------------------------------
/src/resources/META-INF/services/org.firebirdsql.gds.ng.wire.auth.AuthenticationPluginSpi:
--------------------------------------------------------------------------------
1 | org.firebirdsql.gds.ng.wire.auth.legacy.LegacyAuthenticationPluginSpi
2 | org.firebirdsql.gds.ng.wire.auth.srp.SrpAuthenticationPluginSpi
3 | org.firebirdsql.gds.ng.wire.auth.srp.Srp224AuthenticationPluginSpi
4 | org.firebirdsql.gds.ng.wire.auth.srp.Srp256AuthenticationPluginSpi
5 | org.firebirdsql.gds.ng.wire.auth.srp.Srp384AuthenticationPluginSpi
6 | org.firebirdsql.gds.ng.wire.auth.srp.Srp512AuthenticationPluginSpi
7 |
--------------------------------------------------------------------------------
/src/resources/META-INF/services/org.firebirdsql.gds.ng.wire.crypt.EncryptionPluginSpi:
--------------------------------------------------------------------------------
1 | org.firebirdsql.gds.ng.wire.crypt.arc4.Arc4EncryptionPluginSpi
2 | org.firebirdsql.gds.ng.wire.crypt.chacha.ChaChaEncryptionPluginSpi
3 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/firebird_14_error_msg.properties:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2000-2024 Firebird development team and individual contributors
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | # SPDX-FileComment: The keys and values listed here were obtained from the Firebird sources, which are licensed under the IPL (InterBase Public License) and/or IDPL (Initial Developer Public License), both are variants of the Mozilla Public License version 1.1
4 | 336461924=Row not found for fetch, update or delete, or the result of a query is an empty table.
5 | 336461925=segment buffer length shorter than expected
6 | 336462125=Datatype needs modification
7 | 336462436=Duplicate column or domain name found.
8 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/firebird_18_sql_states.properties:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2000-2024 Firebird development team and individual contributors
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | # SPDX-FileComment: The keys and values listed here were obtained from the Firebird sources, which are licensed under the IPL (InterBase Public License) and/or IDPL (Initial Developer Public License), both are variants of the Mozilla Public License version 1.1
4 | 336723983=00000
5 | 336723984=00000
6 | 336723985=00000
7 | 336723986=00000
8 | 336723987=00000
9 | 336723988=00000
10 | 336723989=00000
11 | 336723990=00000
12 | 336723991=00000
13 | 336723992=00000
14 | 336723996=00000
15 | 336723997=00000
16 | 336723998=00000
17 | 336723999=00000
18 | 336724000=00000
19 | 336724001=00000
20 | 336724002=00000
21 | 336724003=00000
22 | 336724004=00000
23 | 336724005=00000
24 | 336724006=00000
25 | 336724008=00000
26 | 336724009=00000
27 | 336724010=00000
28 | 336724011=00000
29 | 336724012=00000
30 | 336724044=00000
31 | 336724045=00000
32 | 336724046=00000
33 | 336724047=00000
34 | 336724048=00000
35 | 336724049=00000
36 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/firebird_21_sql_states.properties:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2000-2024 Firebird development team and individual contributors
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | # SPDX-FileComment: The keys and values listed here were obtained from the Firebird sources, which are licensed under the IPL (InterBase Public License) and/or IDPL (Initial Developer Public License), both are variants of the Mozilla Public License version 1.1
4 | 336920577=00000
5 | 336920578=00000
6 | 336920579=00000
7 | 336920580=00000
8 | 336920605=00000
9 | 336920606=00000
10 | 336920607=00000
11 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/firebird_22_sql_states.properties:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2000-2024 Firebird development team and individual contributors
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | # SPDX-FileComment: The keys and values listed here were obtained from the Firebird sources, which are licensed under the IPL (InterBase Public License) and/or IDPL (Initial Developer Public License), both are variants of the Mozilla Public License version 1.1
4 | 336986113=00000
5 | 336986114=00000
6 | 336986115=00000
7 | 336986116=00000
8 | 336986117=00000
9 | 336986118=00000
10 | 336986159=00000
11 | 336986160=00000
12 | 336986161=00000
13 | 336986162=00000
14 | 336986164=00000
15 | 336986170=00000
16 | 336986171=00000
17 | 336986172=00000
18 | 336986173=00000
19 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/firebird_23_error_msg.properties:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2000-2024 Firebird development team and individual contributors
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | # SPDX-FileComment: The keys and values listed here were obtained from the Firebird sources, which are licensed under the IPL (InterBase Public License) and/or IDPL (Initial Developer Public License), both are variants of the Mozilla Public License version 1.1
4 | 337051649=Switches trusted_user and trusted_role are not supported from command line
5 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/firebird_23_sql_states.properties:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2000-2024 Firebird development team and individual contributors
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | # SPDX-FileComment: The keys and values listed here were obtained from the Firebird sources, which are licensed under the IPL (InterBase Public License) and/or IDPL (Initial Developer Public License), both are variants of the Mozilla Public License version 1.1
4 | 337051649=00000
5 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/firebird_25_sql_states.properties:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2000-2024 Firebird development team and individual contributors
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | # SPDX-FileComment: The keys and values listed here were obtained from the Firebird sources, which are licensed under the IPL (InterBase Public License) and/or IDPL (Initial Developer Public License), both are variants of the Mozilla Public License version 1.1
4 | 337182750=00000
5 | 337182751=00000
6 | 337182752=00000
7 | 337182753=00000
8 | 337182754=00000
9 | 337182755=00000
10 | 337182756=00000
11 | 337182757=00000
12 | 337182758=00000
13 | 337182759=00000
14 | 337182760=00000
15 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/firebird_3_sql_states.properties:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2000-2024 Firebird development team and individual contributors
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | # SPDX-FileComment: The keys and values listed here were obtained from the Firebird sources, which are licensed under the IPL (InterBase Public License) and/or IDPL (Initial Developer Public License), both are variants of the Mozilla Public License version 1.1
4 | 335740929=00000
5 | 335740930=00000
6 | 335740932=00000
7 | 335740933=00000
8 | 335740934=00000
9 | 335740935=00000
10 | 335740936=00000
11 | 335740937=00000
12 | 335740940=00000
13 | 335740941=00000
14 | 335740942=00000
15 | 335740943=00000
16 | 335740944=00000
17 | 335740945=00000
18 | 335740946=00000
19 | 335740947=00000
20 | 335740948=00000
21 | 335740951=00000
22 | 335740991=00000
23 | 335740992=00000
24 | 335740993=00000
25 | 335740994=00000
26 | 335740995=00000
27 | 335741012=00000
28 | 335741018=00000
29 | 335741036=00000
30 | 335741038=00000
31 | 335741042=00000
32 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/jaybird/version.properties:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2019 Mark Rotteveel
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | jaybird.version.simple=@VERSION@
4 | jaybird.version.display=@NAME@ @MAVEN_NAME@-@VERSION_FULL@
5 | jaybird.version.major=@VERSION_MAJOR@
6 | jaybird.version.minor=@VERSION_MINOR@
7 |
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/jdbc/reserved_words_2_5.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2017-2020 Mark Rotteveel
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | #
4 | # Reserved words not reserved by SQL:2003
5 | # This file is only provided for reference, see FirebirdVersionMetaData for actually used values
6 | ADD
7 | ADMIN
8 | BIT_LENGTH
9 | CURRENT_CONNECTION
10 | CURRENT_TRANSACTION
11 | GDSCODE
12 | INDEX
13 | LONG
14 | MAXIMUM_SEGMENT
15 | PLAN
16 | POST_EVENT
17 | RDB$DB_KEY
18 | RECORD_VERSION
19 | RECREATE
20 | RETURNING_VALUES
21 | ROW_COUNT
22 | SQLCODE
23 | VARIABLE
24 | VIEW
25 | WHILE
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/jdbc/reserved_words_3_0.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2017-2020 Mark Rotteveel
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | #
4 | # Reserved words not reserved by SQL:2003
5 | # This file is only provided for reference, see FirebirdVersionMetaData for actually used values
6 | ADD
7 | ADMIN
8 | BIT_LENGTH
9 | CURRENT_CONNECTION
10 | CURRENT_TRANSACTION
11 | DELETING
12 | GDSCODE
13 | INDEX
14 | INSERTING
15 | LONG
16 | OFFSET
17 | PLAN
18 | POST_EVENT
19 | RDB$DB_KEY
20 | RDB$RECORD_VERSION
21 | RECORD_VERSION
22 | RECREATE
23 | RETURNING_VALUES
24 | ROW_COUNT
25 | SQLCODE
26 | UPDATING
27 | VARIABLE
28 | VIEW
29 | WHILE
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/jdbc/reserved_words_4_0.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2017-2021 Mark Rotteveel
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | #
4 | # Reserved words not reserved by SQL:2003
5 | # This file is only provided for reference, see FirebirdVersionMetaData for actually used values
6 | ADD
7 | ADMIN
8 | BIT_LENGTH
9 | COMMENT
10 | CURRENT_CONNECTION
11 | CURRENT_TRANSACTION
12 | DECFLOAT
13 | DELETING
14 | GDSCODE
15 | INDEX
16 | INSERTING
17 | INT128
18 | LONG
19 | OFFSET
20 | PLAN
21 | POST_EVENT
22 | PUBLICATION
23 | RDB$DB_KEY
24 | RDB$ERROR
25 | RDB$GET_CONTEXT
26 | RDB$GET_TRANSACTION_CN
27 | RDB$RECORD_VERSION
28 | RDB$ROLE_IN_USE
29 | RDB$SET_CONTEXT
30 | RDB$SYSTEM_PRIVILEGE
31 | RECORD_VERSION
32 | RECREATE
33 | RESETTING
34 | RETURNING_VALUES
35 | ROW_COUNT
36 | SQLCODE
37 | UNBOUNDED
38 | UPDATING
39 | VARBINARY
40 | VARIABLE
41 | VIEW
42 | WHILE
--------------------------------------------------------------------------------
/src/resources/org/firebirdsql/jdbc/reserved_words_5_0.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2017-2023 Mark Rotteveel
2 | # SPDX-License-Identifier: LGPL-2.1-or-later
3 | #
4 | # Reserved words not reserved by SQL:2003
5 | # This file is only provided for reference, see FirebirdVersionMetaData for actually used values
6 | ADD
7 | ADMIN
8 | BIT_LENGTH
9 | COMMENT
10 | CURRENT_CONNECTION
11 | CURRENT_TRANSACTION
12 | DECFLOAT
13 | DELETING
14 | GDSCODE
15 | INDEX
16 | INSERTING
17 | INT128
18 | LONG
19 | OFFSET
20 | PLAN
21 | POST_EVENT
22 | PUBLICATION
23 | RDB$DB_KEY
24 | RDB$ERROR
25 | RDB$GET_CONTEXT
26 | RDB$GET_TRANSACTION_CN
27 | RDB$RECORD_VERSION
28 | RDB$ROLE_IN_USE
29 | RDB$SET_CONTEXT
30 | RDB$SYSTEM_PRIVILEGE
31 | RECORD_VERSION
32 | RECREATE
33 | RESETTING
34 | RETURNING_VALUES
35 | ROW_COUNT
36 | SQLCODE
37 | UNBOUNDED
38 | UPDATING
39 | VARBINARY
40 | VARIABLE
41 | VIEW
42 | WHILE
--------------------------------------------------------------------------------
/src/test/org/firebirdsql/common/StreamHelper.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.common;
4 |
5 | import java.util.stream.IntStream;
6 |
7 | /**
8 | * Helpers for stream operations.
9 | *
10 | * @author Mark Rotteveel
11 | * @since 5
12 | */
13 | public class StreamHelper {
14 |
15 | /**
16 | * Returns an {@link IntStream} that iterates from {@code maxValue} to {@code minValue}.
17 | *
18 | * @param minValue Minimum (destination) value (inclusive)
19 | * @param maxValue Maximum (starting) value (inclusive)
20 | * @return stream over a closed range
21 | */
22 | public static IntStream reverseClosedRange(int minValue, int maxValue) {
23 | return IntStream.rangeClosed(minValue, maxValue)
24 | .map(i -> maxValue - i + minValue);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/test/org/firebirdsql/common/StreamHelperTest.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2022 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.common;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertArrayEquals;
8 |
9 | class StreamHelperTest {
10 |
11 | @Test
12 | void testReverseClosedRange() {
13 | int[] result = StreamHelper.reverseClosedRange(1, 5).toArray();
14 |
15 | assertArrayEquals(new int[] { 5, 4, 3, 2, 1 }, result);
16 | }
17 |
18 | }
--------------------------------------------------------------------------------
/src/test/org/firebirdsql/common/StringSocketFactory.java:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: Copyright 2024 Mark Rotteveel
2 | // SPDX-License-Identifier: LGPL-2.1-or-later
3 | package org.firebirdsql.common;
4 |
5 | /**
6 | * Socket factory for testing the {@code socketFactory} connection property with a {@link String} constructor argument.
7 | *
8 | * Contrary to {@link NoArgSocketFactory} and {@link PropertiesSocketFactory}, this variant does not allow socket
9 | * creation.
10 | *