com.sas.net.sharenet
Class ShareNetStatement

com.sas.net.sharenet.ShareNetStatement
All Implemented Interfaces:
java.sql.Statement, java.sql.Wrapper
Direct Known Subclasses:
ShareNetPreparedStatement

public class ShareNetStatement
implements java.sql.Statement

ShareNetStatement implements java.sql.Statement


Field Summary
protected  boolean closed
           
protected  ShareNetConnection connection
           
protected  boolean describe
           
protected  int fetchSize
           
protected  int maxFieldSize
           
protected static java.lang.String[] months
           
protected  com.sas.net.sharenet.Tcpmsg msg
           
protected  ShareNetResultSet snresultset
           
 
Method Summary
 void addBatch(java.lang.String sql)
          This method is not supported and will always throw a SQLException.
 void addWarning(java.sql.SQLWarning warning)
          Adds a warning to this Statement.
 void cancel()
          
 void clearBatch()
          This method is not supported and will always throw a SQLException.
 void clearWarnings()
          
 void close()
          
protected  void describe()
          Open up a new query (select statement).
protected  void destroy()
          Destroy a query object.
 boolean execute(java.lang.String sql)
          Executes an SQL statement and indicates the form of the first result.
 boolean execute(java.lang.String sql, int autoGeneratedKeys)
          This method is not supported and will always throw a SQLException.
 boolean execute(java.lang.String sql, int[] columnIndexes)
          This method is not supported and will always throw a SQLException.
 boolean execute(java.lang.String sql, java.lang.String[] columnNames)
          This method is not supported and will always throw a SQLException.
 int[] executeBatch()
          This method is not supported and will always throw a SQLException.
 java.sql.ResultSet executeQuery(java.lang.String query)
          
 int executeUpdate(java.lang.String sql)
          
 int executeUpdate(java.lang.String sql, int autoGeneratedKeys)
          This method is not supported and will always throw a SQLException.
 int executeUpdate(java.lang.String sql, int[] columnIndexes)
          This method is not supported and will always throw a SQLException.
 int executeUpdate(java.lang.String sql, java.lang.String[] columnNames)
          This method is not supported and will always throw a SQLException.
 java.lang.String fieldFormat(int i)
          Find the type of all the fields in the query.
 java.lang.String[] fieldNames()
          Find the names of all the fields in the query.
 int fieldType(int i)
          Find the type of all the fields in the query.
protected  void finalize()
          Protected method which cleans up state associated with this object.
protected  int findFirstString(java.lang.String stmt, java.lang.String token, int offset)
           
protected  com.sas.net.sharenet.Xhrspa3 getAns()
          Gets the state of the query.
 java.sql.Connection getConnection()
          
 int getFetchDirection()
          JDBC 2.0 Gets the fetch direction for the result set created by this statement.
 int getFetchSize()
          
 java.sql.ResultSet getGeneratedKeys()
          This method is not supported and will always throw a SQLException.
 int getMaxFieldSize()
          
 int getMaxRows()
          
 boolean getMoreResults()
          Moves to a Statement's next result.
 boolean getMoreResults(int current)
          This method is not supported and will always throw a SQLException.
 int getQueryTimeout()
          
 java.sql.ResultSet getResultSet()
          
 int getResultSetConcurrency()
          
 int getResultSetHoldability()
          This method is not supported and will always throw a SQLException.
 int getResultSetType()
          
 int getUpdateCount()
          
protected  com.sas.net.sharenet.SqlFieldArray getVars()
          Gets the state of the query.
 java.sql.SQLWarning getWarnings()
          
 boolean isClosed()
          
protected  boolean isDescribe()
           
 boolean isPoolable()
          This method is not supported and will always throw a SQLException.
 boolean isWrapperFor(java.lang.Class<?> iface)
          
 int numFields()
          Return the number of fields in the query.
protected  void prepare(java.lang.String statement)
          Open up a new query (select statement).
protected  void prepareDescribe(java.lang.String statement)
          Open up a new query (select statement).
 void setCursorName(java.lang.String name)
          
protected  void setDescribe(boolean describe)
           
 void setEscapeProcessing(boolean enable)
          SAS software does not allow escape processing.
 void setFetchDirection(int direction)
          JDBC 2.0 Gives a hint as to the direction in which the rows in the result set created by this statement will be processed.
 void setFetchSize(int rows)
          JDBC 2.0 Sets the number of rows to be fetched.
 void setMaxFieldSize(int max)
          
 void setMaxRows(int max)
          
 void setPoolable(boolean poolable)
          This method is not supported and will always throw a SQLException.
 void setQueryTimeout(int seconds)
          
protected  void setVars(com.sas.net.sharenet.SqlFieldArray vars)
          Gets the state of the query.
<T> T
unwrap(java.lang.Class<T> iface)
          
 

Field Detail

months

protected static java.lang.String[] months

fetchSize

protected int fetchSize

msg

protected com.sas.net.sharenet.Tcpmsg msg

maxFieldSize

protected int maxFieldSize

snresultset

protected ShareNetResultSet snresultset

connection

protected ShareNetConnection connection

describe

protected boolean describe

closed

protected boolean closed
Method Detail

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String query)
                                throws java.sql.SQLException

Specified by:
executeQuery in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql)
                  throws java.sql.SQLException

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

close

public void close()

Specified by:
close in interface java.sql.Statement

getMaxFieldSize

public int getMaxFieldSize()
                    throws java.sql.SQLException

Specified by:
getMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException

setMaxFieldSize

public void setMaxFieldSize(int max)
                     throws java.sql.SQLException

Specified by:
setMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException

getMaxRows

public int getMaxRows()
               throws java.sql.SQLException

Specified by:
getMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException

setMaxRows

public void setMaxRows(int max)
                throws java.sql.SQLException

Specified by:
setMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException

setEscapeProcessing

public void setEscapeProcessing(boolean enable)
                         throws java.sql.SQLException
SAS software does not allow escape processing. An exception will be thrown if value of enable is true.

Specified by:
setEscapeProcessing in interface java.sql.Statement
Throws:
java.sql.SQLException

getQueryTimeout

public int getQueryTimeout()
                    throws java.sql.SQLException

Specified by:
getQueryTimeout in interface java.sql.Statement
Throws:
java.sql.SQLException

setQueryTimeout

public void setQueryTimeout(int seconds)
                     throws java.sql.SQLException

Specified by:
setQueryTimeout in interface java.sql.Statement
Throws:
java.sql.SQLException

cancel

public void cancel()
            throws java.sql.SQLException

Specified by:
cancel in interface java.sql.Statement
Throws:
java.sql.SQLException

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException

Specified by:
getWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException

Specified by:
clearWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException

setCursorName

public void setCursorName(java.lang.String name)
                   throws java.sql.SQLException

Specified by:
setCursorName in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String sql)
                throws java.sql.SQLException
Executes an SQL statement and indicates the form of the first result. You can then use getResultSet() or getUpdateCount() to retrieve the result.

Specified by:
execute in interface java.sql.Statement
Parameters:
sql - An SQL statement.
Returns:
True if the result is a ResultSet; False if it is an integer
Throws:
java.sql.SQLException - This exception is thrown if a ShareNetException is detected
See Also:
getResultSet(), getUpdateCount(), getMoreResults()

getResultSet

public java.sql.ResultSet getResultSet()
                                throws java.sql.SQLException

Specified by:
getResultSet in interface java.sql.Statement
Throws:
java.sql.SQLException

getUpdateCount

public int getUpdateCount()
                   throws java.sql.SQLException

Specified by:
getUpdateCount in interface java.sql.Statement
Throws:
java.sql.SQLException

setDescribe

protected void setDescribe(boolean describe)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

isDescribe

protected boolean isDescribe()
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getMoreResults

public boolean getMoreResults()
                       throws java.sql.SQLException
Moves to a Statement's next result. This method always returns False because SAS software does not support multiple ResultSets. The method also implicitly closes any current ResultSet obtained with getResultSet().

Specified by:
getMoreResults in interface java.sql.Statement
Returns:
True if the next result is a ResultSet; False if it is an integer.
Throws:
java.sql.SQLException - This exception is required by the interface, but it is never thrown.
See Also:
execute(java.lang.String)

setFetchDirection

public void setFetchDirection(int direction)
                       throws java.sql.SQLException
JDBC 2.0 Gives a hint as to the direction in which the rows in the result set created by this statement will be processed. Currently, the rows of the resultset will be processed only in the forward direction.

Specified by:
setFetchDirection in interface java.sql.Statement
Parameters:
direction - An integer indicating the direction in which the rows of the result set will be processed. Currently supports only FETCH_FORWARD.
Throws:
java.sql.SQLException - This exception is thrown if the fetch direction is not FETCH_FORWARD.

getFetchDirection

public int getFetchDirection()
                      throws java.sql.SQLException
JDBC 2.0 Gets the fetch direction for the result set created by this statement. The rows of the resultset will be processed only in forward direction.

Specified by:
getFetchDirection in interface java.sql.Statement
Returns:
An integer value indicating FETCH_FORWARD.
Throws:
java.sql.SQLException - This exception is required by the interface but it is never thrown.

setFetchSize

public void setFetchSize(int rows)
                  throws java.sql.SQLException
JDBC 2.0 Sets the number of rows to be fetched. Note 1: The integer fetchSize is casted to a short and so fetch size value might get truncated to 2 bytes. Note 2: The performance hint is ignored if you are connected to a V6 SAS/SHARE server. Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. The number of rows specified only affects result sets created using this statement. If the value specified is zero, then the hint is ignored.

Specified by:
setFetchSize in interface java.sql.Statement
Parameters:
rows - The number of rows to fetch.
Throws:
java.sql.SQLException - This exception is thrown if a database-access error occurs, or the condition 0 <= rows <= this.getMaxRows() is not satisfied.

getFetchSize

public int getFetchSize()
                 throws java.sql.SQLException

Specified by:
getFetchSize in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetConcurrency

public int getResultSetConcurrency()
                            throws java.sql.SQLException

Specified by:
getResultSetConcurrency in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetType

public int getResultSetType()
                     throws java.sql.SQLException

Specified by:
getResultSetType in interface java.sql.Statement
Throws:
java.sql.SQLException

addBatch

public void addBatch(java.lang.String sql)
              throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
addBatch in interface java.sql.Statement
Throws:
java.sql.SQLException

clearBatch

public void clearBatch()
                throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
clearBatch in interface java.sql.Statement
Throws:
java.sql.SQLException

executeBatch

public int[] executeBatch()
                   throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
executeBatch in interface java.sql.Statement
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException

Specified by:
getConnection in interface java.sql.Statement
Throws:
java.sql.SQLException

addWarning

public void addWarning(java.sql.SQLWarning warning)
Adds a warning to this Statement.

Parameters:
warning - The warning to add to this statement.

getMoreResults

public boolean getMoreResults(int current)
                       throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
getMoreResults in interface java.sql.Statement
Throws:
java.sql.SQLException

getGeneratedKeys

public java.sql.ResultSet getGeneratedKeys()
                                    throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
getGeneratedKeys in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql,
                         int autoGeneratedKeys)
                  throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql,
                         int[] columnIndexes)
                  throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql,
                         java.lang.String[] columnNames)
                  throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String sql,
                       int autoGeneratedKeys)
                throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String sql,
                       int[] columnIndexes)
                throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String sql,
                       java.lang.String[] columnNames)
                throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetHoldability

public int getResultSetHoldability()
                            throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
getResultSetHoldability in interface java.sql.Statement
Throws:
java.sql.SQLException

findFirstString

protected int findFirstString(java.lang.String stmt,
                              java.lang.String token,
                              int offset)

finalize

protected void finalize()
                 throws java.lang.Throwable
Protected method which cleans up state associated with this object.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - required. Not created in this method.

prepareDescribe

protected void prepareDescribe(java.lang.String statement)
                        throws ShareNetException
Open up a new query (select statement).

Parameters:
statement - select statement, e.g., "select * from lib.name"
Throws:
ShareNetException - if an IOException is detected

prepare

protected void prepare(java.lang.String statement)
                throws ShareNetException
Open up a new query (select statement).

Parameters:
statement - select statement, e.g., "select * from lib.name"
Throws:
ShareNetException - if an IOException is detected

describe

protected void describe()
                 throws ShareNetException
Open up a new query (select statement).

Throws:
ShareNetException - if an IOException is detected

destroy

protected void destroy()
                throws ShareNetException
Destroy a query object.

Throws:
ShareNetException - if an IOException is detected

numFields

public int numFields()
Return the number of fields in the query.

Returns:
number of fields

fieldNames

public java.lang.String[] fieldNames()
Find the names of all the fields in the query.

Returns:
name array

fieldType

public int fieldType(int i)
Find the type of all the fields in the query.

Returns:
label array

fieldFormat

public java.lang.String fieldFormat(int i)
Find the type of all the fields in the query.

Returns:
label array

getAns

protected com.sas.net.sharenet.Xhrspa3 getAns()
Gets the state of the query.

Returns:
ans A Xhrspa3 value.
Throws:
ShareNetException - This exception is never thrown.

getVars

protected com.sas.net.sharenet.SqlFieldArray getVars()
Gets the state of the query.

Returns:
vars A SqlFieldArray value containing all available variables attributes.
Throws:
ShareNetException - This exception is never thrown.

setVars

protected void setVars(com.sas.net.sharenet.SqlFieldArray vars)
Gets the state of the query.

Throws:
ShareNetException - This exception is never thrown.

isClosed

public boolean isClosed()
                 throws java.sql.SQLException

Specified by:
isClosed in interface java.sql.Statement
Throws:
java.sql.SQLException

setPoolable

public void setPoolable(boolean poolable)
                 throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
setPoolable in interface java.sql.Statement
Throws:
java.sql.SQLException

isPoolable

public boolean isPoolable()
                   throws java.sql.SQLException
This method is not supported and will always throw a SQLException.

Specified by:
isPoolable in interface java.sql.Statement
Throws:
java.sql.SQLException

unwrap

public <T> T unwrap(java.lang.Class<T> iface)
         throws java.sql.SQLException

Specified by:
unwrap in interface java.sql.Wrapper
Throws:
java.sql.SQLException

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> iface)
                     throws java.sql.SQLException

Specified by:
isWrapperFor in interface java.sql.Wrapper
Throws:
java.sql.SQLException



Copyright © 2009 SAS Institute Inc. All Rights Reserved.