
public.javadoc.org.spincast.plugins.jdbc.NamedParameterStatement.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
NamedParameterStatement (org.spincast:spincast-framework 2.1.1 API)
Package org.spincast.plugins.jdbc
Class NamedParameterStatement
java.lang.Object
org.spincast.plugins.jdbc.NamedParameterStatement
- Author:
- adam_crume
http://www.javaworld.com/article/2077706/core-java/named-parameters-for-preparedstatement.html
-
Constructor Summary
Constructors
Constructor
Description
NamedParameterStatement(Connection connection,
String query)
Creates a NamedParameterStatement.
NamedParameterStatement(Connection connection,
String query,
int autoGeneratedKeys)
Spincast added
-
Method Summary
Modifier and Type
Method
Description
void
addBatch()
Adds the current set of parameters as a batch entry.
void
close()
Closes the statement.
boolean
execute()
Executes the statement.
int[]
Executes all of the batched statements.
Executes the statement, which must be a query.
int
Executes the statement, which must be an SQL INSERT, UPDATE or DELETE statement;
or an SQL statement that returns nothing, such as a DDL statement.
Spincast added
Returns the underlying statement.
void
Added to the original code by Spincast.
void
Sets a parameter.
void
Sets a parameter.
void
Sets a parameter.
void
Sets a parameter.
void
setTimestamp(String name,
Timestamp value)
Sets a parameter.
-
Constructor Details
-
NamedParameterStatement
Creates a NamedParameterStatement. Wraps a call to
c.prepareStatement
.
- Parameters:
connection
- the database connection
query
- the parameterized query
- Throws:
SQLException
- if the statement could not be created
-
NamedParameterStatement
public NamedParameterStatement(Connection connection,
String query,
int autoGeneratedKeys)
throws SQLException
Spincast added
- Throws:
SQLException
-
Method Details
-
setObject
Sets a parameter.
- Parameters:
name
- parameter name
value
- parameter value
- Throws:
SQLException
- if an error occurred
IllegalArgumentException
- if the parameter does not exist
- See Also:
-
-
setString
Sets a parameter.
- Parameters:
name
- parameter name
value
- parameter value
- Throws:
SQLException
- if an error occurred
IllegalArgumentException
- if the parameter does not exist
- See Also:
-
-
setInt
Sets a parameter.
- Parameters:
name
- parameter name
value
- parameter value
- Throws:
SQLException
- if an error occurred
IllegalArgumentException
- if the parameter does not exist
- See Also:
-
-
setLong
Sets a parameter.
- Parameters:
name
- parameter name
value
- parameter value
- Throws:
SQLException
- if an error occurred
IllegalArgumentException
- if the parameter does not exist
- See Also:
-
-
setTimestamp
Sets a parameter.
- Parameters:
name
- parameter name
value
- parameter value
- Throws:
SQLException
- if an error occurred
IllegalArgumentException
- if the parameter does not exist
- See Also:
-
-
setBytes
Added to the original code by Spincast.
- Throws:
SQLException
-
getStatement
Returns the underlying statement.
- Returns:
- the statement
-
execute
Executes the statement.
- Returns:
- true if the first result is a
ResultSet
- Throws:
SQLException
- if an error occurred
- See Also:
-
-
executeQuery
Executes the statement, which must be a query.
- Returns:
- the query results
- Throws:
SQLException
- if an error occurred
- See Also:
-
-
executeUpdate
Executes the statement, which must be an SQL INSERT, UPDATE or DELETE statement;
or an SQL statement that returns nothing, such as a DDL statement.
- Returns:
- number of rows affected
- Throws:
SQLException
- if an error occurred
- See Also:
-
-
close
Closes the statement.
- Throws:
SQLException
- if an error occurred
- See Also:
-
-
addBatch
Adds the current set of parameters as a batch entry.
- Throws:
SQLException
- if something went wrong
-
executeBatch
Executes all of the batched statements.
See Statement.executeBatch()
for details.
- Returns:
- update counts for each statement
- Throws:
SQLException
- if something went wrong
-
getGeneratedKeys
Spincast added
- Throws:
SQLException
© 2015 - 2025 Weber Informatics LLC | Privacy Policy