|
From: Luke T. <ne...@fr...> - 2004-01-11 00:14:13
|
Hi all, I'm doing some work with a client who I've persuaded to use Spring (they just ordered another 10 copies of Rod's book :) and I've found I'm writing a lot of search type queries - where the user enters search criteria and I build a query based on them. If the criteria are too vague, the amount of returned data could potentially be horrendous, so I want to be able to set a limit on the number of rows and throw an exception if the rowcount goes above it. It occurred to me that the checking could be added to the framework with a few minor changes. It would probably involve 1. Adding a maxRows parameter to MappingSQLQueryWithParameters (defaulting to infinite). 2. Adding a TooManyRowsException (or something). 3. Checking the rowcount here http://monkeymachine.co.uk/spring/xref/org/springframework/jdbc/object/MappingSqlQueryWithParameters.html#112 and throwing the exception if it's exceeded. I could write my own subclass and ResultReader but just wanted to see if people thought it would be sufficiently generic to be worthwhile including in the framework classes. Luke. -- Luke Taylor. Monkey Machine Ltd. PGP Key ID: 0x57E9523C http://www.monkeymachine.ltd.uk |