Project

General

Profile

Actions

Feature #24013

open

Firebird and RedDatabase support

Added by Andrey Lobanov (RedSoft) about 8 years ago. Updated over 2 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Database
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

I made a patch that adds support for firebird and RedDatabase(based on firebird).
Biggest problem that occurs when trying to run redmine with activerecord-fb-adapter that redmine uses in string constants firebird keywords.


Files

Basic_Fb_support.patch (41.8 KB) Basic_Fb_support.patch Andrey Lobanov (RedSoft), 2016-10-06 23:34
Fb_Support_clear.patch (31 KB) Fb_Support_clear.patch Andrey Lobanov (RedSoft), 2016-10-07 09:25
firebird_support_v2.patch (41.2 KB) firebird_support_v2.patch Andrey Lobanov (RedSoft), 2016-10-09 16:27
Firebird_support_v3.patch (40.6 KB) Firebird_support_v3.patch Andrey Lobanov (RedSoft), 2016-10-10 18:11
issue-24013-r16009-misc.diff (18.3 KB) issue-24013-r16009-misc.diff Toshi MARUYAMA, 2016-11-28 14:13
issue-24013-r16009-db-migrate.diff (3.61 KB) issue-24013-r16009-db-migrate.diff Toshi MARUYAMA, 2016-11-28 14:13
issue-24013-r16009-keywords.diff (10.7 KB) issue-24013-r16009-keywords.diff Toshi MARUYAMA, 2016-11-28 14:13
current_trunk_Firebird_and_RedDatabase_support.patch (27.7 KB) current_trunk_Firebird_and_RedDatabase_support.patch Andrey Lobanov (RedSoft), 2017-01-23 14:23
current_trunk_Decimal_data_type_fix.patch (4.76 KB) current_trunk_Decimal_data_type_fix.patch Andrey Lobanov (RedSoft), 2017-01-23 15:47
Symbols_instead_of_strings_to_support_firebird_keywords.patch (5.95 KB) Symbols_instead_of_strings_to_support_firebird_keywords.patch Andrey Lobanov (RedSoft), 2017-02-14 13:49
Value_keyword_replaced_with_symbols__in_application_controller.patch (915 Bytes) Value_keyword_replaced_with_symbols__in_application_controller.patch Andrey Lobanov (RedSoft), 2017-02-14 13:54
Actions #1

Updated by Toshi MARUYAMA about 8 years ago

It is too hard to see difference in patch.
Could you split patch to two patches?

  1. only indent and white space change
  2. main change
Actions #2

Updated by Andrey Lobanov (RedSoft) about 8 years ago

Here is clear patch. These small changes allows redmine work with firebird.

Actions #3

Updated by Toshi MARUYAMA about 8 years ago

Did you run tests and confirm other databases do not break tests?
http://www.redmine.org/builds/index.html

Actions #4

Updated by Andrey Lobanov (RedSoft) about 8 years ago

I'm sorry few tests failed. So i'll fix it and upload only fully working patch.

Actions #5

Updated by Andrey Lobanov (RedSoft) about 8 years ago

New version of patch. Other dbs tests working.

Actions #6

Updated by Toshi MARUYAMA about 8 years ago

From blog written in Japanese:
http://qiita.com/jnchito/items/630b9f038c87298b5756

https://github.com/rails/rails/issues/16978#issuecomment-56211310

First thing, arel_table is private API of Rails and should not be used in applications.

http://bikeshed.fm/74#comment-2830227073

In this podcast I heard Arel is going to be a public API in Rails 5.1, correct? Does that mean Rails developers will be allowed to use it in applications?

I got an answer from Sean:
Yes, it will be stable after 5.1
https://twitter.com/sgrif/status/763830491204026368

Actions #7

Updated by Toshi MARUYAMA about 8 years ago

  • Tracker changed from Patch to Feature
  • Priority changed from Normal to Low
Actions #8

Updated by Andrey Lobanov (RedSoft) about 8 years ago

Oh. I'll change arel_table usage.

Actions #10

Updated by Mischa The Evil about 8 years ago

For completeness' sake:

Note from quick visual patch scan: it seems it is missing adaptations to the Gemfile, the configuration stubs (config/database.yml.example) and the documentation (doc/INSTALL) reflecting the proposed extension of DB support.

Actions #11

Updated by Warren Postma about 8 years ago

Given that Firebird is an extremely limited and feature-poor alternative to MySQL or Postgres, who would want to use Firebird? I say this as a person with 10 years professional Firebird (and Interbase) experience.

Firebird is itself an open source fork of the Borland/Embarcadero Interbase product.

Actions #12

Updated by Andrey Lobanov (RedSoft) about 8 years ago

Warren Postma wrote:

Given that Firebird is an extremely limited and feature-poor alternative to MySQL or Postgres, who would want to use Firebird? I say this as a person with 10 years professional Firebird (and Interbase) experience.

Firebird is itself an open source fork of the Borland/Embarcadero Interbase product.

I'm sorry but when Firebird became feature-poor? Did you checked latest version 3.0?

Actions #13

Updated by Toshi MARUYAMA about 8 years ago

  • File issue-24103-r16009-misc.diff added
  • File issue-24103-r16009-keywords.diff added
  • File issue-24103-r16009-db-migrate.diff added

These are patches which remained Firebird_support_v3.patch after r16008 and r16009.
I think issue-24013-r16009-db-migrate.diff breaks existing system.

Actions #15

Updated by Toshi MARUYAMA about 8 years ago

  • File deleted (issue-24103-r16009-keywords.diff)
Actions #16

Updated by Toshi MARUYAMA about 8 years ago

  • File deleted (issue-24103-r16009-misc.diff)
Actions #17

Updated by Toshi MARUYAMA about 8 years ago

  • File deleted (issue-24103-r16009-db-migrate.diff)
Actions #18

Updated by Andrey Lobanov (RedSoft) almost 8 years ago

Right now i'm trying to find better solution to support Firebird.
The biggest problem to make it looks native. Because of large count of hardcoded queries with Firebird's keywords.

Actions #19

Updated by Andrey Lobanov (RedSoft) almost 8 years ago

Example of queries changes to fit firebird:
Before:

    JournalDetail.
      where(["property = 'attr' AND prop_key = 'assigned_to_id' AND value = ?", id.to_s]).
      update_all(['value = ?', substitute.id.to_s])

After:
    JournalDetail.
      where(:property => 'attr', :prop_key => 'assigned_to_id', :value => id.to_s).
      update_all(:value => substitute.id.to_s)

Main problem is subqueries or part of queries(where, select, etc) like this:

      # Returns a JOIN clause that is added to the query when sorting by custom values
      def join_for_order_statement(custom_field)
        alias_name = join_alias(custom_field)

        "LEFT OUTER JOIN #{CustomValue.table_name} #{alias_name}" +
          " ON #{alias_name}.customized_type = '#{custom_field.class.customized_class.base_class.name}'" +
          " AND #{alias_name}.customized_id = #{custom_field.class.customized_class.table_name}.id" +
          " AND #{alias_name}.custom_field_id = #{custom_field.id}" +
          " AND (#{custom_field.visibility_by_project_condition})" +
          " AND #{alias_name}.value <> ''" +
          " AND #{alias_name}.id = (SELECT max(#{alias_name}_2.id) FROM #{CustomValue.table_name} #{alias_name}_2" +
            " WHERE #{alias_name}_2.customized_type = #{alias_name}.customized_type" +
            " AND #{alias_name}_2.customized_id = #{alias_name}.customized_id" +
            " AND #{alias_name}_2.custom_field_id = #{alias_name}.custom_field_id)" 
      end


In this code fragment i can't find good solution to replace
#{alias_name}.value

Any suggestions? I'll appreciate any help
Actions #22

Updated by Andrey Lobanov (RedSoft) almost 8 years ago

I think i forgot about some migration files. But i'll fix that later.

Actions #25

Updated by Lucas Schatz about 5 years ago

Any news about this patch? is it stable? integrated?
It would be nice to use Firebird with Redmine too :)
Thanks!

Actions #26

Updated by Tim Crawford over 2 years ago

Warren Postma wrote:

Given that Firebird is an extremely limited and feature-poor alternative to MySQL or Postgres, who would want to use Firebird? I say this as a person with 10 years professional Firebird (and Interbase) experience.

Firebird is itself an open source fork of the Borland/Embarcadero Interbase product.

Just saw this. What?
Firebird is far better than MySql, especially for small systems.
MySql download alone is over 600 MB and takes about 30 minutes minumum to install
Firebird is 15 MB and can be installed in under 5 minutes

I says this as a person who worked for Oracle for 17 years,
and 7 years working with MySql and Firebird

Actions

Also available in: Atom PDF