dsql.value
Class SQLResults

java.lang.Object
  extended bydsql.DMExecuted
      extended bydsql.value.Value
          extended bydsql.value.NonScalarValue
              extended bydsql.value.TableResult
                  extended bydsql.value.AbstractResults
                      extended bydsql.value.SQLResults
All Implemented Interfaces:
ColumnHolder, Cursor, RecordHolder

public class SQLResults
extends AbstractResults

Results from an SQL query (i.e. wrapper around sql.ResultSet)


Field Summary
 
Fields inherited from class dsql.value.TableResult
primaryKeys
 
Constructor Summary
SQLResults(ASTSQL _sqlObj, java.lang.String _sql)
           
 
Method Summary
 void addCurrentResultMeta(ConstructedResults r)
           
 void allreset()
           
protected  void checkRandomColumns()
          Checks whether driver supports reading columns in random order and set canReadRandomColumns accordingly.
protected  void clearCacheValues()
           
 int currentRecord()
           
 void deleteRecord()
           
protected  boolean execute()
           
protected  int findColumn(java.lang.String label)
          needed by TableResult.setPrimaryKeys
 java.lang.Object getColumn(int i)
           
 java.lang.Object getColumn(java.lang.String s)
           
 int getColumnCount()
           
 int getColumnDisplaySize(int i)
           
 java.lang.String getColumnLabel(int i)
           
 java.lang.String getColumnString(int i)
           
 java.lang.String getColumnString(java.lang.String s)
           
 ConstructedResults getMeta(boolean all)
           
protected  java.sql.ResultSetMetaData getMetaData()
           
 int[] getPrimaryKeys()
           
 int getRecordCount()
          this function should be called with care as it can be computationaly expensive for SQL Cursors!
protected  java.lang.String getSQLTypeString(int type)
           
protected  int getUpdateCount()
           
 void gotoRecord(int pos)
           
protected  ExecuteException GotoRecordException(int pos)
           
protected  ExecuteException GotoRecordException(int pos, java.sql.SQLException exc)
           
protected  void growCachedColumns(int i)
           
 boolean hasResult()
           
 void insert(ColumnHolder rec)
           
protected  boolean isResultSet()
           
protected  boolean isUpdate()
           
 boolean nextRecord()
           
 boolean nextResult()
           
protected  ExecuteException NoCurrentResultException()
           
protected  void readColumnsToCache()
           
 java.lang.String[] readCurrentRecord()
           
protected  ExecuteException ReadResultException(java.sql.SQLException exc)
           
 void reset()
           
protected  void resultSetAbsolute(int pos)
          goto the specified record of the current result set.
protected  boolean setResult(boolean isResultSet)
           
 java.lang.String toString()
           
 void update(ColumnHolder rec)
           
 
Methods inherited from class dsql.value.AbstractResults
getMeta, print
 
Methods inherited from class dsql.value.TableResult
equalsRecord, getBoolean, getField, getRecord, getRecord, getString, getTableName, printRecord, setPrimaryKeys, setPrimaryKeys, setRecord
 
Methods inherited from class dsql.value.NonScalarValue
getFields, isScalar, setField
 
Methods inherited from class dsql.value.Value
getFloat, getInt, getObject, getObjectClass, getRecordHolder, getType, getValue, getValue
 
Methods inherited from class dsql.DMExecuted
getCaller, setCaller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SQLResults

public SQLResults(ASTSQL _sqlObj,
                  java.lang.String _sql)
           throws ExecuteException
Method Detail

toString

public java.lang.String toString()

hasResult

public boolean hasResult()
Specified by:
hasResult in class AbstractResults

allreset

public void allreset()
              throws ExecuteException
Specified by:
allreset in class AbstractResults
Throws:
ExecuteException

nextResult

public boolean nextResult()
                   throws ExecuteException
Specified by:
nextResult in class AbstractResults
Returns:
true if there was a result
Throws:
ExecuteException

reset

public void reset()
           throws ExecuteException
Throws:
ExecuteException

currentRecord

public int currentRecord()
                  throws ExecuteException
Throws:
ExecuteException

readCurrentRecord

public java.lang.String[] readCurrentRecord()
                                     throws ExecuteException
Specified by:
readCurrentRecord in class TableResult
Throws:
ExecuteException

gotoRecord

public void gotoRecord(int pos)
                throws ExecuteException
Parameters:
pos - is the record position: 1 is the first record, 0 is the record before first, -1 is after the last record
Throws:
ExecuteException

getRecordCount

public int getRecordCount()
                   throws ExecuteException
Description copied from interface: RecordHolder
this function should be called with care as it can be computationaly expensive for SQL Cursors!

Returns:
number of records
Throws:
ExecuteException

nextRecord

public boolean nextRecord()
                   throws ExecuteException
Returns:
true if there was a record, false otherwise
Throws:
ExecuteException

getColumnString

public java.lang.String getColumnString(int i)
                                 throws ExecuteException
Throws:
ExecuteException

getColumn

public java.lang.Object getColumn(int i)
                           throws ExecuteException
Parameters:
i - column number (first column is 1)
Returns:
column value; usually a String, but can also be a complex object, such as XmlDataValue.
Throws:
ExecuteException

getColumnString

public java.lang.String getColumnString(java.lang.String s)
                                 throws ExecuteException
Throws:
ExecuteException

getColumn

public java.lang.Object getColumn(java.lang.String s)
                           throws ExecuteException
Parameters:
s - column name
Returns:
column value; usually a String, but can also be a complex object, such as XmlDataValue.
Throws:
ExecuteException

getColumnCount

public int getColumnCount()
                   throws ExecuteException
Throws:
ExecuteException

getColumnLabel

public java.lang.String getColumnLabel(int i)
                                throws ExecuteException
Throws:
ExecuteException

getColumnDisplaySize

public int getColumnDisplaySize(int i)
                         throws ExecuteException
Specified by:
getColumnDisplaySize in interface ColumnHolder
Overrides:
getColumnDisplaySize in class TableResult
Throws:
ExecuteException

getPrimaryKeys

public int[] getPrimaryKeys()
                     throws ExecuteException
Overrides:
getPrimaryKeys in class TableResult
Throws:
ExecuteException

getMeta

public ConstructedResults getMeta(boolean all)
                           throws ExecuteException
Specified by:
getMeta in class AbstractResults
Parameters:
all - if true, iterates through all results
Throws:
ExecuteException

addCurrentResultMeta

public void addCurrentResultMeta(ConstructedResults r)
                          throws ExecuteException
Specified by:
addCurrentResultMeta in class AbstractResults
Throws:
ExecuteException

insert

public void insert(ColumnHolder rec)
            throws ExecuteException
Specified by:
insert in class TableResult
Throws:
ExecuteException

deleteRecord

public void deleteRecord()
                  throws ExecuteException
Specified by:
deleteRecord in class TableResult
Throws:
ExecuteException

update

public void update(ColumnHolder rec)
            throws ExecuteException
Specified by:
update in class TableResult
Throws:
ExecuteException

findColumn

protected int findColumn(java.lang.String label)
                  throws ExecuteException
needed by TableResult.setPrimaryKeys

Specified by:
findColumn in class TableResult
Throws:
ExecuteException

getSQLTypeString

protected java.lang.String getSQLTypeString(int type)

isResultSet

protected boolean isResultSet()

getUpdateCount

protected int getUpdateCount()

isUpdate

protected boolean isUpdate()

setResult

protected boolean setResult(boolean isResultSet)
                     throws ExecuteException
Throws:
ExecuteException

resultSetAbsolute

protected void resultSetAbsolute(int pos)
                          throws ExecuteException
goto the specified record of the current result set.

Throws:
ExecuteException

execute

protected boolean execute()
                   throws ExecuteException
Throws:
ExecuteException

checkRandomColumns

protected void checkRandomColumns()
                           throws ExecuteException
Checks whether driver supports reading columns in random order and set canReadRandomColumns accordingly.

Throws:
ExecuteException

readColumnsToCache

protected void readColumnsToCache()
                           throws ExecuteException
Throws:
ExecuteException

growCachedColumns

protected void growCachedColumns(int i)
                          throws ExecuteException
Throws:
ExecuteException

clearCacheValues

protected void clearCacheValues()

getMetaData

protected java.sql.ResultSetMetaData getMetaData()
                                          throws ExecuteException
Throws:
ExecuteException

ReadResultException

protected ExecuteException ReadResultException(java.sql.SQLException exc)

GotoRecordException

protected ExecuteException GotoRecordException(int pos)

GotoRecordException

protected ExecuteException GotoRecordException(int pos,
                                               java.sql.SQLException exc)

NoCurrentResultException

protected ExecuteException NoCurrentResultException()