2017-08-28 15:17
@JFinal 好像不行哦!
public class FunctionUtil implements ICallback {
Integer number;
CallableStatement proc = null;
public ResultSet rs = null;
public List result = null;
@Override
public Object call(Connection conn) throws SQLException {
try {
proc = conn.prepareCall("{ SELECT * FROM t_areainfo WHERE FIND_IN_SET(id,queryChildrenAreaInfo(?)) }");
//设置参数值
proc.setInt(1, number);
//加载
rs = proc.executeQuery();
result = (List) rs;
} catch (Exception e) {
e.printStackTrace();
} finally {
//执行
DbKit.getConfig().close(proc, conn);
}
return result;
}
public void CallFunction(Integer number) {
FunctionUtil functionUtil = new FunctionUtil();
functionUtil.number = number;
Db.execute(functionUtil);
}
}
SELECT * FROM t_areainfo WHERE FIND_IN_SET(id,queryChildrenAreaInfo(?))
这个是我在百度找的MySQL函数递归,而不是存储过程的递归!存储过程我知道怎么调用,但是函数这样调用应该行不通吧!存储过程使用 call Test这样的, 但是函数就不一样了!小弟不太明白啊!
2017-08-21 11:35
@JFinal
DruidPlugin mysqlData1 = createDruidPlugin();
me.add(mysqlData1);
//第一个数据库
ActiveRecordPlugin mysql1 = new ActiveRecordPlugin("mysql1",mysqlData1);
mysql1.setCache(new EhCache());
mysql1.addMapping("blog", TestDao.class);
me.add(mysql1);
DruidPlugin mysqlData2 = createDruidPlugin();
me.add(mysql1);
//第二个数据库
ActiveRecordPlugin mysql2 = new ActiveRecordPlugin("mysql2", mysqlData2);
mysql2.setCache(new EhCache());
mysql2.addMapping("aut_shop", HelloWorldDao.class);
me.add(mysql2);
jdbcUrlmysql1 =
usermysql1 =
passwordmysql1 =
jdbcUrlmysql2 =
usermysql2 =
passwordmysql2 =
获取ConfigName是不是mysql1或者mysql2这样区分?