Class JdbcSqlQueries
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<JdbcSqlQuery>
-
- org.silverpeas.core.persistence.jdbc.sql.JdbcSqlQueries
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<JdbcSqlQuery>
,Collection<JdbcSqlQuery>
,List<JdbcSqlQuery>
,RandomAccess
public class JdbcSqlQueries extends ArrayList<JdbcSqlQuery>
This class handles list ofJdbcSqlQuery
instance and provide a method execute to perform each one.
As there is no sense that the collection handles other query than those of modification, this collection is oriented to SQL query modifications.
The queries are executed into processes (transactional or not) without handling the connection to the database.- Author:
- Yohann Chastagnier
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description JdbcSqlQueries()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
execute()
Executes all the queries contained into the list.long
executeWith(Connection connection)
Executes all the queries contained into the list.static JdbcSqlQueries
from(Collection<String> sqlQueries)
Loads aJdbcSqlQuery
collection from collection of SQL queries as string.-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractCollection
containsAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
containsAll
-
-
-
-
Method Detail
-
from
public static JdbcSqlQueries from(Collection<String> sqlQueries)
Loads aJdbcSqlQuery
collection from collection of SQL queries as string.- Parameters:
sqlQueries
- list of SQL query as string.- Returns:
- an instance of
JdbcSqlQuery
collection instance.
-
execute
public long execute() throws SQLException
Executes all the queries contained into the list.- Returns:
- the number of entities that were inserted, updated or deleted by the queries.
- Throws:
SQLException
- on SQL error
-
executeWith
public long executeWith(Connection connection) throws SQLException
Executes all the queries contained into the list.- Parameters:
connection
- a connection to a database.- Returns:
- the number of entities that were inserted, updated or deleted by the queries.
- Throws:
SQLException
- on SQL error
-
-