SQLServer eWay API

com.stc.connector.sqlserveradapter.base
Class PreparedStatementAgentImpl

java.lang.Object
  extended by com.stc.connector.sqlserveradapter.base.StatementAgentImpl
      extended by com.stc.connector.sqlserveradapter.base.PreparedStatementAgentImpl
All Implemented Interfaces:
com.stc.connector.appconn.db.PreparedStatementAgent, com.stc.connector.appconn.db.StatementAgent, com.stc.connector.db.SessionEventListener
Direct Known Subclasses:
CallableStatementAgentImpl, SqlserverPreparedStatementAgent

public class PreparedStatementAgentImpl
extends StatementAgentImpl
implements com.stc.connector.appconn.db.PreparedStatementAgent

Agent hosts PreparedStatement interface

Version:
$Revision: 1.7 $
Author:
$Author: pveerava $

Field Summary
protected  boolean askGetMoreResults
          Indicator for getting more results.
protected  boolean askGetResultSet
          Indicator for getting Result Set.
protected  boolean bUseResultsAvailable
          Indicator to determine if they are using Result Set enhancement.
protected  com.stc.connector.appconn.db.ResultSetAgent curRSetAgent
          Current ResultSetAgent.
protected  java.lang.String curRSetSig
          Current ResultSet Signature.
protected  int nParam
          Number of parameters.
protected  int nUpdateCount
          Sybase native driver cannot call getUpdateCount more than once after execute or getMoreResults, need to save the count.
protected  boolean retResultSet
          Indicator if the user wants Result Set to be returned or not.
protected  boolean retUpdateCount
          Indicator if the user wants update count to be returned or not.
protected  java.lang.String sCommand
          Prepared SQL statement.
 
Fields inherited from class com.stc.connector.sqlserveradapter.base.StatementAgentImpl
concurrencyType, listener, resultSetConcurMap, resultsetDirection, resultSetDirMap, resultsetType, resultSetTypeMap, session, sqlException, statement, statementClassName
 
Constructor Summary
PreparedStatementAgentImpl()
          Default constructor.
PreparedStatementAgentImpl(com.stc.connector.db.Session session)
          PreparedStatementAgent constructor.
PreparedStatementAgentImpl(com.stc.connector.db.Session session, int iScroll, int iConcur)
          PreparedStatementAgent constructor.
PreparedStatementAgentImpl(com.stc.connector.db.Session session, java.lang.String sSql)
          PreparedStatementAgent constructor.
PreparedStatementAgentImpl(com.stc.connector.db.Session session, java.lang.String sSql, int iScroll, int iConcur)
          PreparedStatementAgent constructor.
 
Method Summary
 void addBatch()
          Adds a set of parameters to the list of commands to be sent as a batch.
 void clearParameters()
          Clears the value of all parameters.
 java.lang.String curRSetSig()
          Calculates the Result Set Column signature.
 void enableResultSetsAndUpdateCounts()
          Enables both Results Sets and Update Counts to be received after an execute call.
 void enableResultSetsOnly()
          Enables only Result Sets to be received after an execute call.
 void enableUpdateCountsOnly()
          Enables only Update Counts to be received after an execute call.
 boolean execute()
          Executes the prepared SQL statement.
 com.stc.connector.appconn.db.ResultSetAgent executeQuery()
          Executes the prepared SQL query and returns a ResultSetAgent that contains the generated result set
 int executeUpdate()
          Executes the prepared SQL statement and returns the number of rows that were affected
 com.stc.connector.appconn.db.ResultSetAgent getCurRSetAgent()
          Sets the current ResultSetAgent object.
 java.lang.String getPreparedStmt()
          Returns the Prepared statement.
 com.stc.connector.appconn.db.PreparedStatementResultSet[] getRSAgentList()
          Gets the PreparedStatementResultSet list.
 java.lang.String[] getRSAgentSigs()
          Gets ResultSetAgent signatures.
 int getUpdateCount()
          Returns the records count of the last executed statement.
 boolean matchResultSetSignature(int ord)
          Matches a particular Result Set's Column sigature with the current one and if so, points the current Result Set Agent to it.
 boolean resultsAvailable()
          Determines whether results (Update Counts and/or Result Sets) are available after an execute.
 void sessionOpen(com.stc.connector.db.SessionEvent evt)
          Processes a SessionOpen event.
 void setArray(int index, java.sql.Array a)
          Sets the Array value of indexed parameter.
 void setAsciiStream(int index, java.io.InputStream is, int length)
          Sets the character value of indexed parameter with an input stream and specified length.
 void setBigDecimal(int index, java.math.BigDecimal dec)
          Sets the decimal value of indexed parameter.
 void setBinaryStream(int index, java.io.InputStream is, int length)
          Sets the binary value of indexed parameter with an input stream and specified length.
 void setBlob(int index, java.sql.Blob blob)
          Sets the Blob value of indexed parameter.
 void setBoolean(int index, boolean b)
          Sets the boolean value of indexed parameter.
 void setByte(int index, byte byt)
          Sets the byte value of indexed parameter.
 void setBytes(int index, byte[] bytes)
          Sets the byte array value of indexed parameter.
 void setCharacterStream(int index, java.io.Reader rd, int length)
          Sets the character value of indexed parameter with a reader stream and specified length.
 void setClob(int index, java.sql.Clob clob)
          Sets the Clob value of indexed parameter.
 void setCurRSetAgent(com.stc.connector.appconn.db.ResultSetAgent rsAgent)
          Sets the current ResultSetAgent object.
 void setDate(int index, java.sql.Date date)
          Sets the date value of indexed parameter.
 void setDate(int index, java.sql.Date date, java.util.Calendar cal)
          Sets the date value of indexed parameter with time zone from calendar.
 void setDouble(int index, double d)
          Sets the double value of indexed parameter.
 void setFloat(int index, float f)
          Sets the float value of indexed parameter.
 void setInt(int index, int i)
          Sets the integer value of indexed parameter.
 void setLong(int index, long l)
          Sets the long value of indexed parameter.
 void setNull(int index, int type)
          Nullifies value of the indexed parameter.
 void setNull(int index, int type, java.lang.String tname)
          Nullifies value of indexed parameter.
 void setObject(int index, java.lang.Object ob)
          Sets value of indexed parameter with an object.
 void setObject(int index, java.lang.Object ob, int iType)
          Sets value of indexed parameter with data type conversion.
 void setObject(int index, java.lang.Object ob, int iType, int iScale)
          Sets value of indexed parameter with data type conversion and specified scale.
 void setRef(int index, java.sql.Ref ref)
          Sets the Ref value of indexed parameter.
 void setRSAgentList(com.stc.connector.appconn.db.PreparedStatementResultSet[] rsAgentList)
          Sets PreparedStatementResultSet list.
 void setRSAgentSigs(java.lang.String[] rsAgentSigs)
          Sets ResultSetAgent signatures.
 void setShort(int index, short si)
          Sets the short value of indexed parameter.
 void setString(int index, java.lang.String s)
          Sets the string value of indexed parameter.
 void setTime(int index, java.sql.Time t)
          Sets the time value of indexed parameter.
 void setTime(int index, java.sql.Time t, java.util.Calendar cal)
          Sets the time value of indexed parameter with time zone from calendar.
 void setTimestamp(int index, java.sql.Timestamp ts)
          Sets the timestamp value of indexed parameter.
 void setTimestamp(int index, java.sql.Timestamp ts, java.util.Calendar cal)
          Sets the timestamp value of indexed parameter with time zone from calendar.
 
Methods inherited from class com.stc.connector.sqlserveradapter.base.StatementAgentImpl
cancel, clearBatch, clearWarnings, executeBatch, getFetchDirection, getFetchSize, getMaxFieldSize, getMaxRows, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetType, getWarnings, isClosed, queryName, resultSetConcurToString, resultSetDirToString, resultSetTypeToString, sessionClose, sessionReset, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout, stmtInvoke
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.stc.connector.appconn.db.StatementAgent
cancel, clearBatch, clearWarnings, executeBatch, getFetchDirection, getFetchSize, getMaxFieldSize, getMaxRows, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetType, getWarnings, isClosed, queryName, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout, stmtInvoke
 

Field Detail

sCommand

protected java.lang.String sCommand
Prepared SQL statement.


nParam

protected int nParam
Number of parameters.


curRSetSig

protected java.lang.String curRSetSig
Current ResultSet Signature.


curRSetAgent

protected com.stc.connector.appconn.db.ResultSetAgent curRSetAgent
Current ResultSetAgent.


askGetMoreResults

protected boolean askGetMoreResults
Indicator for getting more results.


askGetResultSet

protected boolean askGetResultSet
Indicator for getting Result Set.


retResultSet

protected boolean retResultSet
Indicator if the user wants Result Set to be returned or not.


retUpdateCount

protected boolean retUpdateCount
Indicator if the user wants update count to be returned or not.


nUpdateCount

protected int nUpdateCount
Sybase native driver cannot call getUpdateCount more than once after execute or getMoreResults, need to save the count.


bUseResultsAvailable

protected boolean bUseResultsAvailable
Indicator to determine if they are using Result Set enhancement.

Constructor Detail

PreparedStatementAgentImpl

public PreparedStatementAgentImpl()
Default constructor.


PreparedStatementAgentImpl

public PreparedStatementAgentImpl(com.stc.connector.db.Session session)
PreparedStatementAgent constructor.

Parameters:
session - a Session object used to hold connection information.

PreparedStatementAgentImpl

public PreparedStatementAgentImpl(com.stc.connector.db.Session session,
                                  int iScroll,
                                  int iConcur)
PreparedStatementAgent constructor.

Parameters:
session - a Session object used to hold connection information.
iScroll - resultset type; TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE.
iConcur - concurrency type; CONCUR_READ_ONLY, CONCUR_UPDATABLE.

PreparedStatementAgentImpl

public PreparedStatementAgentImpl(com.stc.connector.db.Session session,
                                  java.lang.String sSql)
PreparedStatementAgent constructor.

Parameters:
session - a Session object used to hold connection information.
sSql - a SQL statement for the prepared statement.

PreparedStatementAgentImpl

public PreparedStatementAgentImpl(com.stc.connector.db.Session session,
                                  java.lang.String sSql,
                                  int iScroll,
                                  int iConcur)
PreparedStatementAgent constructor.

Parameters:
session - a Session object used to hold connection information.
sSql - a SQL statement for the prepared statement.
iScroll - resultset type; TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
iConcur - concurrency type; CONCUR_READ_ONLY, CONCUR_UPDATABLE.
Method Detail

setCurRSetAgent

public void setCurRSetAgent(com.stc.connector.appconn.db.ResultSetAgent rsAgent)
Sets the current ResultSetAgent object.

Parameters:
rsAgent - the most recent ResultSetAgent returned from a execute().

getCurRSetAgent

public com.stc.connector.appconn.db.ResultSetAgent getCurRSetAgent()
Sets the current ResultSetAgent object.

Returns:
the most recent ResultSetAgent returned from a execute().

curRSetSig

public java.lang.String curRSetSig()
                            throws java.sql.SQLException
Calculates the Result Set Column signature.

Returns:
the Result Set Columm signature.
Throws:
java.sql.SQLException - when there are SQL problems

enableResultSetsOnly

public void enableResultSetsOnly()
Enables only Result Sets to be received after an execute call.

Specified by:
enableResultSetsOnly in interface com.stc.connector.appconn.db.PreparedStatementAgent

enableUpdateCountsOnly

public void enableUpdateCountsOnly()
Enables only Update Counts to be received after an execute call.

Specified by:
enableUpdateCountsOnly in interface com.stc.connector.appconn.db.PreparedStatementAgent

enableResultSetsAndUpdateCounts

public void enableResultSetsAndUpdateCounts()
Enables both Results Sets and Update Counts to be received after an execute call. This is the default.

Specified by:
enableResultSetsAndUpdateCounts in interface com.stc.connector.appconn.db.PreparedStatementAgent

matchResultSetSignature

public boolean matchResultSetSignature(int ord)
                                throws java.sql.SQLException
Matches a particular Result Set's Column sigature with the current one and if so, points the current Result Set Agent to it.

Specified by:
matchResultSetSignature in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
ord - the ordinal position of the particular Result Set.
Returns:
true if the Result Set signature matches; false otherwise.
Throws:
java.sql.SQLException - when SQL problems occur. when SQL problems occur.

resultsAvailable

public boolean resultsAvailable()
                         throws java.sql.SQLException
Determines whether results (Update Counts and/or Result Sets) are available after an execute.

Specified by:
resultsAvailable in interface com.stc.connector.appconn.db.PreparedStatementAgent
Returns:
true if Update Counts and/or Result Sets are available.
Throws:
java.sql.SQLException - when SQL problems occur. when SQL problems occur.

sessionOpen

public void sessionOpen(com.stc.connector.db.SessionEvent evt)
Processes a SessionOpen event. It will preapre the call to invoke the stored procedure and register all the output parameters by calling registerOutParameters().

Specified by:
sessionOpen in interface com.stc.connector.db.SessionEventListener
Overrides:
sessionOpen in class StatementAgentImpl
Parameters:
evt - a Session event which signals the connection is open.

setNull

public void setNull(int index,
                    int type)
             throws java.sql.SQLException
Nullifies value of the indexed parameter.

Specified by:
setNull in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
type - the JDBC type code defined by java.sql.Types.
Throws:
java.sql.SQLException - when SQL problems occur.

setNull

public void setNull(int index,
                    int type,
                    java.lang.String tname)
             throws java.sql.SQLException
Nullifies value of indexed parameter.

Specified by:
setNull in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
type - the JDBC type code defined by java.sql.Types.
tname - the fully qualified name of the parameter being set.
Throws:
java.sql.SQLException - when SQL problems occur.

setObject

public void setObject(int index,
                      java.lang.Object ob)
               throws java.sql.SQLException
Sets value of indexed parameter with an object.

Specified by:
setObject in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
ob - a Java object that holds the paramter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setObject

public void setObject(int index,
                      java.lang.Object ob,
                      int iType)
               throws java.sql.SQLException
Sets value of indexed parameter with data type conversion.

Specified by:
setObject in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
ob - a Java object that holds the paramter value.
iType - the JDBC type code defined by java.sql.Types.
Throws:
java.sql.SQLException - when SQL problems occur.

setObject

public void setObject(int index,
                      java.lang.Object ob,
                      int iType,
                      int iScale)
               throws java.sql.SQLException
Sets value of indexed parameter with data type conversion and specified scale.

Specified by:
setObject in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
ob - a Java object that holds the paramter value.
iType - the JDBC type code defined by java.sql.Types.
iScale - the desired number of digits to the right of the decimal point.
Throws:
java.sql.SQLException - when SQL problems occur.

setBoolean

public void setBoolean(int index,
                       boolean b)
                throws java.sql.SQLException
Sets the boolean value of indexed parameter.

Specified by:
setBoolean in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
b - a boolean parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setByte

public void setByte(int index,
                    byte byt)
             throws java.sql.SQLException
Sets the byte value of indexed parameter.

Specified by:
setByte in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
byt - a byte parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setShort

public void setShort(int index,
                     short si)
              throws java.sql.SQLException
Sets the short value of indexed parameter.

Specified by:
setShort in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
si - a short parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setInt

public void setInt(int index,
                   int i)
            throws java.sql.SQLException
Sets the integer value of indexed parameter.

Specified by:
setInt in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
i - an integer parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setLong

public void setLong(int index,
                    long l)
             throws java.sql.SQLException
Sets the long value of indexed parameter.

Specified by:
setLong in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
l - a long parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setFloat

public void setFloat(int index,
                     float f)
              throws java.sql.SQLException
Sets the float value of indexed parameter.

Specified by:
setFloat in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
f - a float parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setDouble

public void setDouble(int index,
                      double d)
               throws java.sql.SQLException
Sets the double value of indexed parameter.

Specified by:
setDouble in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
d - a double parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setBigDecimal

public void setBigDecimal(int index,
                          java.math.BigDecimal dec)
                   throws java.sql.SQLException
Sets the decimal value of indexed parameter.

Specified by:
setBigDecimal in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
dec - a BigDecimal parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setDate

public void setDate(int index,
                    java.sql.Date date)
             throws java.sql.SQLException
Sets the date value of indexed parameter.

Specified by:
setDate in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
date - a Date parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setDate

public void setDate(int index,
                    java.sql.Date date,
                    java.util.Calendar cal)
             throws java.sql.SQLException
Sets the date value of indexed parameter with time zone from calendar.

Specified by:
setDate in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
date - a Date parameter value.
cal - the Calendar object used to construct the Date object
Throws:
java.sql.SQLException - when SQL problems occur.

setTime

public void setTime(int index,
                    java.sql.Time t)
             throws java.sql.SQLException
Sets the time value of indexed parameter.

Specified by:
setTime in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
t - a Time parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setTime

public void setTime(int index,
                    java.sql.Time t,
                    java.util.Calendar cal)
             throws java.sql.SQLException
Sets the time value of indexed parameter with time zone from calendar.

Specified by:
setTime in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
t - a Time parameter value.
cal - the Calendar object used to construct the Time object.
Throws:
java.sql.SQLException - when SQL problems occur.

setTimestamp

public void setTimestamp(int index,
                         java.sql.Timestamp ts)
                  throws java.sql.SQLException
Sets the timestamp value of indexed parameter.

Specified by:
setTimestamp in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
ts - a Timestamp parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setTimestamp

public void setTimestamp(int index,
                         java.sql.Timestamp ts,
                         java.util.Calendar cal)
                  throws java.sql.SQLException
Sets the timestamp value of indexed parameter with time zone from calendar.

Specified by:
setTimestamp in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
ts - a Timestamp parameter value.
cal - the Calendar object used to construct the Time object.
Throws:
java.sql.SQLException - when SQL problems occur.

setString

public void setString(int index,
                      java.lang.String s)
               throws java.sql.SQLException
Sets the string value of indexed parameter.

Specified by:
setString in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
s - a String parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setBytes

public void setBytes(int index,
                     byte[] bytes)
              throws java.sql.SQLException
Sets the byte array value of indexed parameter.

Specified by:
setBytes in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
bytes - a byte array parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setAsciiStream

public void setAsciiStream(int index,
                           java.io.InputStream is,
                           int length)
                    throws java.sql.SQLException
Sets the character value of indexed parameter with an input stream and specified length.

Specified by:
setAsciiStream in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
is - an Ascii stream parameter value.
length - the number of bytes to be read from the stream.
Throws:
java.sql.SQLException - when SQL problems occur.

setBinaryStream

public void setBinaryStream(int index,
                            java.io.InputStream is,
                            int length)
                     throws java.sql.SQLException
Sets the binary value of indexed parameter with an input stream and specified length.

Specified by:
setBinaryStream in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
is - an Binary stream parameter value.
length - the number of bytes to be read from the stream.
Throws:
java.sql.SQLException - when SQL problems occur.

setCharacterStream

public void setCharacterStream(int index,
                               java.io.Reader rd,
                               int length)
                        throws java.sql.SQLException
Sets the character value of indexed parameter with a reader stream and specified length.

Specified by:
setCharacterStream in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
rd - a Reader parameter value.
length - the number of characters to be read from the stream.
Throws:
java.sql.SQLException - when SQL problems occur.

setArray

public void setArray(int index,
                     java.sql.Array a)
              throws java.sql.SQLException
Sets the Array value of indexed parameter.

Specified by:
setArray in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
a - an Array parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setBlob

public void setBlob(int index,
                    java.sql.Blob blob)
             throws java.sql.SQLException
Sets the Blob value of indexed parameter.

Specified by:
setBlob in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
blob - a Blob parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setClob

public void setClob(int index,
                    java.sql.Clob clob)
             throws java.sql.SQLException
Sets the Clob value of indexed parameter.

Specified by:
setClob in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
clob - a Clob parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

setRef

public void setRef(int index,
                   java.sql.Ref ref)
            throws java.sql.SQLException
Sets the Ref value of indexed parameter.

Specified by:
setRef in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
index - the position of the parameter. It starts from 1.
ref - a Ref parameter value.
Throws:
java.sql.SQLException - when SQL problems occur.

clearParameters

public void clearParameters()
                     throws java.sql.SQLException
Clears the value of all parameters.

Specified by:
clearParameters in interface com.stc.connector.appconn.db.PreparedStatementAgent
Throws:
java.sql.SQLException - when SQL problems occur.

addBatch

public void addBatch()
              throws java.sql.SQLException
Adds a set of parameters to the list of commands to be sent as a batch.

Specified by:
addBatch in interface com.stc.connector.appconn.db.PreparedStatementAgent
Throws:
java.sql.SQLException - when SQL problems occur.

execute

public boolean execute()
                throws java.sql.SQLException
Executes the prepared SQL statement.

Specified by:
execute in interface com.stc.connector.appconn.db.PreparedStatementAgent
Returns:
true if the first result is a result set; false if it is an update count or there is no result.
Throws:
java.sql.SQLException - when SQL problems occur.

executeQuery

public com.stc.connector.appconn.db.ResultSetAgent executeQuery()
                                                         throws java.sql.SQLException
Executes the prepared SQL query and returns a ResultSetAgent that contains the generated result set

Specified by:
executeQuery in interface com.stc.connector.appconn.db.PreparedStatementAgent
Returns:
a ResultSetAgent which holds the return records.
Throws:
java.sql.SQLException - when SQL problems occur.

executeUpdate

public int executeUpdate()
                  throws java.sql.SQLException
Executes the prepared SQL statement and returns the number of rows that were affected

Specified by:
executeUpdate in interface com.stc.connector.appconn.db.PreparedStatementAgent
Returns:
the number of affected rows. 0 if no rows are affected or a DDL statement was executed.
Throws:
java.sql.SQLException - when SQL problems occur.

getUpdateCount

public int getUpdateCount()
                   throws java.sql.SQLException
Returns the records count of the last executed statement.

Specified by:
getUpdateCount in interface com.stc.connector.appconn.db.PreparedStatementAgent
Specified by:
getUpdateCount in interface com.stc.connector.appconn.db.StatementAgent
Overrides:
getUpdateCount in class StatementAgentImpl
Returns:
the number of updated records.
Throws:
java.sql.SQLException - when SQL problems occur.

getPreparedStmt

public java.lang.String getPreparedStmt()
                                 throws java.sql.SQLException
Returns the Prepared statement.

Specified by:
getPreparedStmt in interface com.stc.connector.appconn.db.PreparedStatementAgent
Returns:
the SQL prepared statement.
Throws:
java.sql.SQLException - when SQL problems occur.

setRSAgentSigs

public void setRSAgentSigs(java.lang.String[] rsAgentSigs)
Sets ResultSetAgent signatures. A signature includes all the column names.

Specified by:
setRSAgentSigs in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
rsAgentSigs - an array of signatures in string.

setRSAgentList

public void setRSAgentList(com.stc.connector.appconn.db.PreparedStatementResultSet[] rsAgentList)
Sets PreparedStatementResultSet list. It holds the list of result sets returned from the prepared statement.

Specified by:
setRSAgentList in interface com.stc.connector.appconn.db.PreparedStatementAgent
Parameters:
rsAgentList - an array of PreparedStatementResultSet instances.

getRSAgentList

public com.stc.connector.appconn.db.PreparedStatementResultSet[] getRSAgentList()
Gets the PreparedStatementResultSet list.

Specified by:
getRSAgentList in interface com.stc.connector.appconn.db.PreparedStatementAgent
Returns:
rsAgentList an array of PreparedStatementResultSet instances.

getRSAgentSigs

public java.lang.String[] getRSAgentSigs()
Gets ResultSetAgent signatures.

Specified by:
getRSAgentSigs in interface com.stc.connector.appconn.db.PreparedStatementAgent
Returns:
an array of signatures in string.

SQLServer eWay API