- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull SQLDialect
dialect(io.r2dbc.spi.Connection connection)
"Guess" theSQLDialect
from an R2DBCConnection
instance.static @NotNull SQLDialect
dialect(io.r2dbc.spi.ConnectionFactory connection)
"Guess" theSQLDialect
from aConnectionFactory
instance.static @NotNull SQLDialect
"Guess" theSQLDialect
from a connection URL.static @NotNull SQLDialect
dialect(Connection connection)
"Guess" theSQLDialect
from aConnection
instance.static @NotNull String
"Guess" the JDBC driver from a connection URL.static @NotNull String
driver(SQLDialect dialect)
"Guess" the JDBC driver from aSQLDialect
.static void
Safely close a closeable.static void
safeClose(AutoCloseable closeable)
Safely close a closeable.static void
safeClose(Connection connection)
Safely close a connection.static void
Safely close a result set.static void
safeClose(ResultSet resultSet, PreparedStatement statement)
Safely close a result set and / or a statement.static void
Safely close a statement.static void
Safely free an Array object.static void
Safely free a blob.static void
Safely free a clob.static void
Safely free an XML object.static Boolean
wasNull(CallableStatement statement, Boolean value)
Convenient way to check if a JDBC-originated record wasnull
.static <T> T
wasNull(CallableStatement statement, T value)
Convenient way to check if a JDBC-originated record wasnull
.static Boolean
Convenient way to check if a JDBC-originated record wasnull
.static <T> T
Convenient way to check if a JDBC-originated record wasnull
.static Boolean
Convenient way to check if a JDBC-originated record wasnull
.static <T> T
Convenient way to check if a JDBC-originated record wasnull
.
-
Method Details
-
dialect
"Guess" theSQLDialect
from aConnection
instance.This method tries to guess the
SQLDialect
of a connection from the its connection URL as obtained byDatabaseMetaData.getURL()
. If the dialect cannot be guessed from the URL (e.g. when using an JDBC-ODBC bridge), further actions may be implemented in the future.- Returns:
- The appropriate
SQLDialect
orSQLDialect.DEFAULT
if no dialect could be derived from the connection. Nevernull
. - See Also:
dialect(String)
-
dialect
@NotNull public static final @NotNull SQLDialect dialect(io.r2dbc.spi.ConnectionFactory connection)"Guess" theSQLDialect
from aConnectionFactory
instance.This method tries to guess the
SQLDialect
of a connection from the itsConnectionFactoryMetadata
as obtained byConnectionFactory.getMetadata()
. If the dialect cannot be guessed, further actions may be implemented in the future.- Returns:
- The appropriate
SQLDialect
orSQLDialect.DEFAULT
if no dialect could be derived from the connection. Nevernull
. - See Also:
dialect(String)
-
dialect
"Guess" theSQLDialect
from an R2DBCConnection
instance.This method tries to guess the
SQLDialect
of a connection from the itsConnectionMetadata
as obtained byConnection.getMetadata()
. If the dialect cannot be, further actions may be implemented in the future.- Returns:
- The appropriate
SQLDialect
orSQLDialect.DEFAULT
if no dialect could be derived from the connection. Nevernull
. - See Also:
dialect(String)
-
dialect
"Guess" theSQLDialect
from a connection URL.- Returns:
- The appropriate
SQLDialect
orSQLDialect.DEFAULT
if no dialect could be derived from the connection. Nevernull
.
-
driver
"Guess" the JDBC driver from aSQLDialect
.- Returns:
- The appropriate JDBC driver class or
"java.sql.Driver"
if no driver class could be derived from the URL. Nevernull
.
-
driver
"Guess" the JDBC driver from a connection URL.- Returns:
- The appropriate JDBC driver class or
"java.sql.Driver"
if no driver class could be derived from the URL. Nevernull
.
-
safeClose
Safely close a connection.This method will silently ignore if
connection
isnull
, or ifConnection.close()
throws an exception. -
safeClose
Safely close a statement.This method will silently ignore if
statement
isnull
, or ifStatement.close()
throws an exception. -
safeClose
Safely close a result set.This method will silently ignore if
resultSet
isnull
, or ifResultSet.close()
throws an exception. -
safeClose
Safely close a result set and / or a statement.This method will silently ignore if
resultSet
orstatement
isnull
, or ifResultSet.close()
orStatement.close()
throws an exception. -
safeClose
Safely close a closeable.This method will silently ignore if
closeable
isnull
, or ifCloseable.close()
throws an exception. -
safeClose
Safely close a closeable.This method will silently ignore if
closeable
isnull
, or ifAutoCloseable.close()
throws an exception. -
safeFree
Safely free a blob.This method will silently ignore if
blob
isnull
, or ifBlob.free()
throws an exception. -
safeFree
Safely free a clob.This method will silently ignore if
clob
isnull
, or ifClob.free()
throws an exception. -
safeFree
Safely free an XML object.This method will silently ignore if
xml
isnull
, or ifSQLXML.free()
throws an exception. -
safeFree
Safely free an Array object.This method will silently ignore if
array
isnull
, or ifArray.free()
throws an exception. -
wasNull
Convenient way to check if a JDBC-originated record wasnull
.This is useful to check if primitive types obtained from the JDBC API were actually SQL NULL values.
- Parameters:
stream
- The data source from which a value was readvalue
- The value that was read- Returns:
- The
value
ornull
if theSQLInput.wasNull()
istrue
- Throws:
SQLException
-
wasNull
Convenient way to check if a JDBC-originated record wasnull
.This is useful to check if primitive types obtained from the JDBC API were actually SQL NULL values.
- Parameters:
stream
- The data source from which a value was readvalue
- The value that was read- Returns:
- The
value
ornull
if theSQLInput.wasNull()
istrue
- Throws:
SQLException
-
wasNull
Convenient way to check if a JDBC-originated record wasnull
.This is useful to check if primitive types obtained from the JDBC API were actually SQL NULL values.
- Parameters:
stream
- The data source from which a value was readvalue
- The value that was read- Returns:
- The
value
ornull
if theSQLInput.wasNull()
istrue
- Throws:
SQLException
-
wasNull
Convenient way to check if a JDBC-originated record wasnull
.This is useful to check if primitive types obtained from the JDBC API were actually SQL NULL values.
- Parameters:
rs
- The data source from which a value was readvalue
- The value that was read- Returns:
- The
value
ornull
if theResultSet.wasNull()
istrue
- Throws:
SQLException
-
wasNull
Convenient way to check if a JDBC-originated record wasnull
.This is useful to check if primitive types obtained from the JDBC API were actually SQL NULL values.
- Parameters:
rs
- The data source from which a value was readvalue
- The value that was read- Returns:
- The
value
ornull
if theResultSet.wasNull()
istrue
- Throws:
SQLException
-
wasNull
Convenient way to check if a JDBC-originated record wasnull
.This is useful to check if primitive types obtained from the JDBC API were actually SQL NULL values.
- Parameters:
rs
- The data source from which a value was readvalue
- The value that was read- Returns:
- The
value
ornull
if theResultSet.wasNull()
istrue
- Throws:
SQLException
-
wasNull
Convenient way to check if a JDBC-originated record wasnull
.This is useful to check if primitive types obtained from the JDBC API were actually SQL NULL values.
- Parameters:
statement
- The data source from which a value was readvalue
- The value that was read- Returns:
- The
value
ornull
if theCallableStatement.wasNull()
istrue
- Throws:
SQLException
-
wasNull
public static final <T extends Number> T wasNull(CallableStatement statement, T value) throws SQLExceptionConvenient way to check if a JDBC-originated record wasnull
.This is useful to check if primitive types obtained from the JDBC API were actually SQL NULL values.
- Parameters:
statement
- The data source from which a value was readvalue
- The value that was read- Returns:
- The
value
ornull
if theCallableStatement.wasNull()
istrue
- Throws:
SQLException
-
wasNull
public static final Boolean wasNull(CallableStatement statement, Boolean value) throws SQLExceptionConvenient way to check if a JDBC-originated record wasnull
.This is useful to check if primitive types obtained from the JDBC API were actually SQL NULL values.
- Parameters:
statement
- The data source from which a value was readvalue
- The value that was read- Returns:
- The
value
ornull
if theCallableStatement.wasNull()
istrue
- Throws:
SQLException
-