public class SafeQuery
extends java.lang.Object
com.tagmatasecurity.safequerylib package documentation
.Modifier and Type | Field and Description |
---|---|
protected java.sql.Connection |
connection
The SQL connection object that is used to connect to the database.
|
Constructor and Description |
---|
SafeQuery(java.sql.Connection connection)
Each SafeQuery object can create a single query, execute it, and return the results.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addData(boolean value)
Inserts a boolean value to the query.
|
boolean |
addData(byte data)
Inserts a single byte of data into the query.
|
boolean |
addData(byte[] data)
Inserts an array of byte data into the query.
|
boolean |
addData(char data)
Inserts a 16-bit Unicode char into the query.
|
boolean |
addData(java.sql.Date data)
Inserts a Date object to the query.
|
boolean |
addData(java.sql.Date data,
java.util.Calendar calendar)
Inserts a Date object that is associated with a particular Calendar to the query.
|
boolean |
addData(double number)
Inserts double-precision float data into the query.
|
boolean |
addData(float number)
Inserts float data into the query.
|
boolean |
addData(int number)
Inserts int data into the query.
|
boolean |
addData(long number)
Inserts long int data into the query.
|
boolean |
addData(short number)
Inserts short int data into the query.
|
boolean |
addData(java.lang.String str)
Inserts String data into the query.
|
boolean |
addData(java.sql.Time data)
Inserts a Time object to the query.
|
boolean |
addData(java.sql.Time data,
java.util.Calendar calendar)
Inserts a Time object associated with a particular Calendar object to the query.
|
boolean |
addData(java.sql.Timestamp data)
Inserts a Timestamp object to the query.
|
boolean |
addData(java.sql.Timestamp data,
java.util.Calendar calendar)
Inserts a Timestamp object associated with a particular Calendar object to the query.
|
boolean |
addNData(java.lang.String str)
Inserts String data into the query.
|
boolean |
addNull(int data_type)
Inserts a null value into the query.
|
boolean |
addNull(int data_type,
java.lang.String type_name)
Inserts a null value into the query.
|
boolean |
addStructure(java.lang.String str)
Constructs a portion of the query using the String object.
|
void |
clear()
Removes all of the structure and data from the object.
|
void |
close()
Closes the query object.
|
boolean |
execute()
Executes the current query.
|
java.sql.ResultSet |
executeSelect()
Executes the current query.
|
int |
executeUpdate()
Executes the current query.
|
java.sql.Connection |
getConnection()
Obtains the Connection object.
|
boolean |
getMoreResults()
Advances the database to the next ResultSet.
|
boolean |
getMoreResults(int current_flag)
Advances the database to the next ResultSet.
|
java.sql.ResultSet |
getResultSet()
Retrieves the current ResultSet; it should be called only once.
|
int |
getUpdateCount()
Retrieves the current row count.
|
protected java.sql.Connection connection
public SafeQuery(java.sql.Connection connection)
connection
- an SQL connection objectconnection
public boolean addData(java.lang.String str)
str
- the String datapublic boolean addData(int number)
number
- the data as an intpublic boolean addData(short number)
number
- the data as a short intpublic boolean addData(long number)
number
- the data as a long intpublic boolean addData(float number)
number
- the data as a floatpublic boolean addData(double number)
number
- the data as a double-precision floatpublic boolean addData(byte data)
data
- the bytepublic boolean addData(byte[] data)
data
- the byte arraypublic boolean addData(char data)
data
- the charpublic boolean addData(boolean value)
value
- the boolean valuepublic boolean addData(java.sql.Date data)
data
- the Date objectpublic boolean addData(java.sql.Date data, java.util.Calendar calendar)
data
- the Date objectcalendar
- the Calendar objectpublic boolean addData(java.sql.Time data)
data
- the Time objectpublic boolean addData(java.sql.Time data, java.util.Calendar calendar)
data
- the Time objectcalendar
- the Calendar objectpublic boolean addData(java.sql.Timestamp data)
data
- the Timestamp objectpublic boolean addData(java.sql.Timestamp data, java.util.Calendar calendar)
data
- the Timestamp objectcalendar
- the Calendar objectpublic boolean addNData(java.lang.String str)
str
- the String datapublic boolean addNull(int data_type)
data_type
- the type of SQL data to be set to null; the types are defined in java.sql.TypesTypes
public boolean addNull(int data_type, java.lang.String type_name)
data_type
- the type of SQL data to be set to null; the types are defined in java.sql.Typestype_name
- the fully-qualified name of a user-defined SQL data type; ignored if data_type is not a user-defined type or is of type REFTypes
public boolean addStructure(java.lang.String str)
str
- the String segmentpublic void clear()
public void close() throws java.sql.SQLException
java.sql.SQLException
public boolean execute() throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet executeSelect() throws java.sql.SQLException
java.sql.SQLException
public int executeUpdate() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Connection getConnection()
public boolean getMoreResults() throws java.sql.SQLException
java.sql.SQLException
public boolean getMoreResults(int current_flag) throws java.sql.SQLException
current_flag
- java.sql.SQLException
public java.sql.ResultSet getResultSet() throws java.sql.SQLException
java.sql.SQLException
public int getUpdateCount() throws java.sql.SQLException
java.sql.SQLException