From c4d313b2d3b52ffaaada3eb7d1f1f5af49556763 Mon Sep 17 00:00:00 2001 From: mdb Date: Sat, 11 May 2002 19:19:47 +0000 Subject: [PATCH] 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 --- .../java/com/samskivert/jdbc/jora/Table.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/projects/samskivert/src/java/com/samskivert/jdbc/jora/Table.java b/projects/samskivert/src/java/com/samskivert/jdbc/jora/Table.java index 81df26c4..45e33691 100644 --- a/projects/samskivert/src/java/com/samskivert/jdbc/jora/Table.java +++ b/projects/samskivert/src/java/com/samskivert/jdbc/jora/Table.java @@ -140,6 +140,23 @@ public class Table { 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 * * @param condition valid SQL condition expression started with WHERE