public abstract class NutStatement extends Object implements DaoStatement
Modifier and Type | Field and Description |
---|---|
protected JdbcExpert |
expert |
Constructor and Description |
---|
NutStatement() |
Modifier and Type | Method and Description |
---|---|
void |
forceExecQuery()
如果sql的类型无法被nutz识别,而这个sql有的确是个查询,那么调用这个方法, 这样就强制nutz按select的方式执行
|
String |
forPrint() |
protected ValueAdaptor |
getAdapterBy(Object value) |
boolean |
getBoolean()
无结果的话,会抛NPE
|
SqlContext |
getContext()
获取 SQL 执行的上下文对象,以便做更多的操作
|
double |
getDouble() |
double |
getDouble(double defaultValue) |
Entity<?> |
getEntity() |
float |
getFloat() |
float |
getFloat(float defaultValue) |
int |
getInt()
无结果的话,会抛NPE,可以考虑用getInt(defaultValue)
|
int |
getInt(int defaultValue) |
<T> List<T> |
getList(Class<T> classOfT)
一个 getResult() 函数的变种,将当前对象的 Result 转换成 List
如果 Result 本身就是一个列表,如果第一个元素的类型和参数相符,则直接返回, 否则会被用 Castors 智能转换 如果不是列表,则会强制用 ArrayList 包裹 |
long |
getLong() |
long |
getLong(long defaultValue) |
Number |
getNumber() |
<T> T |
getObject(Class<T> classOfT)
转换结果对象到你想要的类型
|
Object |
getResult()
你可以通过 setCallback 函数为本语句设置一个回调。
|
SqlType |
getSqlType() |
String |
getString() |
int |
getUpdateCount() |
boolean |
isAlter() |
boolean |
isCall() |
boolean |
isCreate() |
boolean |
isDelete() |
boolean |
isDrop() |
boolean |
isExec() |
boolean |
isForceExecQuery() |
boolean |
isInsert() |
boolean |
isOther() |
boolean |
isRun() |
boolean |
isSelect() |
boolean |
isUpdate() |
protected String |
param2String(Object obj) |
void |
setContext(SqlContext context) |
DaoStatement |
setEntity(Entity<?> entity)
设置 当前语句对应的实体
|
void |
setExpert(JdbcExpert expert) |
DaoStatement |
setSqlType(SqlType sqlType) |
protected String |
toExampleStatement(Object[][] mtrx,
String sql) |
protected String |
toStatement(Object[][] mtrx,
String sql) |
String |
toString()
输出打印字符串
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAdaptors, getParamMatrix, onAfter, onBefore, setPager, toPreparedStatement
protected JdbcExpert expert
public boolean isSelect()
isSelect
in interface DaoStatement
public boolean isUpdate()
isUpdate
in interface DaoStatement
public boolean isDelete()
isDelete
in interface DaoStatement
public boolean isInsert()
isInsert
in interface DaoStatement
public boolean isCreate()
isCreate
in interface DaoStatement
public boolean isDrop()
isDrop
in interface DaoStatement
public boolean isRun()
isRun
in interface DaoStatement
public boolean isAlter()
isAlter
in interface DaoStatement
public boolean isExec()
isExec
in interface DaoStatement
public boolean isCall()
isCall
in interface DaoStatement
public boolean isOther()
isOther
in interface DaoStatement
public Entity<?> getEntity()
getEntity
in interface DaoStatement
public DaoStatement setEntity(Entity<?> entity)
DaoStatement
setEntity
in interface DaoStatement
entity
- 实体public SqlContext getContext()
DaoStatement
getContext
in interface DaoStatement
public void setContext(SqlContext context)
public SqlType getSqlType()
getSqlType
in interface DaoStatement
public DaoStatement setSqlType(SqlType sqlType)
public Object getResult()
DaoStatement
在回调中,你可以返回一个对象。这个对象会存储在本语句中。
当本语句 执行完毕,你可以通过这个函数获得回调函数生成的返回。
一般的情况,回调函数是用来从 ResultSet 生成对象的。
即,如果 本语句不是 SELECT XXXX, 一般不会被设置回调
getResult
in interface DaoStatement
SqlCallback
public <T> List<T> getList(Class<T> classOfT)
DaoStatement
getList
in interface DaoStatement
T
- 列表容器內的元素类型classOfT
- 列表容器內的元素类型public <T> T getObject(Class<T> classOfT)
DaoStatement
getObject
in interface DaoStatement
T
- 对象类型classOfT
- 对象类型public int getInt()
DaoStatement
getInt
in interface DaoStatement
public int getInt(int defaultValue)
getInt
in interface DaoStatement
public long getLong()
getLong
in interface DaoStatement
public long getLong(long defaultValue)
getLong
in interface DaoStatement
public double getDouble()
getDouble
in interface DaoStatement
public double getDouble(double defaultValue)
getDouble
in interface DaoStatement
public float getFloat()
getFloat
in interface DaoStatement
public float getFloat(float defaultValue)
getFloat
in interface DaoStatement
public Number getNumber()
getNumber
in interface DaoStatement
public String getString()
getString
in interface DaoStatement
public boolean getBoolean()
DaoStatement
getBoolean
in interface DaoStatement
public int getUpdateCount()
getUpdateCount
in interface DaoStatement
SqlType
public String forPrint()
forPrint
in interface DaoStatement
public void forceExecQuery()
DaoStatement
forceExecQuery
in interface DaoStatement
public boolean isForceExecQuery()
isForceExecQuery
in interface DaoStatement
public String toString()
DaoStatement
toString
in interface DaoStatement
toString
in class Object
public void setExpert(JdbcExpert expert)
setExpert
in interface DaoStatement
protected ValueAdaptor getAdapterBy(Object value)
Copyright © 2017. All rights reserved.