public class NutPojo extends NutStatement implements Pojo
Modifier and Type | Field and Description |
---|---|
protected ArrayList<PItem> |
items
供子类访问的语句元素
|
expert
Constructor and Description |
---|
NutPojo() |
Modifier and Type | Method and Description |
---|---|
Pojo |
addParamsBy(Object obj)
通过普通Java对象为这个 POJO 语句的 SQL 参数赋值
一个 POJO 实际上是一个 SQL 的语句模板,增加一个 Java 对象,实际上就是增加了一组参数 因此如果你想为 POJO 里附加一个集合或者数组对象,对象必须是同样类型的,否则会出现不可预知的错误 |
Pojo |
append(PItem... itemAry)
为POJO语句增加一个或多个语句元素
|
Pojo |
clear()
清除已经存储的对象
|
Pojo |
duplicate()
复制一份自己的实例
|
ValueAdaptor[] |
getAdaptors()
为本语句每一个参数提供一个适配器
|
PItem |
getItem(int index)
获取 POJO 的一个语句元素
|
Object |
getLastParams() |
Object |
getOperatingObject()
一个 Pojo 语句正在操作的对象,就是你通过 Dao 接口传入的对象本身。
|
Object[][] |
getParamMatrix()
用一个矩阵描述语句的参数表。
这个参数矩阵将同 getAdaptors() 的返回组合使用 |
Pojo |
insertFirst(PItem... itemAry)
在 POJO 所有的语句前插入一组语句元素
|
void |
onAfter(Connection conn,
ResultSet rs,
Statement stmt)
语句执行完毕的后续操作
|
void |
onBefore(Connection conn)
语句执行之前的操作
|
List<Object> |
params()
返回语句的参数表。
|
Pojo |
removeItem(int index)
删除 POJO 的一个语句元素
|
Pojo |
setAfter(PojoCallback after)
设置语句执行后的操作
|
Pojo |
setBefore(PojoCallback before)
设置语句执行前的操作
|
Pojo |
setItem(int index,
PItem pi)
置换 POJO 的一个语句元素
|
Pojo |
setOperatingObject(Object obj)
设置一个 POJO 正在操作的对象
|
Pojo |
setPager(Pager pager)
为 POJO 语句设置分页对象
|
NutPojo |
setSqlType(SqlType sqlType) |
String |
toPreparedStatement()
将 Dao 语句转换为 JDBC SQL 缓冲语句
|
String |
toString()
输出打印字符串
|
forceExecQuery, forPrint, getAdapterBy, getBoolean, getContext, getDouble, getDouble, getEntity, getFloat, getFloat, getInt, getInt, getList, getLong, getLong, getNumber, getObject, getResult, getSqlType, getString, getUpdateCount, isAlter, isCall, isCreate, isDelete, isDrop, isExec, isForceExecQuery, isInsert, isOther, isRun, isSelect, isUpdate, param2String, setContext, setEntity, setExpert, toExampleStatement, toStatement
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forceExecQuery, forPrint, getBoolean, getContext, getDouble, getDouble, getEntity, getFloat, getFloat, getInt, getInt, getList, getLong, getLong, getNumber, getObject, getResult, getSqlType, getString, getUpdateCount, isAlter, isCall, isCreate, isDelete, isDrop, isExec, isForceExecQuery, isInsert, isOther, isRun, isSelect, isUpdate, setEntity, setExpert
public ValueAdaptor[] getAdaptors()
DaoStatement
getAdaptors
in interface DaoStatement
public Object[][] getParamMatrix()
DaoStatement
矩阵的每一行相当于执行一条语句
参数表的下标意义为: Object[行][列]
getParamMatrix
in interface DaoStatement
public String toPreparedStatement()
DaoStatement
toPreparedStatement
in interface DaoStatement
public void onBefore(Connection conn) throws SQLException
DaoStatement
这个接口函数你基本不会直接使用的
onBefore
in interface DaoStatement
conn
- 当前执行语句的连接SQLException
public void onAfter(Connection conn, ResultSet rs, Statement stmt) throws SQLException
DaoStatement
这个接口函数你基本不会直接使用的
onAfter
in interface DaoStatement
conn
- 当前执行语句的连接rs
- 当前语句执行的结果集stmt
- TODOSQLException
- 回调函数抛出的异常public Pojo setBefore(PojoCallback before)
Pojo
public Pojo setAfter(PojoCallback after)
Pojo
public Pojo setPager(Pager pager)
Pojo
setPager
in interface DaoStatement
setPager
in interface Pojo
pager
- 分页对象public Pojo addParamsBy(Object obj)
Pojo
接口的实现类会根据你给出的对象类型不同,对你的对象做不同的解释,它考虑的方式为:
注意:
某些 SQL 语句(比如 CREATE|DROP)即使有参数,也是没有意义的,所以 Pojo 执行器会忽略它们
addParamsBy
in interface Pojo
obj
- 普通 Java 对象Pojo.addParamsBy(Object)
public Object getLastParams()
getLastParams
in interface Pojo
public Object getOperatingObject()
Pojo
getOperatingObject
in interface Pojo
public Pojo setOperatingObject(Object obj)
Pojo
setOperatingObject
in interface Pojo
obj
- 正在操作的对象public Pojo append(PItem... itemAry)
Pojo
public Pojo insertFirst(PItem... itemAry)
Pojo
insertFirst
in interface Pojo
itemAry
- 语句元素public Pojo setItem(int index, PItem pi)
Pojo
public Pojo removeItem(int index)
Pojo
removeItem
in interface Pojo
index
- 位置下标public NutPojo setSqlType(SqlType sqlType)
setSqlType
in class NutStatement
public String toString()
DaoStatement
toString
in interface DaoStatement
toString
in class NutStatement
Copyright © 2017. All rights reserved.