db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shane Beasley <sbeas...@acm.org>
Subject Re: retrieve columns returned by doSelect(Criteria) query
Date Fri, 15 Dec 2006 01:36:04 GMT
David Zhao wrote:

>  If I did this:
>
>  Criteria crit = new Criteria(); crit.addJoin(Table1Peer.ID1,
>  Table2Peer.ID2, Criteria.INNER_JOIN );
>  crit.addSelectColumn(Table1Peer.ID1);
>  crit.addSelectColumn(Table2Peer.NAME);
>  crit.addSelectColumn(Table2Peer.NOTES); List list = null; try { list
>  = BasePeer.doSelect(crit); } catch (Exception e) { Log.error("Error
>  runnnnning query: " + e.getMessage()); }
>
>  How can I retrieve the list of columns returned by the query?

// 
http://www.softwareforge.de/projects/village/apidocs/com/workingdogs/village/Record.html
// 
http://www.softwareforge.de/projects/village/apidocs/com/workingdogs/village/Value.html

import com.workingdogs.village.Record;
import com.workingdogs.village.Value;

final List<Record> records = BasePeer.doSelect(crit);

for (final Record record : records) {
  final Value v_id1 = record.get(1);
  final int id1 = v_id1.asInt();
  final Value v_name = record.get(2);
  final String name = v_name.asString();
  // ...
}

Shane

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message