Top Description Inners Fields Constructors Methods
org.hibernate.tool.schema.internal.script

public Class MultiLineSqlScriptExtractor

extends Object
implements SqlScriptCommandExtractor
Class Inheritance
All Implemented Interfaces
org.hibernate.tool.schema.spi.SqlScriptCommandExtractor, org.hibernate.service.Service, java.io.Serializable
Imports
java.io.IOException, .Reader, java.util.List, org.hibernate.dialect.Dialect, org.hibernate.grammars.importsql.SqlScriptLexer, .SqlScriptParser, org.hibernate.tool.schema.spi.SqlScriptCommandExtractor, .SqlScriptException, org.antlr.v4.runtime.BailErrorStrategy, .BaseErrorListener, .CharStreams, .CommonTokenStream, .ConsoleErrorListener, .DefaultErrorStrategy, .RecognitionException, .Recognizer, org.antlr.v4.runtime.atn.PredictionMode, org.antlr.v4.runtime.misc.ParseCancellationException

Class responsible for extracting SQL statements from import script. Supports instructions/comments and quoted strings spread over multiple lines. Each statement must end with semicolon.
Authors
Lukasz Antoniak, Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final MultiLineSqlScriptExtractor
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static SqlScriptParser.ScriptContext
private static SqlScriptParser.ScriptContext
private static SqlScriptParser.ScriptContext
public List<String>
extractCommands(Reader reader, Dialect dialect)

Implements org.hibernate.tool.schema.spi.SqlScriptCommandExtractor.extractCommands.

Read the commands from the SQL script represented by the incoming reader, returning those commands as an array
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final MultiLineSqlScriptExtractor INSTANCE
SHORT_NAMEback to summary
public static final String SHORT_NAME

Constructor Detail

MultiLineSqlScriptExtractorback to summary
public MultiLineSqlScriptExtractor()

Method Detail

buildScriptParseTreeback to summary
private static SqlScriptParser.ScriptContext buildScriptParseTree(Reader reader) throws IOException
buildScriptParseTreeback to summary
private static SqlScriptParser.ScriptContext buildScriptParseTree(SqlScriptLexer lexer)
buildScriptParseTreeback to summary
private static SqlScriptParser.ScriptContext buildScriptParseTree(SqlScriptLexer lexer, SqlScriptParser parser)
extractCommandsback to summary
public List<String> extractCommands(Reader reader, Dialect dialect)

Implements org.hibernate.tool.schema.spi.SqlScriptCommandExtractor.extractCommands.

Doc from org.hibernate.tool.schema.spi.SqlScriptCommandExtractor.extractCommands.

Read the commands from the SQL script represented by the incoming reader, returning those commands as an array

Annotations
@Override
org.hibernate.tool.schema.internal.script back to summary

public Class MultiLineSqlScriptExtractor.VerboseListener

extends BaseErrorListener
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
syntaxError(Recognizer<?, ?>
What parser got the error. From this object, you can access the context as well as the input stream.
recognizer
,
Object
The offending token in the input token stream, unless recognizer is a lexer (then it's null). If no viable alternative error, e has token at which we started production for the decision.
offendingSymbol
,
int
The line number in the input where the error occurred.
line
,
int
The character position within that line where the error occurred.
charPositionInLine
,
String
The message to emit.
msg
,
RecognitionException
The exception generated by the parser that led to the reporting of an error. It is null in the case where the parser was able to recover in line without exiting the surrounding rule.
e
)

Overrides org.antlr.v4.runtime.BaseErrorListener.syntaxError.

Implements org.antlr.v4.runtime.ANTLRErrorListener.syntaxError.

Upon syntax error, notify any interested parties.
Inherited from org.antlr.v4.runtime.BaseErrorListener:
reportAmbiguityreportAttemptingFullContextreportContextSensitivity

Constructor Detail

VerboseListenerback to summary
public VerboseListener()

Method Detail

syntaxErrorback to summary
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e)

Overrides org.antlr.v4.runtime.BaseErrorListener.syntaxError.

Implements org.antlr.v4.runtime.ANTLRErrorListener.syntaxError.

Doc from org.antlr.v4.runtime.ANTLRErrorListener.syntaxError.

Upon syntax error, notify any interested parties. This is not how to recover from errors or compute error messages. ANTLRErrorStrategy specifies how to recover from syntax errors and how to compute error messages. This listener's job is simply to emit a computed message, though it has enough information to create its own message in many cases.

The RecognitionException is non-null for all syntax errors except when we discover mismatched token errors that we can recover from in-line, without returning from the surrounding rule (via the single token insertion and deletion mechanism).

Parameters
recognizer:Recognizer<?, ?>

What parser got the error. From this object, you can access the context as well as the input stream.

offendingSymbol:Object

The offending token in the input token stream, unless recognizer is a lexer (then it's null). If no viable alternative error, e has token at which we started production for the decision.

line:int

The line number in the input where the error occurred.

charPositionInLine:int

The character position within that line where the error occurred.

msg:String

The message to emit.

e:RecognitionException

The exception generated by the parser that led to the reporting of an error. It is null in the case where the parser was able to recover in line without exiting the surrounding rule.

Annotations
@Override