Produced by Siminov Software Solution LLP

siminov.orm.database.sqlite
Class Database

java.lang.Object
  extended by siminov.orm.database.sqlite.Database
All Implemented Interfaces:
IDatabase

public class Database
extends java.lang.Object
implements IDatabase

Provides IDatabase implementation for SQLite database.


Constructor Summary
Database()
           
 
Method Summary
 void close(DatabaseDescriptor databaseDescriptor)
          Close the existing opened database through Database Descriptor.
 void executeBindQuery(DatabaseDescriptor databaseDescriptor, DatabaseMappingDescriptor databaseMappingDescriptor, java.lang.String query, java.util.Iterator<java.lang.Object> columnValues)
          A pre-compiled statement that can be reused.
 java.util.Iterator<java.util.Map<java.lang.String,java.lang.Object>> executeFetchQuery(DatabaseDescriptor databaseDescriptor, DatabaseMappingDescriptor databaseMappingDescriptor, java.lang.String query)
          Query the given table, returning a Cursor over the result set.
 void executeMethod(java.lang.String methodName, java.lang.Object parameter)
          Executes the method on database object.
 void executeQuery(DatabaseDescriptor databaseDescriptor, DatabaseMappingDescriptor databaseMappingDescriptor, java.lang.String query)
          Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.
 void openOrCreate(DatabaseDescriptor databaseDescriptor)
          Open/Create the database through Database Descriptor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Database

public Database()
Method Detail

openOrCreate

public void openOrCreate(DatabaseDescriptor databaseDescriptor)
                  throws DatabaseException
Description copied from interface: IDatabase
Open/Create the database through Database Descriptor.

By default add CREATE_IF_NECESSARY flag so that if database does not exist it will create.

Specified by:
openOrCreate in interface IDatabase
Throws:
DatabaseException - If the database cannot be opened or create.

close

public void close(DatabaseDescriptor databaseDescriptor)
           throws DatabaseException
Description copied from interface: IDatabase
Close the existing opened database through Database Descriptor.

Specified by:
close in interface IDatabase
Throws:
DatabaseException - If the database cannot be closed.

executeQuery

public void executeQuery(DatabaseDescriptor databaseDescriptor,
                         DatabaseMappingDescriptor databaseMappingDescriptor,
                         java.lang.String query)
                  throws DatabaseException
Description copied from interface: IDatabase
Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.

It has no means to return any data (such as the number of affected rows). Instead, you're encouraged to use insert, update, delete, when possible.

Specified by:
executeQuery in interface IDatabase
databaseMappingDescriptor - Database-Mapping-Descriptor object which defines the structure of table.
query - Query which needs to be executed.
Throws:
DatabaseException - If any error occur while executing query provided.

executeBindQuery

public void executeBindQuery(DatabaseDescriptor databaseDescriptor,
                             DatabaseMappingDescriptor databaseMappingDescriptor,
                             java.lang.String query,
                             java.util.Iterator<java.lang.Object> columnValues)
                      throws DatabaseException
Description copied from interface: IDatabase
A pre-compiled statement that can be reused. The statement cannot return multiple rows, but 1x1 result sets are allowed.

Specified by:
executeBindQuery in interface IDatabase
databaseMappingDescriptor - Database-Mapping-Descriptor object which defines the structure of table.
query - A pre-compiled statement.
columnValues - Column values
Throws:
DatabaseException - If any error occur while inserting or updating tuple.

executeFetchQuery

public java.util.Iterator<java.util.Map<java.lang.String,java.lang.Object>> executeFetchQuery(DatabaseDescriptor databaseDescriptor,
                                                                                              DatabaseMappingDescriptor databaseMappingDescriptor,
                                                                                              java.lang.String query)
                                                                                       throws DatabaseException
Description copied from interface: IDatabase
Query the given table, returning a Cursor over the result set.

Specified by:
executeFetchQuery in interface IDatabase
databaseMappingDescriptor - Database-Mapping-Descriptor object which defines the structure of table.
query - Query based on which tuples will be fetched from database.
Returns:
A Cursor object, which is positioned before the first entry. Note that Cursors are not synchronized, see the documentation for more details.
Throws:
DatabaseException - If any error occur while getting tuples from a single table.

executeMethod

public void executeMethod(java.lang.String methodName,
                          java.lang.Object parameter)
                   throws DatabaseException
Description copied from interface: IDatabase
Executes the method on database object.

Specified by:
executeMethod in interface IDatabase
Parameters:
methodName - Name Of Database Method.
parameter - Parameters Needed By Database Method.
Throws:
DatabaseException - If any exeception occur which invoking method in database object.

Apache License 2.0

Copyright 2013