Interface IQuery
- All Known Implementing Classes:
SqlQuery
public interface IQuery
The query class represents a database query that can be executed on the connection is was created for. This class
hides the platform specific database classes like PreparedStatement. After creating a query, the various set methods
may be used to provide the values for the (optional) parameters in the query. Note: The parameters should be added in
the same order as specified in the query.
- Since:
- 6.3
- Author:
- O. Kerpershoek
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
This method should be used to close the query once it is no longer used.execute()
This method will execute the query and return an object that can be used to iterate over the results of the query.int
This method will execute the query and return the number of rows that were affected by the query.long
This method returns the ID of the last inserted record (if available).void
setBoolean
(boolean booleanValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.void
setBytes
(byte[] content) Sets an object on the query after the position of the last setter call to null; Making this function order dependent.void
Sets an object on the query after the position of the last setter call; Making this function order dependent.void
setDateTimeValue
(DateTimeValue dateTimeValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.void
setDateValue
(DateValue dateValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.void
setDouble
(double doubleValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.void
setFloat
(float floatValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.void
setInteger
(int integerValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.void
setLong
(long longValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.void
Sets an object on the query after the position of the last setter call to null; Making this function order dependent.void
setParameters
(List<Object> parameters) Set multiple parameters.void
Sets an object on the query after the position of the last setter call; Making this function order dependent.void
setStringValue
(StringValue stringValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.
-
Method Details
-
close
void close()This method should be used to close the query once it is no longer used. The close method should be invoked to release external resources claimed by the query. -
execute
IQueryResult execute()This method will execute the query and return an object that can be used to iterate over the results of the query. For update queries (insert, delete, etc...) use the executeUpdate method.- Returns:
- Object that can be used to iterate over the result of the query.
-
executeUpdate
int executeUpdate()This method will execute the query and return the number of rows that were affected by the query.- Returns:
- The number of rows that were updated.
-
getIdentity
long getIdentity()This method returns the ID of the last inserted record (if available).- Returns:
- the ID of the last inserted record.
-
setParameters
Set multiple parameters. The parameters list passed to this method does not have to be an uniform list of parameters. Parameters may be mixed. Note: The parameters passed to this method is an List due to the .NET conversion.- Parameters:
parameters
- a non-null list of parameters containing ( String, Long, Integer ... ) objects.
-
setBoolean
void setBoolean(boolean booleanValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
booleanValue
- The value that should be set at the specified index.
-
setDate
Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
dateValue
- The value that should be set at the specified index.
-
setDateValue
Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
dateValue
- The value that should be set at the specified index.
-
setDateTimeValue
Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
dateTimeValue
- The value that should be set at the specified index.
-
setDouble
void setDouble(double doubleValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
doubleValue
- The value that should be set at the specified index.
-
setFloat
void setFloat(float floatValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
floatValue
- The value that should be set at the specified index.
-
setInteger
void setInteger(int integerValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
integerValue
- The value that should be set at the specified index.
-
setLong
void setLong(long longValue) Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
longValue
- The value that should be set at the specified index.
-
setString
Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
stringValue
- The value that should be set at the specified index.
-
setStringValue
Sets an object on the query after the position of the last setter call; Making this function order dependent.- Parameters:
stringValue
- The value that should be set at the specified index.
-
setNull
Sets an object on the query after the position of the last setter call to null; Making this function order dependent.- Parameters:
type
- The type of the column that should be set to null.
-
setBytes
void setBytes(byte[] content) Sets an object on the query after the position of the last setter call to null; Making this function order dependent.- Parameters:
content
- The value that should be set at the specified index.
-