com.northgateis.reality.realsql
Class RealPrepareSQL

java.lang.Object
 |
 +--com.northgateis.reality.realsql.RealPrepareSQL
Direct Known Subclasses:
RealPrepareSQLR81, RealPrepareSQLR82

public abstract class RealPrepareSQL
extends java.lang.Object

This abstract class is used as the base for the different types of PREPARE commands that can be issued to the Reality SQL Server.


Field Summary
protected  int accessPlan
           
protected  RealDebug debug
           
protected  byte NULL_BYTE
           
protected  RealMessage prepareMsg
           
 
Constructor Summary
RealPrepareSQL(int traceFlags)
           
 
Method Summary
protected  intgetAccessPlan()
          Get the accessplan.
protected abstract  intgetParamCount()
           
protected abstract  intloadMetaData(java.util.ArrayList metaData)
           
protected  voidprocessMetaDataList(byte[] buf, java.util.ArrayList metaData, int metaColsOffset)
          Extracts column metadata from the byte array and stores each row in the supplied ArrayList.
protected  voidprocessMsg()
          Process the message returned from a PREPAREd statement, the accessPlan is extracted and the return code is checked for success or failure.
protected  intreplaceDelim(byte[] buf, int howMany, byte oldDelim, byte newDelim)
          Replaces a number of delimiters in a byte array with another delimiter.
protected  voidseparateIntoColumns(byte[] buf, int bufOffset, int numMetaDataCols, int numResultSetCols)
          Splits the column metadata returned from a PREPARE into AM separated rows, each row has column null separated column values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accessPlan

protected int accessPlan

prepareMsg

protected RealMessageprepareMsg

debug

protected RealDebugdebug

NULL_BYTE

protected final byte NULL_BYTE
Constructor Detail

RealPrepareSQL

public RealPrepareSQL(int traceFlags)
 throws RealSQLException
Method Detail

loadMetaData

protected abstract int loadMetaData(java.util.ArrayList metaData)
 throws java.sql.SQLException

getParamCount

protected abstract int getParamCount()
 throws java.sql.SQLException

processMsg

protected void processMsg()
 throws RealSQLException
Process the message returned from a PREPAREd statement, the accessPlan is extracted and the return code is checked for success or failure.

Throws:
RealSQLException - if the prepare returned an error condition.


getAccessPlan

protected int getAccessPlan()
Get the accessplan.

Returns:
the accessplan.


replaceDelim

protected int replaceDelim(byte[] buf,
 int howMany,
 byte oldDelim,
 byte newDelim)
Replaces a number of delimiters in a byte array with another delimiter.

Parameters:
buf - byte array containing delimiter separated values.
howMany - number of delimiters to replace.
oldDelim - delimiter to replace.
newDelim - delimiter replacing oldDelim.
Returns:
the byte offset to the last delimiter replaced.


separateIntoColumns

protected void separateIntoColumns(byte[] buf,
 int bufOffset,
 int numMetaDataCols,
 int numResultSetCols)
Splits the column metadata returned from a PREPARE into AM separated rows, each row has column null separated column values.

Parameters:
buf - byte array containing column metadata.
bufOffset - offset into byte array where column metadata starts.
numMetaDataCols - the number columns in each row of the column metadata
numResultSetCols - the number of columns in the result set.


processMetaDataList

protected void processMetaDataList(byte[] buf,
 java.util.ArrayList metaData,
 int metaColsOffset)
 throws java.sql.SQLException
Extracts column metadata from the byte array and stores each row in the supplied ArrayList.

Parameters:
buf - byte array containg AM separated column metadata.
metaData - arraylist to contain column metadata information.
metaColsOffset - offset in byte array to start of column metadata.