Package de.suse.lib.sqlmap
Class SQLMapper
- java.lang.Object
-
- de.suse.lib.sqlmap.SQLMapper
-
public class SQLMapper extends java.lang.ObjectSQL Mapper
-
-
Constructor Summary
Constructors Constructor Description SQLMapper(java.io.File configFile)SQLMapper(java.lang.String jndiName)Create an SQL Mapper on top of JNDI connection.SQLMapper(java.sql.Connection connection)Create an SQL Mapper out of the already opened connection.SQLMapper(java.util.Properties config)Create an SQL Mapper from the properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.ResultSetcall(java.lang.String querypath, java.util.Map<?,?> params)Call SQL query.voidclose()Close connection to the database.voidclose(java.sql.ResultSet result)Close connection to the database and result.SQLMapperconnect(java.lang.String tag)Connect to the database using a tag.voidsetDebug(boolean debug)SQLMappersetInitCallback(ConnectionCallback callback)SQLMappersetResourceClass(java.lang.Class cls)Set resources class.voidsetStderrVerbose(boolean stderrVerbose)Set STDERR verbose.
-
-
-
Constructor Detail
-
SQLMapper
public SQLMapper(java.util.Properties config) throws java.sql.SQLExceptionCreate an SQL Mapper from the properties.- Parameters:
config-- Throws:
java.sql.SQLException
-
SQLMapper
public SQLMapper(java.sql.Connection connection) throws java.sql.SQLExceptionCreate an SQL Mapper out of the already opened connection.- Parameters:
connection-- Throws:
java.sql.SQLException
-
SQLMapper
public SQLMapper(java.lang.String jndiName) throws java.sql.SQLException, javax.naming.NamingExceptionCreate an SQL Mapper on top of JNDI connection.- Parameters:
jndiName-- Throws:
java.sql.SQLExceptionjavax.naming.NamingException
-
SQLMapper
public SQLMapper(java.io.File configFile) throws java.io.FileNotFoundException, java.io.IOException, java.sql.SQLException- Throws:
java.io.FileNotFoundExceptionjava.io.IOExceptionjava.sql.SQLException
-
-
Method Detail
-
setStderrVerbose
public void setStderrVerbose(boolean stderrVerbose)
Set STDERR verbose.- Parameters:
stderrVerbose-
-
setDebug
public void setDebug(boolean debug)
-
connect
public SQLMapper connect(java.lang.String tag) throws java.net.URISyntaxException, java.lang.ClassNotFoundException, java.lang.Exception
Connect to the database using a tag.- Parameters:
tag-- Throws:
java.net.URISyntaxExceptionjava.lang.ClassNotFoundExceptionjava.lang.Exception
-
call
public java.sql.ResultSet call(java.lang.String querypath, java.util.Map<?,?> params) throws java.sql.SQLIntegrityConstraintViolationException, java.sql.SQLException, java.lang.ExceptionCall SQL query. ResultSet will be set to null in case it is not a SELECT statement.- Parameters:
querypath-params-- Returns:
- Throws:
java.sql.SQLIntegrityConstraintViolationExceptionjava.sql.SQLExceptionjava.lang.Exception
-
close
public void close(java.sql.ResultSet result)
Close connection to the database and result.
-
close
public void close()
Close connection to the database.
-
setResourceClass
public SQLMapper setResourceClass(java.lang.Class cls)
Set resources class.- Parameters:
cls-- Returns:
-
setInitCallback
public SQLMapper setInitCallback(ConnectionCallback callback)
-
-