Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.storage.sql.jdbc.dialect
Class SQLStatement

java.lang.Object
  extended by 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
static class SQLStatement.Tag
          Tags that may condition execution of the statement.
 
Field Summary
static String CATEGORY
          Category pseudo-tag
static String DIALECT_WITH_NO_SEMICOLON
           
 String sql
          SQL statement
 List<SQLStatement.Tag> tags
          Tags on the statement
 
Constructor Summary
SQLStatement(String sql, List<SQLStatement.Tag> tags)
           
 
Method Summary
static void execute(List<SQLStatement> statements, Map<String,Serializable> properties, JDBCConnection jdbc)
          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.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIALECT_WITH_NO_SEMICOLON

public static final String DIALECT_WITH_NO_SEMICOLON
See Also:
Constant Field Values

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

toString

public String toString()
Overrides:
toString in class Object

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

execute

public static void execute(List<SQLStatement> statements,
                           Map<String,Serializable> properties,
                           JDBCConnection jdbc)
                    throws SQLException
Executes a list of SQL statements, following the tags.

Throws:
SQLException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.