ScriptUtils
instead.@Deprecated public abstract class ScriptUtils extends Object
Mainly for internal use within the framework.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_BLOCK_COMMENT_END_DELIMITER
Deprecated.
Default end delimiter for block comments within SQL scripts:
"*/" . |
static String |
DEFAULT_BLOCK_COMMENT_START_DELIMITER
Deprecated.
Default start delimiter for block comments within SQL scripts:
"/*" . |
static String |
DEFAULT_COMMENT_PREFIX
Deprecated.
Default prefix for single-line comments within SQL scripts:
"--" . |
static String |
DEFAULT_STATEMENT_SEPARATOR
Deprecated.
Default statement separator within SQL scripts:
";" . |
static String |
EOF_STATEMENT_SEPARATOR
Deprecated.
End of file (EOF) SQL statement separator:
"^^^ END OF SCRIPT ^^^" . |
static String |
FALLBACK_STATEMENT_SEPARATOR
Deprecated.
Fallback statement separator within SQL scripts:
"\n" . |
Modifier and Type | Method and Description |
---|---|
static reactor.core.publisher.Mono<Void> |
executeSqlScript(Connection connection,
EncodedResource resource)
Deprecated.
Execute the given SQL script using default settings for statement separators, comment delimiters, and exception
handling flags.
|
static reactor.core.publisher.Mono<Void> |
executeSqlScript(Connection connection,
EncodedResource resource,
DataBufferFactory dataBufferFactory,
boolean continueOnError,
boolean ignoreFailedDrops,
String commentPrefix,
String separator,
String blockCommentStartDelimiter,
String blockCommentEndDelimiter)
Deprecated.
Execute the given SQL script.
|
static reactor.core.publisher.Mono<Void> |
executeSqlScript(Connection connection,
Resource resource)
Deprecated.
Execute the given SQL script using default settings for statement separators, comment delimiters, and exception
handling flags.
|
static reactor.core.publisher.Mono<String> |
readScript(EncodedResource resource,
DataBufferFactory dataBufferFactory)
Deprecated.
Read a script without blocking from the given resource, using "
-- " as the comment prefix and "; " as
the statement separator, and build a String containing the lines. |
public static final String DEFAULT_STATEMENT_SEPARATOR
";"
.public static final String FALLBACK_STATEMENT_SEPARATOR
"\n"
.
Used if neither a custom separator nor the DEFAULT_STATEMENT_SEPARATOR
is present in a given script.
public static final String EOF_STATEMENT_SEPARATOR
"^^^ END OF SCRIPT ^^^"
.
This value may be supplied as the separator
to
executeSqlScript(Connection, EncodedResource, DataBufferFactory, boolean, boolean, String, String, String, String)
to denote that an SQL script contains a single statement (potentially spanning multiple lines) with no explicit
statement separator. Note that such a script should not actually contain this value; it is merely a
virtual statement separator.
public static final String DEFAULT_COMMENT_PREFIX
"--"
.public static final String DEFAULT_BLOCK_COMMENT_START_DELIMITER
"/*"
.public static final String DEFAULT_BLOCK_COMMENT_END_DELIMITER
"*/"
.public static reactor.core.publisher.Mono<String> readScript(EncodedResource resource, DataBufferFactory dataBufferFactory)
--
" as the comment prefix and ";
" as
the statement separator, and build a String containing the lines.resource
- the EncodedResource
to be read.dataBufferFactory
- the buffer factory for non-blocking script loading.String
containing the script lines.DefaultDataBufferFactory
public static reactor.core.publisher.Mono<Void> executeSqlScript(Connection connection, Resource resource) throws ScriptException
Statement separators and comments will be removed before executing individual statements within the supplied script.
Warning: this method does not release the provided Connection
.
connection
- the R2DBC connection to use to execute the script; already configured and ready to use.resource
- the resource to load the SQL script from; encoded with the current platform's default encoding.Mono
that initiates script execution and is notified upon completion.ScriptException
- if an error occurred while executing the SQL script.executeSqlScript(Connection, EncodedResource, DataBufferFactory, boolean, boolean, String, String, String,
String)
,
DEFAULT_STATEMENT_SEPARATOR
,
DEFAULT_COMMENT_PREFIX
,
DEFAULT_BLOCK_COMMENT_START_DELIMITER
,
DEFAULT_BLOCK_COMMENT_END_DELIMITER
,
ConnectionFactoryUtils.getConnection(io.r2dbc.spi.ConnectionFactory)
,
ConnectionFactoryUtils.releaseConnection(io.r2dbc.spi.Connection, io.r2dbc.spi.ConnectionFactory)
public static reactor.core.publisher.Mono<Void> executeSqlScript(Connection connection, EncodedResource resource) throws ScriptException
Statement separators and comments will be removed before executing individual statements within the supplied script.
Warning: this method does not release the provided Connection
.
connection
- the R2DBC connection to use to execute the script; already configured and ready to use.resource
- the resource (potentially associated with a specific encoding) to load the SQL script from.Mono
that initiates script execution and is notified upon completion.ScriptException
- if an error occurred while executing the SQL script.executeSqlScript(Connection, EncodedResource, DataBufferFactory, boolean, boolean, String, String, String,
String)
,
DEFAULT_STATEMENT_SEPARATOR
,
DEFAULT_COMMENT_PREFIX
,
DEFAULT_BLOCK_COMMENT_START_DELIMITER
,
DEFAULT_BLOCK_COMMENT_END_DELIMITER
,
ConnectionFactoryUtils.getConnection(io.r2dbc.spi.ConnectionFactory)
,
ConnectionFactoryUtils.releaseConnection(io.r2dbc.spi.Connection, io.r2dbc.spi.ConnectionFactory)
public static reactor.core.publisher.Mono<Void> executeSqlScript(Connection connection, EncodedResource resource, DataBufferFactory dataBufferFactory, boolean continueOnError, boolean ignoreFailedDrops, String commentPrefix, @Nullable String separator, String blockCommentStartDelimiter, String blockCommentEndDelimiter) throws ScriptException
Statement separators and comments will be removed before executing individual statements within the supplied script.
Warning: this method does not release the provided Connection
.
connection
- the R2DBC connection to use to execute the script; already configured and ready to use.dataBufferFactory
- the buffer factory for non-blocking script loading.resource
- the resource (potentially associated with a specific encoding) to load the SQL script from.continueOnError
- whether or not to continue without throwing an exception in the event of an error.ignoreFailedDrops
- whether or not to continue in the event of specifically an error on a DROP
statement.commentPrefix
- the prefix that identifies single-line comments in the SQL script (typically "--").separator
- the script statement separator; defaults to ";" if not specified
and falls back to "\n" as a last resort; may be set to
"^^^ END OF SCRIPT ^^^" to signal that the script contains a single statement without a
separator.blockCommentStartDelimiter
- the start block comment delimiter.blockCommentEndDelimiter
- the end block comment delimiter.Mono
that initiates script execution and is notified upon completion.ScriptException
- if an error occurred while executing the SQL script.DEFAULT_STATEMENT_SEPARATOR
,
FALLBACK_STATEMENT_SEPARATOR
,
EOF_STATEMENT_SEPARATOR
,
ConnectionFactoryUtils.getConnection(io.r2dbc.spi.ConnectionFactory)
,
ConnectionFactoryUtils.releaseConnection(io.r2dbc.spi.Connection, io.r2dbc.spi.ConnectionFactory)
Copyright © 2018–2022 Pivotal Software, Inc.. All rights reserved.