# File lib/arjdbc/hsqldb/adapter.rb, line 139
139: def _execute(sql, name = nil)
140: result = super
141: ActiveRecord::ConnectionAdapters::JdbcConnection::insert?(sql) ? last_insert_id : result
142: end
# File lib/arjdbc/hsqldb/adapter.rb, line 106
106: def add_column(table_name, column_name, type, options = {})
107: add_column_sql = "ALTER TABLE #{quote_table_name(table_name)} ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
108: add_column_options!(add_column_sql, options)
109: execute(add_column_sql)
110: end
# File lib/arjdbc/hsqldb/adapter.rb, line 43
43: def arel2_visitors
44: require 'arel/visitors/hsqldb'
45: {'hsqldb' => ::Arel::Visitors::HSQLDB, 'jdbchsqldb' => ::Arel::Visitors::HSQLDB}
46: end
# File lib/arjdbc/hsqldb/adapter.rb, line 135
135: def last_insert_id
136: Integer(select_value("CALL IDENTITY()"))
137: end
# File lib/arjdbc/hsqldb/adapter.rb, line 48
48: def modify_types(tp)
49: tp[:primary_key] = "INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) PRIMARY KEY"
50: tp[:integer][:limit] = nil
51: tp[:boolean][:limit] = nil
52: # set text and float limits so we don't see odd scales tacked on
53: # in migrations
54: tp[:boolean] = { :name => "tinyint" }
55: tp[:text][:limit] = nil
56: tp[:float][:limit] = 17 if defined?(::Jdbc::H2)
57: tp[:string][:limit] = 255
58: tp[:datetime] = { :name => "DATETIME" }
59: tp[:timestamp] = { :name => "DATETIME" }
60: tp[:time] = { :name => "TIME" }
61: tp[:date] = { :name => "DATE" }
62: tp
63: end
# File lib/arjdbc/hsqldb/adapter.rb, line 94
94: def quote_string(str)
95: str.gsub(/'/, "''")
96: end
# File lib/arjdbc/hsqldb/adapter.rb, line 102
102: def quoted_false
103: '0'
104: end
# File lib/arjdbc/hsqldb/adapter.rb, line 98
98: def quoted_true
99: '1'
100: end
# File lib/arjdbc/hsqldb/adapter.rb, line 166
166: def remove_index(table_name, options = {})
167: execute "DROP INDEX #{quote_column_name(index_name(table_name, options))}"
168: end
# File lib/arjdbc/hsqldb/adapter.rb, line 131
131: def rename_table(name, new_name)
132: execute "ALTER TABLE #{name} RENAME TO #{new_name}"
133: end
override to filter out system tables that otherwise end up in db/schema.rb during migrations. JdbcConnection#tables now takes an optional block filter so we can screen out rows corresponding to system tables. HSQLDB names its system tables SYSTEM.*, but H2 seems to name them without any kind of convention
# File lib/arjdbc/hsqldb/adapter.rb, line 162
162: def tables
163: @connection.tables.select {|row| row.to_s !~ /^system_/ }
164: end
Maps logical Rails types to MySQL-specific data types.
# File lib/arjdbc/hsqldb/adapter.rb, line 125
125: def type_to_sql(type, limit = nil, precision = nil, scale = nil)
126: return super if defined?(::Jdbc::H2) || type.to_s != 'integer' || limit == nil
127:
128: type
129: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.