org.objectweb.cjdbc.common.sql
Class StoredProcedure

java.lang.Object
  extended byorg.objectweb.cjdbc.common.sql.AbstractRequest
      extended byorg.objectweb.cjdbc.common.sql.StoredProcedure
All Implemented Interfaces:
java.io.Serializable

public class StoredProcedure
extends AbstractRequest

A StoredProcedure is a SQL request with the following syntax:

 
   {call <procedure-name>[<arg1>,<arg2>, ...]}
  
 

Version:
1.0
Author:
Emmanuel Cecchet
See Also:
Serialized Form

Field Summary
private  boolean blocking
          true if this request might block.
private  java.lang.String procedureName
           
private  boolean returnsRS
           
private static long serialVersionUID
           
 
Fields inherited from class org.objectweb.cjdbc.common.sql.AbstractRequest
cacheable, cursorName, escapeProcessing, fetchSize, id, isAutoCommit, isParsed, isReadOnly, login, maxRows, requestType, sqlQuery, sqlSkeleton, timeoutInSeconds, transactionId, transactionIsolation
 
Constructor Summary
StoredProcedure(CJDBCInputStream in)
           
StoredProcedure(java.lang.String sqlQuery, boolean escapeProcessing, int timeout, java.lang.String lineSeparator, boolean isRead)
          Creates a new StoredProcedure instance.
 
Method Summary
 void cloneParsing(AbstractRequest request)
          Always throws a SQLException: it is useless to parse a stored procedure call since we can't know which tables are affected by this procedure.
 java.lang.String getProcedureName()
          Get the stored procedure name
 boolean mightBlock()
          Tests if this request might block.
 boolean needsMacroProcessing()
          Returns true if this request requires macro (RAND(), NOW(), ...) processing.
 void parse(DatabaseSchema schema, int granularity, boolean isCaseSensitive)
          Just get the stored procedure name.
 boolean returnsResultSet()
          Does this request returns a ResultSet?
 void sendToStream(CJDBCOutputStream out, boolean needSkeleton)
          Serialize the request on the output stream by sending only the needed parameters to reconstruct it on the controller.
 void setBlocking(boolean blocking)
          Sets if this request might block.
 
Methods inherited from class org.objectweb.cjdbc.common.sql.AbstractRequest
debug, equals, getCacheAbility, getCursorName, getEscapeProcessing, getFetchSize, getId, getLineSeparator, getLogin, getMaxRows, getSQL, getSQLShortForm, getSqlSkeleton, getTimeout, getTransactionId, getTransactionIsolation, isAlter, isAutoCommit, isCreate, isDDL, isDelete, isDML, isDriverProcessed, isDrop, isInsert, isParsed, isReadOnly, isSelect, isUpdate, receiveResultSetParams, sendResultSetParams, setCacheAbility, setCursorName, setDriverProcessed, setFetchSize, setId, setIsAutoCommit, setIsReadOnly, setLogin, setMaxRows, setSQL, setSqlSkeleton, setTimeout, setTransactionId, setTransactionIsolation, trimCarriageReturnAndTabs
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

blocking

private transient boolean blocking
true if this request might block.


procedureName

private transient java.lang.String procedureName

returnsRS

private final boolean returnsRS
Constructor Detail

StoredProcedure

public StoredProcedure(java.lang.String sqlQuery,
                       boolean escapeProcessing,
                       int timeout,
                       java.lang.String lineSeparator,
                       boolean isRead)
Creates a new StoredProcedure instance.

Parameters:
sqlQuery - the SQL request
escapeProcessing - should the driver to escape processing before sending to the database ?
timeout - an int value
lineSeparator - the line separator used in the query
isRead - does the request expects a ResultSet ?
See Also:
parse(org.objectweb.cjdbc.common.sql.schema.DatabaseSchema, int, boolean)

StoredProcedure

public StoredProcedure(CJDBCInputStream in)
                throws java.io.IOException
See Also:
AbstractRequest
Method Detail

sendToStream

public void sendToStream(CJDBCOutputStream out,
                         boolean needSkeleton)
                  throws java.io.IOException
Description copied from class: AbstractRequest
Serialize the request on the output stream by sending only the needed parameters to reconstruct it on the controller. Has to mirror the deserialization method above.

Overrides:
sendToStream in class AbstractRequest
Parameters:
out - destination CJDBCOutputStream
needSkeleton - true if controller wants SQL templates
Throws:
java.io.IOException - if fails
See Also:
AbstractRequest.sendToStream(org.objectweb.cjdbc.common.stream.CJDBCOutputStream, boolean)

needsMacroProcessing

public boolean needsMacroProcessing()
Description copied from class: AbstractRequest
Returns true if this request requires macro (RAND(), NOW(), ...) processing.

Specified by:
needsMacroProcessing in class AbstractRequest
Returns:
false
See Also:
AbstractRequest.needsMacroProcessing()

returnsResultSet

public boolean returnsResultSet()
Description copied from class: AbstractRequest
Does this request returns a ResultSet?

Specified by:
returnsResultSet in class AbstractRequest
Returns:
true is this request will return a ResultSet
See Also:
AbstractRequest.returnsResultSet()

getProcedureName

public java.lang.String getProcedureName()
Get the stored procedure name

Returns:
the stored procedure name

mightBlock

public boolean mightBlock()
Tests if this request might block.

Returns:
true if this request might block

setBlocking

public void setBlocking(boolean blocking)
Sets if this request might block.

Parameters:
blocking - a boolean value

parse

public void parse(DatabaseSchema schema,
                  int granularity,
                  boolean isCaseSensitive)
           throws java.sql.SQLException
Just get the stored procedure name.

Specified by:
parse in class AbstractRequest
Parameters:
schema - a DatabaseSchema value
granularity - parsing granularity as defined in ParsingGranularities
isCaseSensitive - true if parsing must be case sensitive
Throws:
java.sql.SQLException - if the parsing fails
See Also:
AbstractRequest.parse(org.objectweb.cjdbc.common.sql.schema.DatabaseSchema, int, boolean)

cloneParsing

public void cloneParsing(AbstractRequest request)
Always throws a SQLException: it is useless to parse a stored procedure call since we can't know which tables are affected by this procedure.

Specified by:
cloneParsing in class AbstractRequest
Parameters:
request - the parsed request to clone
See Also:
AbstractRequest.cloneParsing(AbstractRequest)


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.