Package com.basiscomponents.bc
Class SqlQueryBC
- java.lang.Object
-
- com.basiscomponents.bc.SqlQueryBC
-
public class SqlQueryBC extends Object
-
-
Constructor Summary
Constructors Constructor Description SqlQueryBC(String url)
default Constructor only with urlSqlQueryBC(String driver, String url, String user, String password)
default constuctor setting fieldsSqlQueryBC(Connection con)
Contructor with aConnection
to use
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
execute(String sql)
Boolean
execute(String sql, List<Object> params)
String
getLastExecute()
helper Method to get the last SQL Statementperformed inexecute(String, List)
to turn on tracing seeTracingConfiguration.SQL
String
getLastRetrieve()
helper Method to get the last SQL Statemen tperformed inretrieve(String, List)
to turn on tracing seeTracingConfiguration.SQL
String
getLastSql()
helper Method to get the last SQL Statementperformed to turn on tracing seeTracingConfiguration.SQL
ResultSet
retrieve(String sql)
ResultSet
retrieve(String sql, List<Object> params)
-
-
-
Constructor Detail
-
SqlQueryBC
public SqlQueryBC(String url)
default Constructor only with url- Parameters:
url
- theurl
to connect to
-
SqlQueryBC
public SqlQueryBC(String driver, String url, String user, String password) throws ClassNotFoundException
default constuctor setting fields- Parameters:
driver
- the classname of the driver in useurl
- theurl
to connect touser
- username for the given sql connectionpassword
- password for the given connection- Throws:
ClassNotFoundException
- if the given driver can not be found byClassLoader
-
SqlQueryBC
public SqlQueryBC(Connection con) throws SQLException
Contructor with aConnection
to use- Parameters:
con
- theConnection
to use to interact with- Throws:
SQLException
- ifConnection.isClosed()
throws aSQLException
-
-
Method Detail
-
retrieve
public ResultSet retrieve(String sql) throws SQLException
- Throws:
SQLException
-
retrieve
public ResultSet retrieve(String sql, List<Object> params) throws SQLException
- Throws:
SQLException
-
execute
public Boolean execute(String sql) throws SQLException
- Throws:
SQLException
-
execute
public Boolean execute(String sql, List<Object> params) throws SQLException
- Throws:
SQLException
-
getLastSql
public String getLastSql()
helper Method to get the last SQL Statementperformed to turn on tracing seeTracingConfiguration.SQL
- Returns:
- the last performed and logged SQL statement. Can be
null
-
getLastRetrieve
public String getLastRetrieve()
helper Method to get the last SQL Statemen tperformed inretrieve(String, List)
to turn on tracing seeTracingConfiguration.SQL
- Returns:
- the last performed and logged SQL statement by
retrieve(String, List)
. Can benull
-
getLastExecute
public String getLastExecute()
helper Method to get the last SQL Statementperformed inexecute(String, List)
to turn on tracing seeTracingConfiguration.SQL
- Returns:
- the last performed and logged SQL statement by
retrieve(String, List)
. Can benull
-
-