You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use lol_dba for generating migrations as raw SQL and it is brilliant, but I ran into a problem when testing with SQL server. I'm using jRuby and the source of the active record JDBC driver for SQL server queries the version of the database using select_value.
Tracing the source, this eventually calls select_all which has be redefined by lol_dba to return an array, meaning that the adapter is given an empty array instead of the result from the database, which then causes an exception to be raised.
I've made a minor alteration to a local copy so that the redefinition of select all does a similar test to some of the other implementations so it checks for the type of query. This is my change
connection.class.send(:define_method, :select_all) { |*args|
if args.first =~ /SELECT @@version/
self.orig_select_all(*args)
else
[]
end
}
This is very specific to SQL server hence I haven't made a new pull request, but I imagine this may be a problem for other DBMS engines?
The text was updated successfully, but these errors were encountered:
@pareeohnos Thanks for the report! actually, is the first time I've heard about this kind of problem. But if you want, please, create a PR with this change and also add a commend explaining why this is necessary :)
It may well be a JDBC specific issue, as the JDBC drivers override various methods that AR normally handles but I couldn't say for sure. I'm not sure if any other database drivers have this issue as we've only really been working with MSSQL and Postgres, but I only ran into the issue with MSSQL
I'm trying to use
lol_dba
for generating migrations as raw SQL and it is brilliant, but I ran into a problem when testing with SQL server. I'm using jRuby and the source of the active record JDBC driver for SQL server queries the version of the database usingselect_value
.Tracing the source, this eventually calls
select_all
which has be redefined bylol_dba
to return an array, meaning that the adapter is given an empty array instead of the result from the database, which then causes an exception to be raised.I've made a minor alteration to a local copy so that the redefinition of
select all
does a similar test to some of the other implementations so it checks for the type of query. This is my changeThis is very specific to SQL server hence I haven't made a new pull request, but I imagine this may be a problem for other DBMS engines?
The text was updated successfully, but these errors were encountered: