Revision 2728
Added by sgarg almost 19 years ago
SqlserverAdapter.java | ||
---|---|---|
107 | 107 |
} |
108 | 108 |
|
109 | 109 |
/** |
110 |
* MSSQL's syntax for doing a left join |
|
111 |
* Add 'a.' in front of the fields for first table and |
|
112 |
* 'b.' in front of the fields for the second table |
|
113 |
* |
|
114 |
* @param selectFields fields that you want to be selected |
|
115 |
* @param tableA first table in the join |
|
116 |
* @param tableB second table in the join |
|
117 |
* @param joinCriteria the criteria based on which the join will be made |
|
118 |
* @param nonJoinCriteria all other criterias |
|
119 |
* @return return the string for teh select query |
|
120 |
*/ |
|
121 |
public String getLeftJoinQuery(String selectFields, String tableA, |
|
122 |
String tableB, String joinCriteria, String nonJoinCriteria){ |
|
123 |
|
|
124 |
return "SELECT " + selectFields + " FROM " + tableA + " a LEFT JOIN " |
|
125 |
+ tableB + " b ON " + joinCriteria + " WHERE (" |
|
126 |
+ nonJoinCriteria +")"; |
|
127 |
} |
|
128 |
|
|
129 |
/** |
|
110 | 130 |
* Return a hard code string to get xml_document list in timed replcation |
111 | 131 |
*/ |
112 | 132 |
public String getReplicationDocumentListSQL() |
... | ... | |
114 | 134 |
String sql ="select a.docid, a.rev, a.doctype from ( xml_documents a left outer join xml_revisions b on (a.docid=b.docid and a.rev<=b.rev)) where b.docid is null "; |
115 | 135 |
return sql; |
116 | 136 |
} |
117 |
|
|
118 | 137 |
} |
119 | 138 |
|
Also available in: Unified diff
New function which returns the formatted left join query. This is required as Oracle and postgres have different left join syntax