--Object[] 实现类ArrayHandler:返回结果集的第一行数据,并用Object[]接收 //查询单行数据 public static void testArrayHandler() throws SQLException { QueryRunner runner=new QueryRunner(DataSourceUtil.getDataSourceWithC3P0ByXml());//自动提交事务 Object[] student = runner.query("select * from student where sno>?", new ArrayHandler(), 1); System.out.println(student[0]+","+student[1]+","+student[2]+","+student[3]); } 实现类ArrayListHandler:返回结果的多行数据,List
//反射会通过无参构造来创建对象 --Map
MapHandler:返回结果集的第一行数据 Map {id=1,name=zs} //查询单行数据 map public static void testMapHandler() throws SQLException { QueryRunner runner=new QueryRunner(DataSourceUtil.getDataSourceWithC3P0ByXml());//自动提交事务 Map student = runner.query("select * from student where sno>?", new MapHandler(), 1); System.out.println(student); } MapListHandler:返回结果集的多行数据 List
KeyedHandlder Map> {ls={id=2,name=ls},ww={id=3,name=ww}} //查询多行数据 keyed public static void testKeyedHandler() throws SQLException { QueryRunner runner=new QueryRunner(DataSourceUtil.getDataSourceWithC3P0ByXml());//自动提交事务 Map> students = runner.query("select * from student where sno>?", new KeyedHandler("sname"), 1); System.out.println(students); } ColumnListHandler:把结果集的某一列保存到List中 2,ls 3,ww //查询多行数据中的某一列 list public static void testColumnListHandler() throws SQLException { QueryRunner runner=new QueryRunner(DataSourceUtil.getDataSourceWithC3P0ByXml());//自动提交事务 List students = runner.query("select * from student where sno>?", new ColumnListHandler("sname") ,1); System.out.println(students); }
--> select count(1) from xxx; select name from student where id =2; ScalarHandler:单值结果 //查询单值数据 public static void testScalarHandler() throws SQLException { QueryRunner runner=new QueryRunner(DataSourceUtil.getDataSourceWithC3P0ByXml());//自动提交事务 BigDecimal result = runner.query("select count(1) from student where sno>?", new ScalarHandler(),1); System.out.println(result); String name= runner.query("select sname from student where sno=?", new ScalarHandler(),1); System.out.println(name); }
系统中统计数据,由于调用统计过程,执行时间超过了weblogic设置的时间,提示如下错误:
统计数据出错!
原因:The transaction is no longer active - status: 'Rolling Back. [Reason=weblogic.transaction.internal
Totally five patchs committed to erlang otp, just small patchs.
IMO, erlang really is a interesting programming language, I really like its concurrency feature.
but the functional programming style
两个步骤:
1.用w命令找到要踢出的用户,比如下面:
[root@localhost ~]# w
18:16:55 up 39 days, 8:27, 3 users, load average: 0.03, 0.03, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
package edu.xidian.graph;
class MyStack {
private final int SIZE = 20;
private int[] st;
private int top;
public MyStack() {
st = new int[SIZE];
top = -1;
}
public void push(i