EnsemblGenomes / dbcon

Automatically exported from code.google.com/p/dbcon
0 stars 0 forks source link

SqlLibrary strips ' from queries #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
=Problem=

For the given text query:

{{{
select 'Y' from dual
}}}

Currently the SqlLibrary code will return

{{{
select Y from dual
}}}

This will cause problems with the SQL component since ' quoted variables
are important for inline Strings in queries. This is caused by message
format from java.text.

=Considerations=

SqlLib is meant to tie a user as close to SQL as can be. Therefore nothing
about the underlying implementation of the formatter should be applied.
MessageFormat has a horrible possible syntax where this attempts to provide
a very simplistic templating solution.

=Solutions=

  # Make people aware of this limitation - done but I do not like this
  # Replace MessageFormat with another templating class
    * Just use another templater such as Velocity or StringTemplate. Feels
a bit like over kill
    * Have a custom templater which performs a series of replace operations
on the String. This would allow us to extend the templating to possibly
include text at a later date. I prefer this solution

Original issue reported on code.google.com by andyy...@gmail.com on 26 Mar 2007 at 12:20

GoogleCodeExporter commented 9 years ago
Problem is located in:

http://dbcon.googlecode.com/svn/trunk/dbcon/src/main/java/uk/ac/sanger/cgp/dbcon
/sqllibs/Statement.java

At line 123

Original comment by andyy...@gmail.com on 26 Mar 2007 at 12:21

GoogleCodeExporter commented 9 years ago
Resolved for 5.0.1. We now use a custom templater class in dbcon.util

Original comment by andyy...@gmail.com on 26 Mar 2007 at 1:52