AndBase开发框架  1.6
 全部  命名空间 文件 函数 变量 枚举值 
Public 成员函数 | Private 成员函数 | Private 属性 | 静态 Private 属性 | 所有成员列表
com.ab.db.orm.dao.AbDBDaoImpl< T >类 参考
类 com.ab.db.orm.dao.AbDBDaoImpl< T > 继承关系图:
com.ab.db.AbBasicDBDao com.ab.db.orm.dao.AbDBDao< T >

Public 成员函数

 AbDBDaoImpl (SQLiteOpenHelper dbHelper, Class< T > clazz)
 
 AbDBDaoImpl (SQLiteOpenHelper dbHelper)
 
SQLiteOpenHelper getDbHelper ()
 
queryOne (int id)
 
List< T > rawQuery (String sql, String[] selectionArgs, Class< T > clazz)
 
boolean isExist (String sql, String[] selectionArgs)
 
List< T > queryList ()
 
List< T > queryList (String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)
 
List< T > queryList (String selection, String[] selectionArgs)
 
long insert (T entity)
 
long insert (T entity, boolean flag)
 
long[] insertList (List< T > entityList)
 
long[] insertList (List< T > entityList, boolean flag)
 
int delete (int id)
 
int delete (Integer...ids)
 
int delete (String whereClause, String[] whereArgs)
 
int deleteAll ()
 
int update (T entity)
 
int updateList (List< T > entityList)
 
List< Map< String, String > > queryMapList (String sql, String[] selectionArgs)
 
int queryCount (String sql, String[] selectionArgs)
 
void execSql (String sql, Object[] selectionArgs)
 
void startWritableDatabase (boolean transaction)
 
void startReadableDatabase ()
 
void closeDatabase ()
 
- Public 成员函数 继承自 com.ab.db.AbBasicDBDao
String getStringColumnValue (String columnName, Cursor cursor)
 
int getIntColumnValue (String columnName, Cursor cursor)
 
void closeDatabase (Cursor cursor, SQLiteDatabase db)
 
void closeCursor (Cursor cursor)
 

Private 成员函数

void getListFromCursor (Class<?> clazz, List< T > list, Cursor cursor) throws IllegalAccessException, InstantiationException
 
String setContentValues (T entity, ContentValues cv, int type, int method) throws IllegalAccessException
 
String getLogSql (String sql, Object[] args)
 
void checkDBOpened ()
 

Private 属性

SQLiteOpenHelper dbHelper
 
final ReentrantLock lock = new ReentrantLock()
 
String tableName
 
String idColumn
 
Class< T > clazz
 
List< Field > allFields
 
SQLiteDatabase db = null
 

静态 Private 属性

static final int METHOD_INSERT = 0
 
static final int METHOD_UPDATE = 1
 
static final int TYPE_NOT_INCREMENT = 0
 
static final int TYPE_INCREMENT = 1
 

详细描述

© 2012 amsoft.cn 名称:AbDBDaoImpl.java 描述:数据库表操作类接口实现类

作者
还如一梦中
版本
v1.0
参数
<T>the generic type
日期
:2013-7-23 上午9:47:10

构造及析构函数说明

com.ab.db.orm.dao.AbDBDaoImpl< T >.AbDBDaoImpl ( SQLiteOpenHelper  dbHelper,
Class< T >  clazz 
)
inline

用一个对象实体初始化这个数据库操作实现类.

参数
dbHelper数据库操作实现类
clazz映射对象实体
com.ab.db.orm.dao.AbDBDaoImpl< T >.AbDBDaoImpl ( SQLiteOpenHelper  dbHelper)
inline

初始化这个数据库操作实现类.

参数
dbHelper数据库操作实现类

成员函数说明

void com.ab.db.orm.dao.AbDBDaoImpl< T >.checkDBOpened ( )
inlineprivate

描述:检查DB是否已经打开.

void com.ab.db.orm.dao.AbDBDaoImpl< T >.closeDatabase ( )
inline

描述:关闭数据库,数据操作后必须调用.

int com.ab.db.orm.dao.AbDBDaoImpl< T >.delete ( int  id)
inline

描述:按id删除.

参数
idthe id
返回
the int
参见
com.ab.db.orm.dao.AbDBDao::delete(int)

实现了 com.ab.db.orm.dao.AbDBDao< T >.

int com.ab.db.orm.dao.AbDBDaoImpl< T >.delete ( Integer...  ids)
inline

描述:按id删除.

参数
idsthe ids
返回
the int
参见
com.ab.db.orm.dao.AbDBDao::delete(java.lang.Integer[])

实现了 com.ab.db.orm.dao.AbDBDao< T >.

int com.ab.db.orm.dao.AbDBDaoImpl< T >.delete ( String  whereClause,
String[]  whereArgs 
)
inline

描述:按条件删除数据.

参数
whereClausethe where clause
whereArgsthe where args
返回
the int
参见
com.ab.db.orm.dao.AbDBDao::delete(java.lang.String, java.lang.String[])

实现了 com.ab.db.orm.dao.AbDBDao< T >.

int com.ab.db.orm.dao.AbDBDaoImpl< T >.deleteAll ( )
inline

描述:清空数据.

返回
the int 影响的行
参见
com.ab.db.orm.dao.AbDBDao::deleteAll()

实现了 com.ab.db.orm.dao.AbDBDao< T >.

void com.ab.db.orm.dao.AbDBDaoImpl< T >.execSql ( String  sql,
Object[]  selectionArgs 
)
inline

描述:执行特定的sql.

参数
sqlthe sql
selectionArgsthe selection args
参见
com.ab.db.orm.dao.AbDBDao::execSql(java.lang.String, java.lang.Object[])

实现了 com.ab.db.orm.dao.AbDBDao< T >.

SQLiteOpenHelper com.ab.db.orm.dao.AbDBDaoImpl< T >.getDbHelper ( )
inline

描述:TODO.

返回
the db helper
参见
com.ab.db.orm.dao.AbDBDao::getDbHelper()

实现了 com.ab.db.orm.dao.AbDBDao< T >.

void com.ab.db.orm.dao.AbDBDaoImpl< T >.getListFromCursor ( Class<?>  clazz,
List< T >  list,
Cursor  cursor 
) throws IllegalAccessException, InstantiationException
inlineprivate

从游标中获得映射对象列表.

参数
clazzthe clazz
list返回的映射对象列表
cursor当前游标
返回
the list from cursor
异常
IllegalAccessExceptionthe illegal access exception
InstantiationExceptionthe instantiation exception
String com.ab.db.orm.dao.AbDBDaoImpl< T >.getLogSql ( String  sql,
Object[]  args 
)
inlineprivate

打印当前sql语句.

参数
sqlsql语句,带?
args绑定变量
返回
完整的sql
long com.ab.db.orm.dao.AbDBDaoImpl< T >.insert ( entity)
inline

描述:插入实体.

参数
entitythe entity
返回
the long
参见
com.ab.db.orm.dao.AbDBDao::insert(java.lang.Object)

实现了 com.ab.db.orm.dao.AbDBDao< T >.

long com.ab.db.orm.dao.AbDBDaoImpl< T >.insert ( entity,
boolean  flag 
)
inline

描述:插入实体.

参数
entitythe entity
flagthe flag
返回
the long
参见
com.ab.db.orm.dao.AbDBDao::insert(java.lang.Object, boolean)

实现了 com.ab.db.orm.dao.AbDBDao< T >.

long [] com.ab.db.orm.dao.AbDBDaoImpl< T >.insertList ( List< T >  entityList)
inline

描述:插入列表.

参数
entityListthe entity list
返回
the long[] 插入成功的数据ID
参见
com.ab.db.orm.dao.AbDBDao::insertList(java.util.List)

实现了 com.ab.db.orm.dao.AbDBDao< T >.

long [] com.ab.db.orm.dao.AbDBDaoImpl< T >.insertList ( List< T >  entityList,
boolean  flag 
)
inline

描述:插入列表.

参数
entityListthe entity list
flagthe flag
返回
the long[] 插入成功的数据ID
参见
com.ab.db.orm.dao.AbDBDao::insertList(java.util.List, boolean)

实现了 com.ab.db.orm.dao.AbDBDao< T >.

boolean com.ab.db.orm.dao.AbDBDaoImpl< T >.isExist ( String  sql,
String[]  selectionArgs 
)
inline

描述:是否存在.

参数
sqlthe sql
selectionArgsthe selection args
返回
true, if is exist
参见
com.ab.db.orm.dao.AbDBDao::isExist(java.lang.String, java.lang.String[])

实现了 com.ab.db.orm.dao.AbDBDao< T >.

int com.ab.db.orm.dao.AbDBDaoImpl< T >.queryCount ( String  sql,
String[]  selectionArgs 
)
inline

描述:查询数量.

参数
sqlthe sql
selectionArgsthe selection args
返回
the int
参见
com.ab.db.orm.dao.AbDBDao::queryCount(java.lang.String, java.lang.String[])

实现了 com.ab.db.orm.dao.AbDBDao< T >.

List<T> com.ab.db.orm.dao.AbDBDaoImpl< T >.queryList ( )
inline

描述:查询所有数据.

返回
the list
参见
com.ab.db.orm.dao.AbDBDao::queryList()

实现了 com.ab.db.orm.dao.AbDBDao< T >.

List<T> com.ab.db.orm.dao.AbDBDaoImpl< T >.queryList ( String[]  columns,
String  selection,
String[]  selectionArgs,
String  groupBy,
String  having,
String  orderBy,
String  limit 
)
inline

描述:查询列表.

参数
columnsthe columns
selectionthe selection
selectionArgsthe selection args
groupBythe group by
havingthe having
orderBythe order by
limitthe limit
返回
the list
参见
com.ab.db.orm.dao.AbDBDao::queryList(java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String)

实现了 com.ab.db.orm.dao.AbDBDao< T >.

List<T> com.ab.db.orm.dao.AbDBDaoImpl< T >.queryList ( String  selection,
String[]  selectionArgs 
)
inline

描述:简单一些的查询.

参数
selectionthe selection
selectionArgsthe selection args
返回
the list
参见
com.ab.db.orm.dao.AbDBDao::queryList(java.lang.String, java.lang.String[])
作者
: amsoft.cn

实现了 com.ab.db.orm.dao.AbDBDao< T >.

List<Map<String, String> > com.ab.db.orm.dao.AbDBDaoImpl< T >.queryMapList ( String  sql,
String[]  selectionArgs 
)
inline

描述:查询为map列表.

参数
sqlthe sql
selectionArgsthe selection args
返回
the list
参见
com.ab.db.orm.dao.AbDBDao::queryMapList(java.lang.String, java.lang.String[])

实现了 com.ab.db.orm.dao.AbDBDao< T >.

T com.ab.db.orm.dao.AbDBDaoImpl< T >.queryOne ( int  id)
inline

描述:查询一条.

参数
idthe id
返回
the t
参见
com.ab.db.orm.dao.AbDBDao::queryOne(int)

实现了 com.ab.db.orm.dao.AbDBDao< T >.

List<T> com.ab.db.orm.dao.AbDBDaoImpl< T >.rawQuery ( String  sql,
String[]  selectionArgs,
Class< T >  clazz 
)
inline

描述:一种更灵活的方式查询,不支持对象关联,可以写完整的sql.

参数
sql完整的sql如:select * from a ,b where a.id=b.id and a.id = ?
selectionArgs绑定变量值
clazz返回的对象类型
返回
the list
参见
com.ab.db.orm.dao.AbDBDao::rawQuery(java.lang.String, java.lang.String[])

实现了 com.ab.db.orm.dao.AbDBDao< T >.

String com.ab.db.orm.dao.AbDBDaoImpl< T >.setContentValues ( entity,
ContentValues  cv,
int  type,
int  method 
) throws IllegalAccessException
inlineprivate

设置这个ContentValues.

参数
entity映射实体
cvthe cv
typeid类的类型,是否自增
method预执行的操作
返回
sql的字符串
异常
IllegalAccessExceptionthe illegal access exception
void com.ab.db.orm.dao.AbDBDaoImpl< T >.startReadableDatabase ( )
inline

描述:获取读数据库,数据操作前必须调用.

void com.ab.db.orm.dao.AbDBDaoImpl< T >.startWritableDatabase ( boolean  transaction)
inline

描述:获取写数据库,数据操作前必须调用.

参数
transaction是否开启事务
int com.ab.db.orm.dao.AbDBDaoImpl< T >.update ( entity)
inline

描述:更新实体.

参数
entitythe entity
返回
the int 影响的行
参见
com.ab.db.orm.dao.AbDBDao::update(java.lang.Object)

实现了 com.ab.db.orm.dao.AbDBDao< T >.

int com.ab.db.orm.dao.AbDBDaoImpl< T >.updateList ( List< T >  entityList)
inline

描述:更新列表.

参数
entityListthe entity list
返回
the int 影响的行
参见
com.ab.db.orm.dao.AbDBDao::updateList(java.util.List)

实现了 com.ab.db.orm.dao.AbDBDao< T >.

类成员变量说明

List<Field> com.ab.db.orm.dao.AbDBDaoImpl< T >.allFields
private

The all fields.

Class<T> com.ab.db.orm.dao.AbDBDaoImpl< T >.clazz
private

The clazz.

SQLiteDatabase com.ab.db.orm.dao.AbDBDaoImpl< T >.db = null
private

这个Dao的数据库对象.

SQLiteOpenHelper com.ab.db.orm.dao.AbDBDaoImpl< T >.dbHelper
private

The db helper.

String com.ab.db.orm.dao.AbDBDaoImpl< T >.idColumn
private

The id column.

final ReentrantLock com.ab.db.orm.dao.AbDBDaoImpl< T >.lock = new ReentrantLock()
private

锁对象.

final int com.ab.db.orm.dao.AbDBDaoImpl< T >.METHOD_INSERT = 0
staticprivate

The Constant METHOD_INSERT.

final int com.ab.db.orm.dao.AbDBDaoImpl< T >.METHOD_UPDATE = 1
staticprivate

The Constant METHOD_UPDATE.

String com.ab.db.orm.dao.AbDBDaoImpl< T >.tableName
private

The table name.

final int com.ab.db.orm.dao.AbDBDaoImpl< T >.TYPE_INCREMENT = 1
staticprivate

The Constant TYPE_INCREMENT.

final int com.ab.db.orm.dao.AbDBDaoImpl< T >.TYPE_NOT_INCREMENT = 0
staticprivate

The Constant TYPE_NOT_INCREMENT.


该类的文档由以下文件生成: