Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4093 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] New FrontBase database adapter

Reported by: mlaster@metavillage.com Assigned to: David
Priority: normal Milestone:
Component: ActiveRecord Version:
Severity: normal Keywords: unverified
Cc: jonathan@bluewire.net.nz

Description

I'm pretty sure this is working correctly. It is hard to be 100% sure since the trunk is changing, but the tests I'm failing are currently failing under MySQL as well in a clean checkout, so I suspect the problem doesn't lie in my code.

I had to make one change to the Rails framework in fixtures.rb:

  def value_list
    list = []

    # !!! This sometimes fails because the class cannot be found...
    begin
      klass = eval(@class_name)
    rescue => e
      klass = nil
    end
    @fixture.each_pair do |key, value|
      col = klass.nil? ? nil : klass.columns_hash[key]
      element = ActiveRecord::Base.connection.quote(value,col).gsub('\\n', "\n").gsub('\\r', "\r")
      list << element
    end
    list = list.join(", ")
    list
  end

This is necessary because without it I can't find a way to distinguish TIMESTAMP/DATE/TIME values.

Here is an example of the SQL I need to generate:

Topic Update (0.001516)  UPDATE topics SET "bonus_time" = TIME '09:28:00', "approved" = true, "written_on" = TIMESTAMP '2003-07-16 10:28:00', "author_email_address" = 'david@loudthinking.com', "content" = 'Have a nice day', "replies_count" = 0, "title" = 'The First Topic', "author_name" = 'David', "parent_id" = NULL, "last_read" = DATE '2004-04-15', "type" = NULL WHERE id = 1

This works, but maybe someone could explain a better way for me to do this.

Attachments

FrontBaseAdapter.patch (38.6 kB) - added by mlaster@metavillage.com on 03/06/06 03:04:39.
FrontBaseAdapter.2.patch (40.4 kB) - added by mlaster@metavillage.com on 03/07/06 03:37:58.
FrontBaseAdapter.3.patch (58.9 kB) - added by mlaster@metavillage.com on 03/15/06 04:14:35.
recreate_fb_tables.sh (1.4 kB) - added by mlaster@metavillage.com on 04/01/06 01:55:05.
Script to rebuild unit test databases
ruby-frontbase_0.9.tgz (12.9 kB) - added by mlaster@metavillage.com on 04/01/06 01:57:07.
Low level Ruby adapter for FrontBase (based on work by Cail Borrell at FrontBase)
FrontBaseAdaptor.patch (43.5 kB) - added by mlaster@metavillage.com on 04/15/06 14:21:05.
Latest patch as of revisioin 4212
FrontBaseAdapter.4.patch (45.5 kB) - added by mlaster@metavillage.com on 04/19/06 22:45:22.
Latest patch as of revision 4238
FrontBaseAdapter.5.patch (48.8 kB) - added by mlaster@metavillage.com on 04/21/06 00:16:50.
Latest patch as of revision 4241
patch_against_4245.patch (53.3 kB) - added by mlaster@metavillage.com on 04/21/06 22:25:35.
Latest patch as of revision 4241
patch_against_4258.patch (53.5 kB) - added by mlaster@metavillage.com on 04/24/06 21:21:10.
Latest patch as of revision 4258
patch_against_4280.patch (53.9 kB) - added by mlaster@metavillage.com on 04/26/06 21:05:06.
Latest patch as of revision 4280

Change History

03/06/06 03:04:39 changed by mlaster@metavillage.com

  • attachment FrontBaseAdapter.patch added.

03/06/06 19:52:01 changed by mlaster@metavillage.com

  • summary changed from [PATH] New FrontBase database adapter to [PATCH] New FrontBase database adapter.

Fixed typo [PATH] -> [PATCH]

03/07/06 03:37:58 changed by mlaster@metavillage.com

  • attachment FrontBaseAdapter.2.patch added.

03/07/06 03:39:02 changed by anonymous

I updated the patch to FrontBaseAdapter.2.patch. It now passes 100% of the unit tests as of revision 3805.

03/07/06 20:38:39 changed by mlaster@metavillage.com

'rake test_mysql' runs successfully with this patch. I'm trying to figure out how to get PostgreSQL running on my machine so I can test against that too.

03/15/06 04:14:35 changed by mlaster@metavillage.com

  • attachment FrontBaseAdapter.3.patch added.

03/15/06 04:16:56 changed by mlaster@metavillage.com

  • cc set to jonathan@bluewire.net.nz.
  • type changed from defect to enhancement.

Updated the patch. Builds cleanly as of revision 3872.

04/01/06 01:54:13 changed by mlaster@metavillage.com

FrontBase can be downloaded from http://www.frontbase.com/cgi-bin/WebObjects/FrontBase. The script to build (and rebuild) the unit test databases is attached to this ticket.

04/01/06 01:55:05 changed by mlaster@metavillage.com

  • attachment recreate_fb_tables.sh added.

Script to rebuild unit test databases

04/01/06 01:57:07 changed by mlaster@metavillage.com

  • attachment ruby-frontbase_0.9.tgz added.

Low level Ruby adapter for FrontBase (based on work by Cail Borrell at FrontBase)

04/01/06 02:00:59 changed by mlaster@metavillage.com

What do I have to do to get this patch integrated into the main source? I'm trying to keep it up-to-date, but the trunk keeps moving faster than I can patch the unit test failures.

There are still a few test failures left, but it passed cleanly as of 3872, so I'm pretty sure I can get it clean again.

04/14/06 23:10:25 changed by mlaster@metavillage.com

  • keywords set to unverified.
  • version deleted.

Blocked by ticket #4676

04/15/06 14:21:05 changed by mlaster@metavillage.com

  • attachment FrontBaseAdaptor.patch added.

Latest patch as of revisioin 4212

04/15/06 14:22:36 changed by mlaster@metavillage.com

This patch now passes 100% of the unit tests, running both 'rake test_mysql' and 'rake test_frontbase'.

What do I need to do to get this integrated into the main source tree?

04/18/06 03:27:19 changed by mlaster@metavillage.com

My company is now officially using Rails for a project so now I can spend office hours as well as free time working on this. What do I need to do to get this patch accepted? Is anyone even looking at patches? I would really like to get this patch accepted so I can use standard versions of Rails in the future.

04/18/06 16:52:05 changed by mlaster@metavillage.com

rake test_frontbase results:

853 tests, 2857 assertions, 0 failures, 0 errors

04/19/06 22:45:22 changed by mlaster@metavillage.com

  • attachment FrontBaseAdapter.4.patch added.

Latest patch as of revision 4238

04/19/06 22:47:19 changed by mlaster@metavillage.com

  • summary changed from [PATCH] New FrontBase database adapter to [PATCH] New FrontBase database adapte.

The latest patch fixes a bug caused by passing a quoted primary key to find.

Example:

Category.find("1")

This would cause the key to be quoted in the generated SQL which is invalid for an integer column type.

04/19/06 22:47:57 changed by mlaster@metavillage.com

  • summary changed from [PATCH] New FrontBase database adapte to [PATCH] New FrontBase database adapter.

04/21/06 00:16:50 changed by mlaster@metavillage.com

  • attachment FrontBaseAdapter.5.patch added.

Latest patch as of revision 4241

04/21/06 00:17:15 changed by mlaster@metavillage.com

Improved BLOB support.

04/21/06 22:25:35 changed by mlaster@metavillage.com

  • attachment patch_against_4245.patch added.

Latest patch as of revision 4241

04/21/06 22:26:06 changed by mlaster@metavillage.com

Add support for BIT(96) and CLOB column types

04/24/06 21:21:10 changed by mlaster@metavillage.com

  • attachment patch_against_4258.patch added.

Latest patch as of revision 4258

04/26/06 21:05:06 changed by mlaster@metavillage.com

  • attachment patch_against_4280.patch added.

Latest patch as of revision 4280

04/27/06 22:39:57 changed by marcel

  • status changed from new to closed.
  • resolution set to fixed.

(In [4291]) Add support for FrontBase (http://www.frontbase.com/) with a new adapter thanks to the hard work of one Mike Laster. Closes #4093. [mlaster@metavillage.com]

04/27/06 22:50:28 changed by mschoen

  • status changed from closed to reopened.
  • resolution deleted.

This patch is broken because it doesn't rescue the require of 'frontbase' -- if folks don't have it installed, kaboom!

04/28/06 01:14:32 changed by marcel

  • status changed from reopened to closed.
  • resolution set to fixed.