jxDBCon 0.9z

org.sourceforge.jxdbcon.postgresql
Class PGCallableStatement

java.lang.Object
  |
  +--org.sourceforge.jxdbcon.AbstractStatement
        |
        +--org.sourceforge.jxdbcon.AbstractPreparedStatement
              |
              +--org.sourceforge.jxdbcon.AbstractCallableStatement
                    |
                    +--org.sourceforge.jxdbcon.postgresql.PGCallableStatement
All Implemented Interfaces:
CallableStatement, PreparedStatement, Statement

public class PGCallableStatement
extends AbstractCallableStatement

The PGCallableStatement implements CallableStatements with PostgreSQL. There are two ways to call a function, by name or by oid. {?=call version() }, or {?=call 89()} When calling by name all functions with given name and equal parameter list length are selected. Then heuristics are used to select the function to use.
Currently the heuristics select the first matching function.

Version:
$Revision: 1.8 $
Author:
Keve Müller

Field Summary
private  EscapeFrags.Frag[] args
          The arguments of the call for evaluating functions that return a set.
private  EscapeContext ectx
          The EscapeContext for evaluating functions that return a set.
private  PGFunc func
          Selected function.
private  PGExecResult res
          The Result from a function returning a set.
 
Fields inherited from class org.sourceforge.jxdbcon.AbstractCallableStatement
call, resContext, resData, resTypes
 
Fields inherited from class org.sourceforge.jxdbcon.AbstractPreparedStatement
paramBuf, paramContext, paramTypes
 
Fields inherited from class org.sourceforge.jxdbcon.AbstractStatement
batch, conn, cursorName, escapeProcessing, fetchDirection, fetchSize, maxFieldSize, maxRows, queryTimeout, warnings
 
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
 
Constructor Summary
PGCallableStatement(PGConnection conn, int resultSetType, String sql)
           
 
Method Summary
 void addBatch()
           
 void close()
          Null everything.
 boolean execute()
          Execute the call either via FastPath or an SQL SELECT statement.
 boolean execute(String sql)
          Not supported.
 int[] executeBatch()
          Execute a batch update.
private  boolean executeCallFunc()
          Execute a function that returns a scalar.
private  boolean executeCallSet()
          Execute a function that returns a set.
 ResultSetMetaData getMetaData()
          Not supported yet.
protected  AbstractType getParamType(int idx)
           
 ResultSet getResultSet()
          If the function returned a set, this method can be used to access it.
 int getUpdateCount()
          Return the scalar result as the update count.
 
Methods inherited from class org.sourceforge.jxdbcon.AbstractCallableStatement
findParameter, getArray, getArray, getBigDecimal, getBigDecimal, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getClob, getClob, getDate, getDate, getDate, getDate, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getObject, getObject, getObject, getObject, getRef, getRef, getShort, getShort, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getURL, getURL, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, setAsciiStream, setBigDecimal, setBinaryStream, setBoolean, setByte, setBytes, setCharacterStream, setDate, setDate, setDouble, setFloat, setInt, setLong, setNull, setNull, setObject, setObject, setObject, setShort, setString, setTime, setTime, setTimestamp, setTimestamp, setURL, wasNull
 
Methods inherited from class org.sourceforge.jxdbcon.AbstractPreparedStatement
clearParameters, executeQuery, executeUpdate, getParameterMetaData, setArray, setAsciiStream, setBigDecimal, setBinaryStream, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNull, setNull, setObject, setObject, setObject, setRef, setShort, setString, setTime, setTime, setTimestamp, setTimestamp, setURL
 
Methods inherited from class org.sourceforge.jxdbcon.AbstractStatement
addBatch, cancel, clearBatch, clearWarnings, execute, execute, execute, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, finalize, getConnection, getCursorName, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getWarnings, isClosed, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.CallableStatement
getBigDecimal
 
Methods inherited from interface java.sql.PreparedStatement
clearParameters, executeQuery, executeUpdate, getParameterMetaData, setArray, setAsciiStream, setBigDecimal, setBinaryStream, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNull, setNull, setObject, setObject, setObject, setRef, setShort, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
 
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, execute, execute, execute, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 

Field Detail

args

private EscapeFrags.Frag[] args
The arguments of the call for evaluating functions that return a set.


ectx

private EscapeContext ectx
The EscapeContext for evaluating functions that return a set.


func

private PGFunc func
Selected function.


res

private PGExecResult res
The Result from a function returning a set.

Constructor Detail

PGCallableStatement

public PGCallableStatement(PGConnection conn,
                           int resultSetType,
                           String sql)
                    throws SQLException
Method Detail

addBatch

public void addBatch()
              throws SQLException
Specified by:
addBatch in interface PreparedStatement
Overrides:
addBatch in class AbstractPreparedStatement
SQLException

close

public void close()
Null everything.

Specified by:
close in interface Statement
Overrides:
close in class AbstractStatement

execute

public boolean execute()
                throws SQLException
Execute the call either via FastPath or an SQL SELECT statement. TODO: For NULL parameters revert to SELECT semantics.

Specified by:
execute in interface PreparedStatement
Overrides:
execute in class AbstractPreparedStatement
SQLException

execute

public boolean execute(String sql)
                throws SQLException
Not supported.

SQLException

executeBatch

public int[] executeBatch()
                   throws SQLException
Execute a batch update. The function called is assumed to return an int, which is used as the update count value.

Specified by:
executeBatch in interface Statement
Overrides:
executeBatch in class AbstractStatement
SQLException

executeCallFunc

private boolean executeCallFunc()
                         throws SQLException
Execute a function that returns a scalar. The function is called via the FastPath protocol.

SQLException

executeCallSet

private boolean executeCallSet()
                        throws SQLException
Execute a function that returns a set. The FE/BE protocol does not allow this to be executed in a FastPath context. Revert to the SELECT func() method.

SQLException

getMetaData

public ResultSetMetaData getMetaData()
                              throws SQLException
Not supported yet.

SQLException

getParamType

protected AbstractType getParamType(int idx)
                             throws SQLException
SQLException

getResultSet

public ResultSet getResultSet()
                       throws SQLException
If the function returned a set, this method can be used to access it.

Specified by:
getResultSet in interface Statement
Specified by:
getResultSet in class AbstractStatement
SQLException

getUpdateCount

public int getUpdateCount()
                   throws SQLException
Return the scalar result as the update count.

Specified by:
getUpdateCount in interface Statement
Specified by:
getUpdateCount in class AbstractStatement
SQLException

jxDBCon 0.9z

Copyright © 2001,2002 Keve Müller; see LICENSE file for details.