Nuxeo Enterprise Platform 5.4

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 java.lang.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 java.lang.String CATEGORY
          Category pseudo-tag
static java.lang.String DIALECT_WITH_NO_SEMICOLON
           
 java.lang.String sql
          SQL statement
 java.util.List<SQLStatement.Tag> tags
          Tags on the statement
 
Constructor Summary
SQLStatement(java.lang.String sql, java.util.List<SQLStatement.Tag> tags)
           
 
Method Summary
static void execute(java.util.List<SQLStatement> statements, java.util.Map<java.lang.String,java.io.Serializable> properties, JDBCConnection jdbc)
          Executes a list of SQL statements, following the tags.
static java.util.Map<java.lang.String,java.util.List<SQLStatement>> read(java.lang.String filename, java.util.Map<java.lang.String,java.util.List<SQLStatement>> statements)
          Reads SQL statements from a text file.
 java.lang.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 java.lang.String DIALECT_WITH_NO_SEMICOLON
See Also:
Constant Field Values

CATEGORY

public static final java.lang.String CATEGORY
Category pseudo-tag

See Also:
Constant Field Values

sql

public final java.lang.String sql
SQL statement


tags

public final java.util.List<SQLStatement.Tag> tags
Tags on the statement

Constructor Detail

SQLStatement

public SQLStatement(java.lang.String sql,
                    java.util.List<SQLStatement.Tag> tags)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

read

public static java.util.Map<java.lang.String,java.util.List<SQLStatement>> read(java.lang.String filename,
                                                                                java.util.Map<java.lang.String,java.util.List<SQLStatement>> statements)
                                                                         throws java.io.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:
java.io.IOException

execute

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

Throws:
java.sql.SQLException

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.