Class SQLStatement
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.sql.jdbc.dialect.SQLStatement
-
public class SQLStatement extends Object
A SQL statement and some optional tags that condition execution.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SQLStatement.ListCollector
Collects a list of strings.static class
SQLStatement.Tag
Tags that may condition execution of the statement.
-
Constructor Summary
Constructors Constructor Description SQLStatement(String sql, List<SQLStatement.Tag> tags)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
execute(List<SQLStatement> statements, String ddlMode, Map<String,Serializable> properties, Dialect dialect, Connection connection, JDBCLogger logger, SQLStatement.ListCollector ddlCollector)
Executes a list of SQL statements, following the tags.static Map<String,List<SQLStatement>>
read(String filename, Map<String,List<SQLStatement>> statements)
Reads SQL statements from a text file.static Map<String,List<SQLStatement>>
read(String filename, Map<String,List<SQLStatement>> statements, boolean allDDL)
protected static String
replaceVars(String sql, Map<String,Serializable> properties)
String
toString()
-
-
-
Field Detail
-
CATEGORY
public static final String CATEGORY
Category pseudo-tag- See Also:
- Constant Field Values
-
sql
public final String sql
SQL statement
-
tags
public final List<SQLStatement.Tag> tags
Tags on the statement
-
-
Constructor Detail
-
SQLStatement
public SQLStatement(String sql, List<SQLStatement.Tag> tags)
-
-
Method Detail
-
read
public static Map<String,List<SQLStatement>> read(String filename, Map<String,List<SQLStatement>> statements) throws IOException
Reads SQL statements from a text file.Statements have a category, and optional tags (that may condition execution).
#CATEGORY: mycat #TEST: SELECT foo from bar;
#CATEGORY: mycat #IF: emptyResult #IF: somethingEnabled INSERT INTO ...;
An empty line terminates a statement.- Throws:
IOException
-
read
public static Map<String,List<SQLStatement>> read(String filename, Map<String,List<SQLStatement>> statements, boolean allDDL) throws IOException
- Throws:
IOException
-
replaceVars
protected static String replaceVars(String sql, Map<String,Serializable> properties)
-
execute
public static void execute(List<SQLStatement> statements, String ddlMode, Map<String,Serializable> properties, Dialect dialect, Connection connection, JDBCLogger logger, SQLStatement.ListCollector ddlCollector) throws SQLException
Executes a list of SQL statements, following the tags.- Throws:
SQLException
-
-