Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.kodo.impl.jdbc
Interface SQLExecutionManager

All Known Implementing Classes:
  SQLExecutionManagerImpl

public interface SQLExecutionManager

Manager for execution SQL Statements. It provides the following services:

- Determine whether to use a PreparedStatement or Statement
- Possibly batching together multiple similiar Statements or PreparedStatements

The lifespan of a SQLExecutionManager is the same as the lifespan of a Connection's commit process. A single SQLExecutionManager is associates with at most one `Connection` object. The impementation may choose to only instantiate this Connection object if SQL is actually going to be executed through the manager.

When the source invocation needs to know when the update has occured (e.g., in order to check for the update count to validate that an optimistic lock has not been violated), it can notify the Update with a `SQLExecutionCallback` instance. E.g.,

    	mySQLExecutionManager.execute (myDelete, new SQLExecutionCallback ()
    	{
    		public void afterUpdate (SQLBuffer buffer, int updateCount)
    		{
    			if (updateCount == 0)
    				throw new JDOUserException ("An optimistic lock error occured");
    		}
    	});

The callback will be invoked the next time the buffer is flushed (possibly upon the commit() method of the StoreManager).

SQLExecution managers should be obtained through the factory methods in `SQLExecutionManagerFactory`.

Since:
  2.4
See Also:
  `SQLBuffer`, `SQLExecutionManagerFactory`

Method Summary
`boolean` | `addSQLExecutionListener(SQLExecutionListener listener)` Adds a listerer to be notified whenever a SQL event occurs.
`void` | `close()` Close the underlying Connection to the DataStore.
`void` | `close(ResultSet rs)` Indicate to the manager that this ResultSet is no longer needed.
`void` | `commit()` Flush any remaining queued statements and commit to the data store.
`void` | `execute(NonSelectingSQL statement)` Execute the given SQLBuffer on the Connection, either in a batched or non-batched Statement or PreparedStatement.
`void` | `execute(NonSelectingSQL statement, SQLExecutionCallback callback)` Execute the given SQLBuffer on the Connection, either in a batched or non-batched Statement or PreparedStatement.
`void` | `execute(SQLBuffer buffer)` Execute the given SQLBuffer on the Connection, either in a batched or non-batched Statement or PreparedStatement.
`int` | `executeNow(NonSelectingSQL statement)` Execute the given NonSelectingSQL immediately, returning the number of updates made.
`int` | `executeNow(SQLBuffer buffer)` Execute the given SQLBuffer update the specified Connection, either in a in a non-batched Statement or PreparedStatement.
`ResultSet` | `executeQuery(Select select)` Execute the given Select statement on the specified Connection, either in a batched or non-batched Statement or PreparedStatement.
`ResultSet` | `executeQuery(Select select, int type, int concur)` Execute the given Select statement on the specified Connection, either in a batched or non-batched Statement or PreparedStatement.
`ResultSet` | `executeQuery(SQLBuffer buffer)` Execute the given SQLBuffer on the specified Connection, either in a batched or non-batched Statement or PreparedStatement.
`ResultSet` | `executeQuery(SQLBuffer buffer, int type, int concur)` Execute the given SQLBuffer on the specified Connection, either in a batched or non-batched Statement or PreparedStatement.
`int[]` | `flush()` Flush any pending statements in the queue and retun an array of the number of update counts.
`Collection` | `getCallbackExceptions()` Return all user exceptions thrown by callbacks since the end of the last transaction.
`JDBCConfiguration` | `getConfiguration()` Returns the JDBCConfiguration set in this object upon creation.
`Connection` | `getConnection()` Returns the Connection that is being used for this manager.
`Connector` | `getConnector()` Return the Connector in use by the SQLExecutionManager.
`DBDictionary` | `getDictionary()` Returns the DBDictionary to use when creating SQL statements.
`boolean` | `removeSQLExecutionListener(SQLExecutionListener listener)` Removes a listerer to be notified whenever a SQL event occurs.
`void` | `rollback()` Rolls back the underlying connection.
`void` | `setConfiguration(JDBCConfiguration config)` Set the Configuration for this object.
`void` | `setConnector(Connector connector)` Set the `Connector` to be used for this manager.

Method Detail

### execute

    public void execute(NonSelectingSQL statement)
                 throws SQLException

  Execute the given SQLBuffer on the Connection, either in a batched or non-batched Statement or PreparedStatement. After calling a sequence of multiple `execute()` methods, `flush()` should be invoked in order to ensure that statements are flushed to the data store. For immediate execution, call the executeNow method.
  See Also:
    `executeNow(com.solarmetric.kodo.impl.jdbc.sql.NonSelectingSQL)`

### execute

    public void execute(NonSelectingSQL statement,
                        SQLExecutionCallback callback)
                 throws SQLException

  Execute the given SQLBuffer on the Connection, either in a batched or non-batched Statement or PreparedStatement. After calling a sequence of multiple `execute()` methods, `flush()` should be invoked in order to ensure that statements are flushed to the data store. For immediate execution, call the executeNow method.
  Parameters:
    `statement` - the Statement to execute
    `callback` - the callback to invoke after the update occurs
  See Also:
    `executeNow(com.solarmetric.kodo.impl.jdbc.sql.NonSelectingSQL)`

### executeNow

    public int executeNow(NonSelectingSQL statement)
                   throws SQLException

  Execute the given NonSelectingSQL immediately, returning the number of updates made.
  See Also:
    `executeNow(com.solarmetric.kodo.impl.jdbc.sql.NonSelectingSQL)`

### executeQuery

    public ResultSet executeQuery(Select select)
                           throws SQLException

  Execute the given Select statement on the specified Connection, either in a batched or non-batched Statement or PreparedStatement.

### executeQuery

    public ResultSet executeQuery(Select select,
                                  int type,
                                  int concur)
                           throws SQLException

  Execute the given Select statement on the specified Connection, either in a batched or non-batched Statement or PreparedStatement.
  Parameters:
    `type` - the type of ResultSet to return
    `concur` - the concurrency of the ResultSet

### execute

    public void execute(SQLBuffer buffer)
                 throws SQLException

  Execute the given SQLBuffer on the Connection, either in a batched or non-batched Statement or PreparedStatement. After calling a sequence of multiple `execute()` methods, `flush()` should be invoked in order to ensure that statements are flushed to the data store. For immediate execution, call the executeNow method.
  See Also:
    `#executeNow(com.solarmetric.kodo.impl.jdbc.SQLBuffer)`

### executeNow

    public int executeNow(SQLBuffer buffer)
                   throws SQLException

  Execute the given SQLBuffer update the specified Connection, either in a in a non-batched Statement or PreparedStatement.

### executeQuery

    public ResultSet executeQuery(SQLBuffer buffer)
                           throws SQLException

  Execute the given SQLBuffer on the specified Connection, either in a batched or non-batched Statement or PreparedStatement.

### executeQuery

    public ResultSet executeQuery(SQLBuffer buffer,
                                  int type,
                                  int concur)
                           throws SQLException

  Execute the given SQLBuffer on the specified Connection, either in a batched or non-batched Statement or PreparedStatement.
  Parameters:
    `type` - the type of ResultSet to return
    `concur` - the concurrency of the ResultSet

### setConfiguration

    public void setConfiguration(JDBCConfiguration config)

  Set the Configuration for this object.

### getConfiguration

    public JDBCConfiguration getConfiguration()

  Returns the JDBCConfiguration set in this object upon creation. It may never be null.

### setConnector

    public void setConnector(Connector connector)

  Set the `Connector` to be used for this manager.

### getConnector

    public Connector getConnector()

  Return the Connector in use by the SQLExecutionManager.

### getConnection

    public Connection getConnection()
                             throws SQLException

  Returns the Connection that is being used for this manager. The life cycle of this connection will be managed by the SQLExecutionManager.

### getDictionary

    public DBDictionary getDictionary()

  Returns the DBDictionary to use when creating SQL statements.

### flush

    public int[] flush()
                throws SQLException

  Flush any pending statements in the queue and retun an array of the number of update counts.

### getCallbackExceptions

    public Collection getCallbackExceptions()

  Return all user exceptions thrown by callbacks since the end of the last transaction.

### commit

    public void commit()
                throws SQLException

  Flush any remaining queued statements and commit to the data store.

### close

    public void close()
               throws SQLException

  Close the underlying Connection to the DataStore.

### rollback

    public void rollback()
                  throws SQLException

  Rolls back the underlying connection.

### close

    public void close(ResultSet rs)
               throws SQLException

  Indicate to the manager that this ResultSet is no longer needed. The Statement that was used to create the ResultSet should no longer be used, as the implementation may choose to close it or return it to a pool for later reuse.

### addSQLExecutionListener

    public boolean addSQLExecutionListener(SQLExecutionListener listener)

  Adds a listerer to be notified whenever a SQL event occurs.

### removeSQLExecutionListener

    public boolean removeSQLExecutionListener(SQLExecutionListener listener)

  Removes a listerer to be notified whenever a SQL event occurs.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.