summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/repo
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2006-10-29 22:56:35 +0000
committerBrian S. O'Neill <bronee@gmail.com>2006-10-29 22:56:35 +0000
commitadb506cf387e5ce857f18c5a725f5f93c445b239 (patch)
tree5d6d807350a71a242731d134afc938b396477125 /src/main/java/com/amazon/carbonado/repo
parent47e42df35ccdd8bbdeb55ed48f1325ded9ae3a69 (diff)
Inner join syntax compatible with more SQL parsers.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java
index b06bf99..a1d4cd9 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java
@@ -720,13 +720,24 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S>
}
/**
- * Appends table names, aliases, and joins to the given FROM clause
- * builder.
+ * Appends table name and alias to the given FROM clause builder.
*/
- public void appendFullJoinTo(StatementBuilder fromClause) {
+ public void appendTableNameAndAliasTo(StatementBuilder fromClause) {
appendTableNameTo(fromClause);
fromClause.append(' ');
fromClause.append(mAlias);
+ }
+
+ /**
+ * Appends table names, aliases, and joins to the given FROM clause
+ * builder.
+ */
+ public void appendFullJoinTo(StatementBuilder fromClause) {
+ appendTableNameAndAliasTo(fromClause);
+ appendTailJoinTo(fromClause);
+ }
+
+ private void appendTailJoinTo(StatementBuilder fromClause) {
for (JoinNode jn : mSubNodes.values()) {
// TODO: By default, joins are all inner. A join could become
// LEFT OUTER JOIN if the query filter has a term like this:
@@ -737,7 +748,7 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S>
// "address(.)state = ?".
fromClause.append(" INNER JOIN");
- jn.appendFullJoinTo(fromClause);
+ jn.appendTableNameAndAliasTo(fromClause);
fromClause.append(" ON ");
int count = jn.mProperty.getJoinElementCount();
for (int i=0; i<count; i++) {
@@ -752,6 +763,8 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S>
fromClause.append('.');
fromClause.append(jn.mProperty.getExternalJoinElement(i).getColumnName());
}
+
+ jn.appendTailJoinTo(fromClause);
}
}