db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl <thomas.vand...@tewisoft.de>
Subject BasePeer.doPSSelect with complex query fails.
Date Fri, 11 Mar 2005 12:13:24 GMT
Hi folks,

I was trying to use prepared statements in my application. My selects 
consist of joins over several tables and I thought this would help 

Instead, I got a DataSetException which I could track down in the latest 
Village code. It says "This schema represents several tables."

 From a deeper look into the code I saw that this one could never work. 
Reason: When the QueryDataSet(ResultSet) constructor is used, 
selectString is null and fetchRecords() tries to create one for no 
apparent reason:

         if (selectString == null)
             selectString = new StringBuffer (256);
             selectString.append ("SELECT ");
             selectString.append (schema().attributes());
             selectString.append (" FROM ");
             selectString.append (schema().tableName());

In this piece of needless code schema().tableName() is called which 
throws the abovementioned exception if more than one table is referenced 
in the ResultSet. So this stuff cannot work for selects including joins.

Call for comments:
- Can this be verified by anyone else?
- Is fixing Village a good option?
- Does anyone know a workaround which we can put into BasePeer?

Bye, Thomas.

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message