Interface ISqliteRepository
-
- All Known Implementing Classes:
SqliteRepository
public interface ISqliteRepositoryCreated by mrprintedwall on 11/02/17.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidalterTable(String sql)Method that handles alter tablevoidcreateTable(String sql)Method that handles create tableintdelete(String sql, Map<Integer,Object> parameters)Delete rows in SQLite and return the number of affected rowsvoiddropTable(String sql)Method that handles drop tableConnectiongetConnection()This method initialize the SQLite connection and driver checkConnectiongetConnection(boolean pragmaFk)This method initialize the SQLite connection and driver check<T> List<T>getList(String sql, ISqliteObjectAssembler sqliteObjectAssembler)Query a list items using sql.<T> List<T>getList(String sql, Map<Integer,Object> parameters, ISqliteObjectAssembler sqliteObjectAssembler)Query a list items using sql and map of parameters.<T> TgetSingle(String sql, ISqliteObjectAssembler sqliteObjectAssembler)Query a single item using sql.<T> TgetSingle(String sql, Map<Integer,Object> parameters, ISqliteObjectAssembler sqliteObjectAssembler)Query a single item using sql and map of parameters.intinsert(String sql, Map<Integer,Object> parameters)Insert into SQLite and return the generated primary ID.intupdate(String sql, Map<Integer,Object> parameters)Update rows in SQLite and return the number of affected rows
-
-
-
Method Detail
-
getConnection
Connection getConnection() throws SQLException, SqliteDriverNotFoundException
This method initialize the SQLite connection and driver check- Returns:
- Throws:
SQLExceptionSqliteDriverNotFoundException
-
getConnection
Connection getConnection(boolean pragmaFk) throws SQLException, SqliteDriverNotFoundException
This method initialize the SQLite connection and driver check- Parameters:
pragmaFk-- Returns:
- Throws:
SQLExceptionSqliteDriverNotFoundException
-
insert
int insert(String sql, Map<Integer,Object> parameters) throws SQLException, SqliteDriverNotFoundException
Insert into SQLite and return the generated primary ID. Method will return -1 if an error occurs during execution- Parameters:
sql-parameters-- Returns:
- Throws:
SQLExceptionSqliteDriverNotFoundException
-
update
int update(String sql, Map<Integer,Object> parameters) throws SQLException, SqliteDriverNotFoundException
Update rows in SQLite and return the number of affected rows- Parameters:
sql-parameters-- Returns:
- Throws:
SQLExceptionSqliteDriverNotFoundException
-
delete
int delete(String sql, Map<Integer,Object> parameters) throws SQLException, SqliteDriverNotFoundException
Delete rows in SQLite and return the number of affected rows- Parameters:
sql-parameters-- Returns:
- Throws:
SQLExceptionSqliteDriverNotFoundException
-
getSingle
<T> T getSingle(String sql, ISqliteObjectAssembler sqliteObjectAssembler) throws SQLException, SqliteDriverNotFoundException
Query a single item using sql. Convert resultset to POJO via dependency injection- Parameters:
sql-sqliteObjectAssembler-- Returns:
- Throws:
SQLExceptionSqliteDriverNotFoundException
-
getSingle
<T> T getSingle(String sql, Map<Integer,Object> parameters, ISqliteObjectAssembler sqliteObjectAssembler) throws SQLException, SqliteDriverNotFoundException
Query a single item using sql and map of parameters. Convert resultset to POJO via dependency injection- Parameters:
sql-parameters-sqliteObjectAssembler-- Returns:
- Throws:
SQLExceptionSqliteDriverNotFoundException
-
getList
<T> List<T> getList(String sql, ISqliteObjectAssembler sqliteObjectAssembler) throws SQLException, SqliteDriverNotFoundException
Query a list items using sql. Convert resultset to POJO via dependency injection- Type Parameters:
T-- Parameters:
sql-sqliteObjectAssembler-- Returns:
- Throws:
SQLExceptionSqliteDriverNotFoundException
-
getList
<T> List<T> getList(String sql, Map<Integer,Object> parameters, ISqliteObjectAssembler sqliteObjectAssembler) throws SQLException, SqliteDriverNotFoundException
Query a list items using sql and map of parameters. Convert resultset to POJO via dependency injection- Parameters:
sql-parameters-sqliteObjectAssembler-- Returns:
- Throws:
SQLExceptionSqliteDriverNotFoundException
-
createTable
void createTable(String sql) throws SQLException, SqliteDriverNotFoundException
Method that handles create table- Parameters:
sql-- Throws:
SQLExceptionSqliteDriverNotFoundException
-
alterTable
void alterTable(String sql) throws SQLException, SqliteDriverNotFoundException
Method that handles alter table- Parameters:
sql-- Throws:
SQLExceptionSqliteDriverNotFoundException
-
dropTable
void dropTable(String sql) throws SQLException, SqliteDriverNotFoundException
Method that handles drop table- Parameters:
sql-- Throws:
SQLExceptionSqliteDriverNotFoundException
-
-