Package org.nutz.dao.impl.sql.callback

Source Code of org.nutz.dao.impl.sql.callback.QueryIntCallback

package org.nutz.dao.impl.sql.callback;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.nutz.dao.sql.Sql;
import org.nutz.dao.sql.SqlCallback;
import org.nutz.lang.util.LinkedIntArray;

/**
* 这个回调将返回一个 Int 数组
*
* @author zozoh(zozohtnt@gmail.com)
*/
public class QueryIntCallback implements SqlCallback {

  public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
    LinkedIntArray ary = new LinkedIntArray(20);
    while (rs.next())
      ary.push(rs.getInt(1));
    return ary.toArray();
  }

}
TOP

Related Classes of org.nutz.dao.impl.sql.callback.QueryIntCallback

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.