com.partnersoft.sql
Class SqlDataRecordSource

java.lang.Object
  extended by com.partnersoft.io.AbstractIterableInput<Naming<java.lang.Object>>
      extended by com.partnersoft.io.DataRecordSource
          extended by com.partnersoft.sql.SqlDataRecordSource
All Implemented Interfaces:
Coggable, IterableInput<Naming<java.lang.Object>>, java.lang.Iterable<Naming<java.lang.Object>>

public class SqlDataRecordSource
extends DataRecordSource

A DataRecordSource derived from an SQL query.

Copyright 2001-2007 Partner Software, Inc.

Version:
$Id: SqlDataRecordSource.java 2474 2010-03-13 14:28:43Z paul $
Author:
Paul Reavis

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.partnersoft.io.IterableInput
IterableInput.Status
 
Field Summary
 
Fields inherited from class com.partnersoft.io.DataRecordSource
currentValues, fieldNames, verbose
 
Constructor Summary
SqlDataRecordSource(Cog state)
           
SqlDataRecordSource(SqlConnection connection, java.sql.PreparedStatement statement)
           
SqlDataRecordSource(SqlConnection connection, java.sql.Statement statement, java.lang.String query)
           
SqlDataRecordSource(SqlConnection connection, java.lang.String query)
           
SqlDataRecordSource(SqlConnection connection, java.lang.String query, java.lang.Object... parameters)
           
SqlDataRecordSource(SqlDatabase database, java.lang.String query)
           
SqlDataRecordSource(SqlDatabase database, java.lang.String query, java.lang.Object... parameters)
           
 
Method Summary
 void closeImp()
          Subclass implementation of guts of close() method.
 DataRecordSource copy()
          Makes a copy of this DataRecordSource, that you can iterate over separately.
 boolean fetchImp()
          Subclass implementation of guts of fetch() method.
 SqlConnection getConnection()
           
 SqlDatabase getDatabase()
           
 java.lang.Object[] getParameters()
           
 java.lang.String getQuery()
           
 java.sql.Statement getStatement()
           
 boolean isOpen()
           
 void openImp()
          Subclass implementation of guts of open() method.
 void setConnection(SqlConnection newConnection)
           
 void setDatabase(SqlDatabase newDatabase)
           
 void setParameters(java.lang.Object... newParameters)
           
 void setQuery(java.lang.String newQuery)
           
 void setStatement(java.sql.Statement newStatement)
           
 java.lang.String toString()
           
 
Methods inherited from class com.partnersoft.io.DataRecordSource
fetch, getCurrentValues, getFetched, getFieldNames, isVerbose, setVerbose, toCog
 
Methods inherited from class com.partnersoft.io.AbstractIterableInput
close, getException, getStatus, isFetchValid, iterator, open
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SqlDataRecordSource

public SqlDataRecordSource(SqlDatabase database,
                           java.lang.String query)

SqlDataRecordSource

public SqlDataRecordSource(SqlConnection connection,
                           java.lang.String query)

SqlDataRecordSource

public SqlDataRecordSource(SqlDatabase database,
                           java.lang.String query,
                           java.lang.Object... parameters)

SqlDataRecordSource

public SqlDataRecordSource(SqlConnection connection,
                           java.lang.String query,
                           java.lang.Object... parameters)

SqlDataRecordSource

public SqlDataRecordSource(SqlConnection connection,
                           java.sql.Statement statement,
                           java.lang.String query)

SqlDataRecordSource

public SqlDataRecordSource(SqlConnection connection,
                           java.sql.PreparedStatement statement)

SqlDataRecordSource

public SqlDataRecordSource(Cog state)
Method Detail

openImp

public void openImp()
             throws java.lang.Exception
Description copied from class: AbstractIterableInput
Subclass implementation of guts of open() method.

Subclasses must implement this to do the actual work required by open(). Feel free to throw exceptions; these are caught inside the open() itself and applied to the exception variable. Thus, you can focus on the actual task instead of paperwork.

Specified by:
openImp in class AbstractIterableInput<Naming<java.lang.Object>>
Throws:
java.lang.Exception

fetchImp

public boolean fetchImp()
                 throws java.lang.Exception
Description copied from class: AbstractIterableInput
Subclass implementation of guts of fetch() method.

Subclasses must implement this to do the actual work required by fetch(). Feel free to throw exceptions; these are caught inside the fetch() itself and applied to the exception variable. Thus, you can focus on the actual task instead of paperwork.

Specified by:
fetchImp in class AbstractIterableInput<Naming<java.lang.Object>>
Returns:
true if fetch successful
Throws:
java.lang.Exception

closeImp

public void closeImp()
              throws java.lang.Exception
Description copied from class: AbstractIterableInput
Subclass implementation of guts of close() method.

Subclasses must implement this to do the actual work required by close(). Feel free to throw exceptions; these are caught inside the close() itself and applied to the exception variable. Thus, you can focus on the actual task instead of paperwork.

Specified by:
closeImp in class AbstractIterableInput<Naming<java.lang.Object>>
Throws:
java.lang.Exception

copy

public DataRecordSource copy()
Description copied from class: DataRecordSource
Makes a copy of this DataRecordSource, that you can iterate over separately.

Specified by:
copy in class DataRecordSource
Returns:
copy of this source

isOpen

public boolean isOpen()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDatabase

public SqlDatabase getDatabase()

setDatabase

public void setDatabase(SqlDatabase newDatabase)

getConnection

public SqlConnection getConnection()

setConnection

public void setConnection(SqlConnection newConnection)

getStatement

public java.sql.Statement getStatement()

setStatement

public void setStatement(java.sql.Statement newStatement)

getQuery

public java.lang.String getQuery()

setQuery

public void setQuery(java.lang.String newQuery)

getParameters

public java.lang.Object[] getParameters()

setParameters

public void setParameters(java.lang.Object... newParameters)