Closed EddieDee closed 10 years ago
That's the way the adapter works - it uses derived names for generators in the form of "#{table_name}_seq" to prefetch id values. Using database with DELPHI is not a way to judge (in your case it's not even advisable to use the same database with both DELPHI and Rails as they obviously use different id generation schemes and this will lead to PK violations).
Is there a way to capture this Exception and create on the fly the sequence?
maybe something like:
begin @invoice = Invoice.new(params[:invoice]) rescue Rubyfb::FireRubyException execute "CREATE GENERATOR #{@invoice.class.table_name}_SEQ; SET GENERATOR #{@invoice.class.table_name}_SEQ TO #{Invoice.count+1};" end
I am getting this problem in some tables, and sometime to fix this, i just need to create a new generator for that table, the weird thing is that this legacy Database is being used with other system with DELPHI and is working good:
This is the error:
Error preparing a SQL statement. invalid request BLR at offset 76 generator MSFIMPUESTOS_SEQ is not defined Invalid token SQL Code = -104 Firebird Code = 335544343
Model: class Tax < ActiveRecord::Base attr_accessible :code, :description, :rate establish_connection( :adapter => "rubyfb", :database => "localhost:/home/developer/Desktop/MFSBASE.Ib", :username => "SYSDBA", :password => "masterkey", :charset => "NONE")
self.table_name = 'msfimpuestos'
end