Jfinal object to record principle "doubt"

Source: Internet
Author: User

  /*dbpro.class*/public transient Record findFirst (String sql, Object paras[]{list result = find (SQL, paras); return result . Size () <= 0? Null: (Record) result.get (0);} Public transient List find (String sql, Object paras[]) {Connection conn = null; List list;try{conn = Config.getconnection (); list = find (config, conn, SQL, paras);} catch (Exception e) {throw new Activerecordexception (e);} Config.close (conn); return list; Exception Exception;exception;config.close (conn); throw Exception;}  Transient List find (config config, Connection conn, String sql, Object paras[]) throws sqlexception{preparedstatement PST = Conn.preparestatement (SQL); Config.dialect.fillStatement (PST, paras); ResultSet rs = Pst.executequery ();   List result = Recordbuilder.build (config, RS); Return list<record>dbkit.closequietly (RS, PST); return result;} /*recordbuilder.class* wraps a Record object into the Record object */public the static final List build (config config, ResultSet rs) throws Sqlexception{list result = new ArrayList (); ResultSetMetaData RSMD = Rs.GetMetaData (); int columnCount = Rsmd.getcolumncount (); String labelnames[] = new String[columncount + 1];int types[] = new Int[columncount + 1];buildlabelnamesandtypes (RSMD, Lab Elnames, types); Record record;for (; Rs.next (); Result.add (record)) {record = new record (); Record.setcolumnsmap ( Config.containerFactory.getColumnsMap ()); Map columns = Record.getcolumns (); for (int i = 1; I <= columnCount; i++) {Object value;if (Types[i] < 2004) value = RS.G Etobject (i); ElseIf (Types[i] = 2005) value = Modelbuilder.handleclob (Rs.getclob (i)); ElseIf (types[i] = =) Value = Modelbuilder.handleclob (Rs.getnclob (i)); ElseIf (types[i] = = 2004) value = Modelbuilder.handleblob (Rs.getblob (i)); Elsevalue = Rs.getobject (i); Columns.put (Labelnames[i], value);}}     return result;}

  

Jfinal object to record principle "doubt"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.