Oh right thanks, Will look into it
Steve -----Original Message----- From: Thoralf Rickert [mailto:[EMAIL PROTECTED] Sent: Wednesday, 28 June 2006 7:30 PM To: Apache Torque Users List Subject: AW: weird problem creating sql suery string from criteria Hi! Did you try to use the doSelectVillageRecords(Criteria) instead of executeQuery(String)? I'm not sure, but the createQueryString() method is more for debugging then for real queries. bye Thoralf > -----Ursprüngliche Nachricht----- > Von: Steve Vanspall [mailto:[EMAIL PROTECTED] > Gesendet: Mittwoch, 28. Juni 2006 02:55 > An: [email protected] > Betreff: weird problem creating sql suery string from criteria > > > Hi > > > > I have a problem where If I set criteria add a select column, > 95% of the time getting a SQL query string from the criteria > works. But occasionally it doesn't create a calid SQL string. > > > > This is the code > > > > // create the count criteria > > Criteria rarCriteria = new Criteria(); > > rarCriteria.addSelectColumn("COUNT(*)"); > > getReturnAuthorisationRequestSearchCriteria(rarCriteria); > > String query = ReturnAuthorisationRequestPeer > > .createQueryString(rarCriteria); > > List list = ReturnAuthorisationRequestPeer.executeQuery( > > > ReturnAuthorisationRequestPeer.createQueryString(rarCriteria), > > ReturnAuthorisationRequestPeer.DATABASE_NAME); > > return ((Record) list.get(0)).getValue(1).asInt(); > > > > > > /* > > getReturnAuthorisationRequestSearchCriteria(rarCriteria); > just adds the criteria using the standard Torque methods. > add, some criterion and's, and depending on the conditions a join. > > */ > > > > Now when I run this once, with all the same settings it will > work. Occasionally it will throw a SQL syntax error in my sql. > > > > All the conditions fo creating the criteria will be the same > as the previous (succesful) criteria build. > > > > When it fails, > ReturnAuthorisationRequestPeer.createQueryString(rarCriteria) > create a string "Select COUNT(*) FROM" with nothin else. > Obvioulsy when it works it produces the complete SQL string. > > > > Why does Torque selectively create the SQL differently? Is > this a bug? Is there any way to guarantee that this will work > every time. Otherwise I will have ot manually build an SQL string. > > > > Any help would be appreciated > > > > Regards > > > > Steve > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
