Added support for joining data from multiple tables into a single object
(previously there was support for using indexes in other tables but not for obtaining data from them). git-svn-id: https://samskivert.googlecode.com/svn/trunk@732 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -140,6 +140,23 @@ public class Table {
|
|||||||
return new Cursor(this, session, 1, query);
|
return new Cursor(this, session, 1, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Select records from database table according to search condition
|
||||||
|
* including the specified (comma separated) extra tables into the
|
||||||
|
* SELECT clause to facilitate a join in determining the key. To
|
||||||
|
* facilitate situations where data from multiple tables is being
|
||||||
|
* combined into a single object, the fields will not be qualified
|
||||||
|
* with the primary table name.
|
||||||
|
*
|
||||||
|
* @param tables the (comma separated) names of extra tables to
|
||||||
|
* include in the SELECT clause.
|
||||||
|
* @param condition valid SQL condition expression started with WHERE.
|
||||||
|
*/
|
||||||
|
public final Cursor join(String tables, String condition) {
|
||||||
|
String query = "select " + listOfFields +
|
||||||
|
" from " + name + "," + tables + " " + condition;
|
||||||
|
return new Cursor(this, session, 1, query);
|
||||||
|
}
|
||||||
|
|
||||||
/** Select records from database table according to search condition
|
/** Select records from database table according to search condition
|
||||||
*
|
*
|
||||||
* @param condition valid SQL condition expression started with WHERE
|
* @param condition valid SQL condition expression started with WHERE
|
||||||
|
|||||||
Reference in New Issue
Block a user