Forum: Ferret Re: Proposal of some radical changes to API

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Neville B. (Guest)
on 2006-06-08 11:05
(Received via mailing list)
>> So at what point does your app learn the structure of the SQL table?


At the moment I know the structure after executing the SQL and fetching
the first row [a ruby hash]. But the field set will change from SQL to
SQL, and Ferret is doing all the field specification for me via
hash-as-doc, ala.

  def create
    @index = Ferret::Index::Index.new()

    conn = ODBC.connect(@odbc[:dsn], @odbc[:uid], @odbc[:pwd])

    @sqls.each do |sql|
      stmt = conn.prepare(sql)
      stmt.execute.each_hash{ |row| @index << row }
      stmt.close
      stmt.drop
    end

    conn.disconnect
  end

The field definitions do not change though, so I'm happy as long as the
hash-as-doc support remains in Ferret.

Cheers,

Neville
This topic is locked and can not be replied to.