I've got hsqldb working for the most part; the only thing I've noticed
so far is that it's not creating the association tables automagickally
for habtm associations. I know that's the behaviour for Derby; however,
mysql seems to create the association tables correctly. Am I correct in
assuming that the expected behaviour is for all the drivers to create
these tables?
Migrations are working now. Also, ActiveScaffold is working aside from
habtm's autocreated tables -- that's one of the most stringent tests I
know ;-)
There were two methods in jdbc_hsqldb.rb which needed to be changed.
The first, insert, wasn't working because
java.jdbc.Statement#executeUpdate(String sql, int autoGeneratedUpdate)
which is invoked by _execute isn't supported by hsqldb and always throws
SQLException.
Second, migrations weren't completing because it couldn't dump the
schema because tables wasn't returning a collection and the regex
pattern was incorrect.
Diffs from rev 607 follow:
Index: lib/jdbc_adapter/jdbc_hsqldb.rb
===================================================================
--- lib/jdbc_adapter/jdbc_hsqldb.rb (revision 607)
+++ lib/jdbc_adapter/jdbc_hsqldb.rb (working copy)
@@ -110,7 +110,9 @@
end
def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name
= nil) #:nodoc:
- execute(sql, name)
+ log_no_bench(sql,name) do
+ @connection.execute_update(sql)
+ end
table = sql.split(" ", 4)[2]
id_value || last_insert_id(table, nil)
end
@@ -136,9 +138,11 @@
# system tables SYSTEM.*, but H2 seems to name them without
# any kind of convention
def tables
- @connection.tables do |result_row|
-
result_row.get_string(ActiveRecord::ConnectionAdapters::Jdbc::TableMetaData::TABLE_TYPE)
!~ /^SYSTEM TABLE$/i
+ _results = []
+ @connection.tables.each do |result_row|
+ _results << result_row.to_s if result_row.to_s !~ /^system_/i
end
+ _results
end
# For migrations, exclude the primary key index as recommended
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel