patch for do_jdbc – mapToQueryString

We use DataMapper – an Object Relational Mapper – in parts of our software to make it easier to access our database. In a jruby environment DataMapper will use the JDBC drivers provided for Java with the help of do_jdbc – a component of data_objects used by DataMapper for the actual database access.

As we tried to pass several parameters in the connection URL to the PostgreSQL JDBC driver, we found a bug in the way do_jdbc creates the connection URL passed to the JDBC driver. There is a method mapToQueryString(Map<Object, Object>) in AbstractDriverDefinition. It is responsible for creating the query string of the connection URL. As you all know several query parameters have to be seperated by an &, as you can see every day browsing the web. However, mapToQueryString forgets to insert &s into the query string, thus making it impossible to pass options to JDBC drivers via the connection URL.

You can find a simple patch at our fork of the github project (patch).