JDBCDataStore should use prepared statemetns for all database operations
------------------------------------------------------------------------

                 Key: GEOT-1961
                 URL: http://jira.codehaus.org/browse/GEOT-1961
             Project: GeoTools
          Issue Type: Improvement
          Components: data h2
    Affects Versions: 2.5-RC0
            Reporter: Andrea Aime
            Assignee: Justin Deoliveira
             Fix For: 2.5.0, 2.6-M0


For both security and performance reasons all database operations should use 
prepared statements. 
This means all literals and feature values should be encoded as ?, put into a 
data structure, and then set into the prepared statement. The filter encoder 
should probably encode all literals and build a list of params that is then 
returned along with the generated sql. The non trivial bit is making sure all ? 
are in the same order as the parameters. One way to do so is to ensure the 
filter encoder uses an inorder visit 
(http://en.wikipedia.org/wiki/Tree_traversal), think for example between filter 
encodings. 
Dialect wise, I believe most values can be set using setObject, but depending 
on the dialect some (especially geometries) might need to be set using special 
constructs (think Oracle STRUTS, they are not used only for geometries), 
meaning it's probably a good idea to let the dialect do the value setting 
(something like setValue(PreparedStatement ps, Object value, Class binding) 
should work).
Once this is done, we can get an extra speed boost by cachign prepared 
statemetns (this can be done with a flag at the connection pool level) and by 
using batches of prepared statements for inserts/updates (this can be done 
later of course).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to