On Thursday, August 15, 2019 at 3:53:45 AM UTC-7, Guy Boertje wrote:
> > Do other drivers use driver-specific array types?
> I'm not sure about the driver-specific bit but I imagine that the driver 
> designers will use a Java JDBC array type if the DB technology supports 
> array columns or similar. I'm thinking of the newer breed of DB tech that 
> is not tables, columns and rows for which JDBC APIs are becoming common.
> > Do all of the JDBC drivers that support array columns return an object 
> that will respond to to_ary?
> My understanding is, the driver returns an instance of java.sql.Array, 
> via the `getArray(column)` Jruby will wrap the result in some kind of Ruby 
> compatible proxy. That proxy will translate the `.array` call into 
> `getArray()` and that call will return another JRuby proxy. If that proxy 
> is an instance of `ArrayJavaProxy` then it has a `to_ary` method returning 
> `JavaUtil.convertJavaArrayToRubyWithNesting(context, array)`.
> Without the call to `array` (as the postgres adapter does), AFAICT, 
> `process_result_set` adds the proxy wrapped result of the 
> `getArray(column)`.
> FWIW the activerecord-jdbc-adapter 
> <https://github.com/jruby/activerecord-jdbc-adapter/blob/master/src/java/arjdbc/jdbc/RubyJdbcConnection.java#L2282>
>  uses 
> a arrayToRuby method on all jdbc for at least 7 years with the Postgres 
> specific override removed in 28 Mar 2018 (array handling identical but 
> different because "Method org.postgresql.jdbc4.Jdbc4Array.free() is not yet 
> implemented"). Their approach is interesting as it recursive into the array 
> but their code is in Java/JRuby so they avoid the proxy wrappers.

Thank you for that information, it was very help to provide context.  I've 
tested moving the code from the jdbc/postgresql subadapter to the jdbc 
adapter and it appears to work.  I'll push the changes to GitHub shortly.


You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to