dbutils
Class SQLRequest
java.lang.Object
|
+--dbutils.SQLRequest
- public class SQLRequest
- extends java.lang.Object
The SQLRequest class uses an instantiation of the ConnectionPool class
and uses connections from the ConnectionPool to create a Result set
based on a search query and return a Result Set
Constructor Summary |
SQLRequest()
Constructor class of SQLRequest class that takes no arguments. |
SQLRequest(java.lang.String sql)
Constructor class of SQLRequest class that takes the SQL string and generates
the Result Set with an Instantion of the ConnectionPool class |
Method Summary |
java.sql.ResultSet |
getResultSet()
Returns result set and returns the used connection to the ConnectionPool |
void |
setResultSet(java.lang.String sql)
Creates the result set using a connection from the ConnectionPool instance and
the current SQL statement and sets the value of rs. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SQLRequest
public SQLRequest(java.lang.String sql)
throws JDBCException
- Constructor class of SQLRequest class that takes the SQL string and generates
the Result Set with an Instantion of the ConnectionPool class
- Parameters:
sql
- query string to build result set- Throws:
JDBCException
- an error occured while creating the result set or while getting an instance of the connection pool
SQLRequest
public SQLRequest()
throws JDBCException
- Constructor class of SQLRequest class that takes no arguments. The setResultSet(String)
must be used to initialize the ResultSet.
- Throws:
JDBCException
- an error occured while getting an instance of the connection pool
setResultSet
public void setResultSet(java.lang.String sql)
throws JDBCException
- Creates the result set using a connection from the ConnectionPool instance and
the current SQL statement and sets the value of rs.
- Parameters:
sql
- query string that pulls desired information from database- Throws:
JDBCException
- an error occured while creating the result set
getResultSet
public java.sql.ResultSet getResultSet()
throws JDBCException
- Returns result set and returns the used connection to the ConnectionPool
- Returns:
- ResultSet of the queried SQL string
- Throws:
JDBCException
- an exception is thrown when the result set is empty