Hello,
I get an error why trying to delete with a query using <query name="q"
from="t1 left join t2 on t1.a_number=t2.a_number and
t1.a_index=t2.a_index ">
I can solve this by adding the following to org.dbforms.config.Query :
public String getDeleteWhat() {
return deleteWhat;
}
public void setDeleteWhat(String deleteWhat) {
this.deleteWhat = deleteWhat;
}
public String getDeleteStatement() {
// now we start building the DELETE statement
StringBuffer queryBuf = new StringBuffer();
queryBuf.append("DELETE");
if(getDeleteWhat()!=null)queryBuf.append(" "+getDeleteWhat());
queryBuf.append(" FROM ");
queryBuf.append(getQueryToChange());
queryBuf.append(" WHERE ");
queryBuf.append(getWhereClauseForKeyFields());
logCat.info(queryBuf.toString());
return queryBuf.toString();
}
private String deleteWhat;
and adding deleteWhat="t1.*" to my dbforms-config.xml
The problem is that the delete sql generated now is not specific enough:
DELETE FROM t1 left join t2 on t1.a_number=t2.a_number and
t1.a_index=t2.a_index WHERE t1.course_id = ? AND t1.a_index = ? AND
t1.a_number = ?
I need:
DELETE t1.* FROM t1 left join t2 on t1.a_number=t2.a_number and
t1.a_index=t2.a_index WHERE t1.course_id = ? AND t1.a_index = ? AND
t1.a_number = ?
Overriding the getDeleteStatement in org.dbforms.config.Table doesn't
seem the best way since Query would also need to be updated if it gets
changed, but I don't see how to get "deleteWhat" into Table. Any
suggestions or can I commit it as is?
--
Shawn <[EMAIL PROTECTED]>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
DbForms Mailing List
http://www.wap-force.net/dbforms