com.j256.ormlite.support
Interface DatabaseAccess

All Known Implementing Classes:
JdbcDatabaseAccess

public interface DatabaseAccess

Interface that hides the various calls to a SQL database.

Author:
graywatson

Field Summary
static Object MORE_THAN_ONE
          returned by queryForOne(java.lang.String, java.lang.Object[], int[], com.j256.ormlite.stmt.GenericRowMapper) if more than one result was found by the query
 
Method Summary
 PreparedStmt prepareStatement(String sql)
          Generate a prepared statement from a SQL statement.
 long queryForLong(String statement)
          Perform a query whose result should be a single long-integer value.
<T> Object
queryForOne(String statement, Object[] args, int[] argFieldTypeVals, GenericRowMapper<T> rowMapper)
          Perform a SQL query with the associated SQL statement, arguments, and types and returns a single result.
 int update(String statement, Object[] args, int[] argFieldTypeVals)
          Perform a SQL update with the associated SQL statement, arguments, and types.
 int update(String statement, Object[] args, int[] argFieldTypeVals, GeneratedKeyHolder keyHolder)
          Perform a SQL update while returning generated keys with the associated SQL statement, arguments, and types.
 

Field Detail

MORE_THAN_ONE

static final Object MORE_THAN_ONE
returned by queryForOne(java.lang.String, java.lang.Object[], int[], com.j256.ormlite.stmt.GenericRowMapper) if more than one result was found by the query

Method Detail

update

int update(String statement,
           Object[] args,
           int[] argFieldTypeVals)
           throws SQLException
Perform a SQL update with the associated SQL statement, arguments, and types.

Returns:
The number of rows affected by the update.
Throws:
SQLException

update

int update(String statement,
           Object[] args,
           int[] argFieldTypeVals,
           GeneratedKeyHolder keyHolder)
           throws SQLException
Perform a SQL update while returning generated keys with the associated SQL statement, arguments, and types.

Returns:
The number of rows affected by the update.
Throws:
SQLException

queryForOne

<T> Object queryForOne(String statement,
                       Object[] args,
                       int[] argFieldTypeVals,
                       GenericRowMapper<T> rowMapper)
                   throws SQLException
Perform a SQL query with the associated SQL statement, arguments, and types and returns a single result.

Returns:
The first data item returned by the query which can be cast to , null if none, the object MORE_THAN_ONE if more than one result was found.
Throws:
SQLException

queryForLong

long queryForLong(String statement)
                  throws SQLException
Perform a query whose result should be a single long-integer value.

Throws:
SQLException

prepareStatement

PreparedStmt prepareStatement(String sql)
                              throws SQLException
Generate a prepared statement from a SQL statement.

Throws:
SQLException


Copyright © 2010. All Rights Reserved.