Package com.spotfire.ws.im.ds.sql
Class BasicSQLRuntime
- java.lang.Object
-
- com.spotfire.ws.im.ds.sql.BasicSQLRuntime
-
- All Implemented Interfaces:
SQLRuntime
public class BasicSQLRuntime extends Object implements SQLRuntime
A basic implementation of theSQLRuntime
interface.- Since:
- 3.0
- Author:
- Magnus Rylander
- See Also:
StatementWrapper
,PreparedStatementWrapper
,ResultSetWrapper
-
-
Constructor Summary
Constructors Constructor Description BasicSQLRuntime()
Creates a newBasicSQLRuntime
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeStatement(Statement stmt)
Closes a JDBCStatement
object.protected Statement
createStatement()
Creates a new JDBCStatement
instance.ResultSet
executeQuery(String sql)
Executes a SQL query.void
executeUpdate(String sql)
Executes a SQL statement.Connection
getConnection()
JDBCContext
getContext()
CallableStatement
prepareCall(String sql)
Creates aCallableStatement
object for calling database stored procedures.PreparedStatement
prepareQuery(String sql)
PreparedStatement
prepareUpdate(String sql)
void
setConnection(Connection conn)
Sets the JDBC database connection.void
setContext(JDBCContext s)
Sets the JDBC context.
-
-
-
Method Detail
-
setConnection
public void setConnection(Connection conn)
Description copied from interface:SQLRuntime
Sets the JDBC database connection.- Specified by:
setConnection
in interfaceSQLRuntime
- Parameters:
conn
- connection- Since:
- 3.0
-
getConnection
public Connection getConnection()
- Specified by:
getConnection
in interfaceSQLRuntime
- Returns:
- Returns the JDBC database connection.
- Since:
- 3.0
-
setContext
public void setContext(JDBCContext s)
Description copied from interface:SQLRuntime
Sets the JDBC context.- Specified by:
setContext
in interfaceSQLRuntime
- Parameters:
s
- JDBCContext- Since:
- 3.0
-
getContext
public JDBCContext getContext()
- Specified by:
getContext
in interfaceSQLRuntime
- Returns:
- Returns the JDBC context.
- Since:
- 3.0
-
executeUpdate
public void executeUpdate(String sql) throws SQLException
Description copied from interface:SQLRuntime
Executes a SQL statement.- Specified by:
executeUpdate
in interfaceSQLRuntime
- Parameters:
sql
- SQL- Throws:
SQLException
- SQLException- Since:
- 3.0
-
prepareUpdate
public PreparedStatement prepareUpdate(String sql) throws SQLException
- Specified by:
prepareUpdate
in interfaceSQLRuntime
- Parameters:
sql
- SQL- Returns:
- Creates a precompiled SQL statement.
- Throws:
SQLException
- SQLException- Since:
- 3.0
-
prepareQuery
public PreparedStatement prepareQuery(String sql) throws SQLException
- Specified by:
prepareQuery
in interfaceSQLRuntime
- Parameters:
sql
- SQL- Returns:
- Creates a precompiled SQL statement for a parameterized query.
- Throws:
SQLException
- SQLException- Since:
- 3.0
-
executeQuery
public ResultSet executeQuery(String sql) throws SQLException
Description copied from interface:SQLRuntime
Executes a SQL query.- Specified by:
executeQuery
in interfaceSQLRuntime
- Parameters:
sql
- SQL- Returns:
- ResultSet
- Throws:
SQLException
- SQLException- Since:
- 3.0
-
prepareCall
public CallableStatement prepareCall(String sql) throws SQLException
Description copied from interface:SQLRuntime
Creates aCallableStatement
object for calling database stored procedures.- Specified by:
prepareCall
in interfaceSQLRuntime
- Parameters:
sql
- SQL- Returns:
- CallableStatement
- Throws:
SQLException
- SQLException- Since:
- 3.0
-
createStatement
protected Statement createStatement() throws SQLException
Creates a new JDBCStatement
instance.- Returns:
- a new
Statement
object - Throws:
SQLException
- if database error occurs- Since:
- 3.0
-
closeStatement
protected void closeStatement(Statement stmt)
Closes a JDBCStatement
object.- Parameters:
stmt
- aStatement
object- Since:
- 3.0
-
-