Re: Geoserver-PostGIS performance problems - Mailing list pgsql-performance

From Maciek Sakrejda
Subject Re: Geoserver-PostGIS performance problems
Date
Msg-id CAOtHd0A8A5h-baTQ44OnVg7215BV6XPj_74ihHew9Jz7yNEUrg@mail.gmail.com
Whole thread Raw
In response to Re: Geoserver-PostGIS performance problems  (Rural Hunter <ruralhunter@gmail.com>)
List pgsql-performance
On Wed, Jul 25, 2012 at 7:13 PM, Rural Hunter <ruralhunter@gmail.com> wrote:
> Why not just use simple Statement instead of PreparedStatement and construct
> the SQL with concated string or StringBuilder? like this:
> int col1=xxx;
> String col2="xxxx";
> String sql="select * from table where col1="+col+" and col2='"+col2+"'";

Ah, finally get to apply the old there's-an-xkcd-for-that rule here:
http://xkcd.com/327/

Or, more informatively: http://en.wikipedia.org/wiki/SQL_injection

Note that it's not completely crazy (in fact, the JDBC driver used to
this this forever ago): if you know what you're doing, you *can*
safely escape strings and avoid injection. But it's not for the faint
of heart.

Also, if you control the parameters and can verify that escaping is
not (and will never be) necessary over the domain of their possible
values, that's another option.

But in general, it's safer to let drivers worry about this.

pgsql-performance by date:

Previous
From: Maciek Sakrejda
Date:
Subject: Re: Geoserver-PostGIS performance problems
Next
From: Merlin Moncure
Date:
Subject: Re: Geoserver-PostGIS performance problems