j3.mssql
Class PersonSQL

java.lang.Object
  |
  +--j3.mssql.PersonSQL

public class PersonSQL
extends java.lang.Object

JDBC database table access class
Table Name : Person
Catalog : J3Demo
Schema : dbo
All JDBC calls to the database object are in this class
Generated by JDatabase Wizard build 1466, 24-Oct-02 16:53:49


Field Summary
private  java.sql.PreparedStatement myCurrentSelectStatement
          Currently active select statment
private  java.sql.PreparedStatement myDeleteAllPreparedStatement
          delete method prepared statement
private  java.sql.PreparedStatement myDeleteByEmailPreparedStatement
          delete method prepared statement
private  java.sql.PreparedStatement myInsertPreparedStatement
          insert method PreparedStatement
private  java.sql.ResultSet myResultSet
          Class wide resultset used to extract data
private  java.sql.PreparedStatement mySelectAllPreparedStatement
          Select method prepared statement
private  java.sql.PreparedStatement myUpdateByEmailPreparedStatement
          Update method prepared statement
 
Constructor Summary
PersonSQL()
           
 
Method Summary
 PersonData absolute(int thePosition)
          Retieves the row of data from the resultset at the given position
1 gets the first row, 2 the second....
-1 gets the last row, -2 gets the row before the last one....
 void afterLast()
          Set the current cursor position after the last row, if there is a resultset
 void beforeFirst()
          Set the current cursor position beofre the first row, if there is a resultset
 void close()
          close all open statements and resutlset, if open
 void closeDeleteAll()
          Close the PreparedStatement for deleteAll if it is open
 void closeDeleteByEmail()
          Close the PreparedStatement for deleteByEmail if it is open
 void closeInsert()
          Close the PreparedStatement for insert if it is open
 void closeResultSet()
          Closes the resultset member if open
 void closeSelectAll()
          Close the PreparedStatement for selectAll if it is open Also closes the resultset member myResultSet if it is associated with this statement
 void closeUpdateByEmail()
          Close the PreparedStatement for updateByEmail if it is open
 void deleteAll(java.sql.Connection theConnection)
          Deletes records in the database
 void deleteByEmail(java.sql.Connection theConnection, java.lang.String theEmail)
          Deletes records in the database
 void deleteRow()
          Delete the current row, if there is a resultset
protected  void finalize()
          close any open statements and resultset
 PersonData first()
          Retieves the first row of data from the resultset
 int getConcurrency()
          Get the current resultset concurrency
 int getFetchDirection()
          Get the current fetch direction
 int getFetchSize()
          Get the current fetch size
private  PersonData getResultSetRecord()
          Retieves the current row of data from the resultset
 int getRow()
          Get the current row number
 int getType()
          Get the current resultset scroll type
 void insert(java.sql.Connection theConnection, PersonData theInsertData)
          Creates a new record in the database
 void insertRow(PersonData theInsertData)
          ResultSet insert method, only columns set for select and insert are inserted
 boolean isAfterLast()
          Determine if the current cursor is after the last row in the resultset.
 boolean isBeforeFirst()
          Determine if the current cursor is before the first row in the resultset.
 boolean isFirst()
          Determine if the current cursor is on the first row in the resultset.
 boolean isLast()
          Determine if the current cursor is at the last row in the resultset.
 PersonData last()
          Retieves the first row of data from the resultset
 void moveToCurrentRow()
          set the cursor to the remembered position, usually the current row, if there is a resultset
 void moveToInsertRow()
          move the cursor to the insert position, if there is a resultset
 PersonData next()
          Retieves the next row of data from the resultset
 PersonData previous()
          Retieves the previous row of data from the resultset
 PersonData refreshRow()
          Refreshes and retieves the current row of data from the resultset
 PersonData relative(int thePosition)
          Retieves the relative row of data from the resultset.
See JDBC docs (ResultSet) for a discussion of relative() with respect to beforeFirst,....
 boolean rowDeleted()
          Determine if the current row has been deleted, if the driver detects this.
 boolean rowInserted()
          Determine if the current row has been inserted, if the driver detects this.
 boolean rowUpdated()
          Determine if the current row has been updated, if the driver detects this.
 void selectAll(java.sql.Connection theConnection)
          Selects records from the database
 void setFetchDirection(int theDirection)
          Set the fetch direction on the reusltset, if there is one.
 void setFetchSize(int theSize)
          Set the fetch size on the reusltset, if there is a resultset.
A value of 0 lets the ResultSet determine the size to use
 void updateByEmail(java.sql.Connection theConnection, PersonData theUpdateData, java.lang.String theEmail)
          updates records in the database
 void updateRow(PersonData theUpdateData)
          ResultSet update method, only columns set for select and update are updated
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

myCurrentSelectStatement

private java.sql.PreparedStatement myCurrentSelectStatement
Currently active select statment

myDeleteAllPreparedStatement

private java.sql.PreparedStatement myDeleteAllPreparedStatement
delete method prepared statement

myDeleteByEmailPreparedStatement

private java.sql.PreparedStatement myDeleteByEmailPreparedStatement
delete method prepared statement

myInsertPreparedStatement

private java.sql.PreparedStatement myInsertPreparedStatement
insert method PreparedStatement

myResultSet

private java.sql.ResultSet myResultSet
Class wide resultset used to extract data

mySelectAllPreparedStatement

private java.sql.PreparedStatement mySelectAllPreparedStatement
Select method prepared statement

myUpdateByEmailPreparedStatement

private java.sql.PreparedStatement myUpdateByEmailPreparedStatement
Update method prepared statement
Constructor Detail

PersonSQL

public PersonSQL()
Method Detail

absolute

public PersonData absolute(int thePosition)
                    throws java.sql.SQLException
Retieves the row of data from the resultset at the given position
1 gets the first row, 2 the second....
-1 gets the last row, -2 gets the row before the last one....
Parameters:
thePosition - Position in the ResultSet to scroll to
Returns:
An instance of the data class
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

afterLast

public void afterLast()
               throws java.sql.SQLException
Set the current cursor position after the last row, if there is a resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

beforeFirst

public void beforeFirst()
                 throws java.sql.SQLException
Set the current cursor position beofre the first row, if there is a resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

close

public void close()
close all open statements and resutlset, if open

closeDeleteAll

public void closeDeleteAll()
Close the PreparedStatement for deleteAll if it is open

closeDeleteByEmail

public void closeDeleteByEmail()
Close the PreparedStatement for deleteByEmail if it is open

closeInsert

public void closeInsert()
Close the PreparedStatement for insert if it is open

closeResultSet

public void closeResultSet()
Closes the resultset member if open

closeSelectAll

public void closeSelectAll()
Close the PreparedStatement for selectAll if it is open Also closes the resultset member myResultSet if it is associated with this statement

closeUpdateByEmail

public void closeUpdateByEmail()
Close the PreparedStatement for updateByEmail if it is open

deleteAll

public void deleteAll(java.sql.Connection theConnection)
               throws java.sql.SQLException
Deletes records in the database
Parameters:
theConnection - The OPEN JDBC Connection used by this method
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

deleteByEmail

public void deleteByEmail(java.sql.Connection theConnection,
                          java.lang.String theEmail)
                   throws java.sql.SQLException
Deletes records in the database
Parameters:
theConnection - The OPEN JDBC Connection used by this method
theEmail - parameter value Email
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

deleteRow

public void deleteRow()
               throws java.sql.SQLException
Delete the current row, if there is a resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

finalize

protected void finalize()
                 throws java.lang.Throwable
close any open statements and resultset
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - superclass could throw this

first

public PersonData first()
                 throws java.sql.SQLException
Retieves the first row of data from the resultset
Returns:
An instance of the data class
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

getConcurrency

public int getConcurrency()
                   throws java.sql.SQLException
Get the current resultset concurrency
Returns:
ResultSet.CONCUR_READ_ONLY ... if there is a current resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred or if there is no current ResultSet

getFetchDirection

public int getFetchDirection()
                      throws java.sql.SQLException
Get the current fetch direction
Returns:
the current fetch direction, ResultSet.FETCH_UNKNOWN if there is no resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

getFetchSize

public int getFetchSize()
                 throws java.sql.SQLException
Get the current fetch size
Returns:
the current fetch size, 0 if there is no resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

getResultSetRecord

private PersonData getResultSetRecord()
                               throws java.sql.SQLException
Retieves the current row of data from the resultset
Returns:
An instance of the data class
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

getRow

public int getRow()
           throws java.sql.SQLException
Get the current row number
Returns:
the current row number (1..n), 0 if there is current row, or no resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

getType

public int getType()
            throws java.sql.SQLException
Get the current resultset scroll type
Returns:
ResultSet.TYPE_FORWARD_ONLY... if there is a current resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred or if there is no current ResultSet

insert

public void insert(java.sql.Connection theConnection,
                   PersonData theInsertData)
            throws java.sql.SQLException
Creates a new record in the database
Parameters:
theConnection - The JDBC Connection to use
theInsertData - The data used to create one record
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

insertRow

public void insertRow(PersonData theInsertData)
               throws java.sql.SQLException
ResultSet insert method, only columns set for select and insert are inserted
Parameters:
theInsertData - The data used to insert one record
Throws:
java.sql.SQLException - The ResultSet is null, or an unexpected JDBC event occurred

isAfterLast

public boolean isAfterLast()
                    throws java.sql.SQLException
Determine if the current cursor is after the last row in the resultset.
Returns:
true if the cursor position is after last, false if it is not or if there is no current row
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

isBeforeFirst

public boolean isBeforeFirst()
                      throws java.sql.SQLException
Determine if the current cursor is before the first row in the resultset.
Returns:
true if the cursor position is before the first record, false if it is not or if there is no current row
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

isFirst

public boolean isFirst()
                throws java.sql.SQLException
Determine if the current cursor is on the first row in the resultset.
Returns:
true if the cursor position is on the first row, false if it is not or if there is no current row
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

isLast

public boolean isLast()
               throws java.sql.SQLException
Determine if the current cursor is at the last row in the resultset. This may cause the ResultSet to fetch the next row, to determine if the current one is last, could be computationally expensive.
Returns:
true if the cursor position is last, false if it is not last or if there is no current row
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

last

public PersonData last()
                throws java.sql.SQLException
Retieves the first row of data from the resultset
Returns:
An instance of the data class
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

moveToCurrentRow

public void moveToCurrentRow()
                      throws java.sql.SQLException
set the cursor to the remembered position, usually the current row, if there is a resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

moveToInsertRow

public void moveToInsertRow()
                     throws java.sql.SQLException
move the cursor to the insert position, if there is a resultset
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

next

public PersonData next()
                throws java.sql.SQLException
Retieves the next row of data from the resultset
Returns:
An instance of the data class
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

previous

public PersonData previous()
                    throws java.sql.SQLException
Retieves the previous row of data from the resultset
Returns:
An instance of the data class
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

refreshRow

public PersonData refreshRow()
                      throws java.sql.SQLException
Refreshes and retieves the current row of data from the resultset
Returns:
An instance of the data class
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

relative

public PersonData relative(int thePosition)
                    throws java.sql.SQLException
Retieves the relative row of data from the resultset.
See JDBC docs (ResultSet) for a discussion of relative() with respect to beforeFirst,....
Parameters:
thePosition - Relative position (+ or -) in the ResultSet to scroll to
Returns:
An instance of the data class
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

rowDeleted

public boolean rowDeleted()
                   throws java.sql.SQLException
Determine if the current row has been deleted, if the driver detects this.
Returns:
true if a row has been deleted, false if it is not or if there is no current row
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

rowInserted

public boolean rowInserted()
                    throws java.sql.SQLException
Determine if the current row has been inserted, if the driver detects this.
Returns:
true if the current row has been inserted, false if it is not or if there is no current row
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

rowUpdated

public boolean rowUpdated()
                   throws java.sql.SQLException
Determine if the current row has been updated, if the driver detects this.
Returns:
true if the current row has been updated, false if it is not or if there is no current row
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

selectAll

public void selectAll(java.sql.Connection theConnection)
               throws java.sql.SQLException
Selects records from the database
Parameters:
theConnection - The OPEN JDBC connection to use
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

setFetchDirection

public void setFetchDirection(int theDirection)
                       throws java.sql.SQLException
Set the fetch direction on the reusltset, if there is one.
Parameters:
theDirection - Fetch direction: ResultSet.FETCH_FORWARD or ResultSet.FETCH_REVERSE
Throws:
java.sql.SQLException - An unexpected JDBC event occurred, or the fetch direction is invalid (statmenet is forward only)

setFetchSize

public void setFetchSize(int theSize)
                  throws java.sql.SQLException
Set the fetch size on the reusltset, if there is a resultset.
A value of 0 lets the ResultSet determine the size to use
Parameters:
theSize - Fetch size: hint at the number of rows the ResultSet should fetch in one go.
Throws:
java.sql.SQLException - An unexpected JDBC event occurred, or the fetch direction is invalid (statmenet is forward only)

updateByEmail

public void updateByEmail(java.sql.Connection theConnection,
                          PersonData theUpdateData,
                          java.lang.String theEmail)
                   throws java.sql.SQLException
updates records in the database
Parameters:
theConnection - The OPEN JDBC connection to use
theUpdateData - The data used to update the database
theEmail - parameter value Email
Throws:
java.sql.SQLException - An unexpected JDBC event occurred

updateRow

public void updateRow(PersonData theUpdateData)
               throws java.sql.SQLException
ResultSet update method, only columns set for select and update are updated
Parameters:
theUpdateData - The data used to insert one record
Throws:
java.sql.SQLException - The ResultSet is null, or an unexpected JDBC event occurred