activerecord-rdb-adapter 0.9.4 → 0.9.6.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/extconf.rb +93 -93
- data/fb.c +3072 -3072
- data/fb_extensions.rb +21 -21
- data/lib/active_model/type/integer.rb +67 -67
- data/lib/active_record/connection_adapters/rdb/database_limits.rb +35 -35
- data/lib/active_record/connection_adapters/rdb/database_statements.rb +186 -183
- data/lib/active_record/connection_adapters/rdb/quoting.rb +152 -152
- data/lib/active_record/connection_adapters/rdb/schema_creation.rb +52 -52
- data/lib/active_record/connection_adapters/rdb/schema_dumper.rb +23 -23
- data/lib/active_record/connection_adapters/rdb/schema_statements.rb +431 -431
- data/lib/active_record/connection_adapters/rdb/table_definition.rb +28 -28
- data/lib/active_record/connection_adapters/rdb_adapter.rb +160 -163
- data/lib/active_record/connection_adapters/rdb_column.rb +69 -69
- data/lib/active_record/rdb_base.rb +34 -34
- data/lib/active_record/tasks/rdb_database_tasks.rb +78 -78
- data/lib/activerecord-rdb-adapter.rb +10 -10
- data/lib/arel/visitors/rdb_visitor.rb +135 -135
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 621e796c470b4ec555c416badf844e2ff0261ec14e445d1155557a7fc3f063fd
|
4
|
+
data.tar.gz: 71b340848583c2b025352f2218fc695cf450f03d2ff50e0a6c32d88c25885f58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55459079dc2d3aa0c3c236750772f73885abe083743cd029bf4136ab4054f9c7b22ab18376f85858b8a704767d9eea93bfc2b147a3ef65d7d3912b4fae1b6b3f
|
7
|
+
data.tar.gz: fc0ac38a0c8f9f287e282e34b6016f66d191e3aead669f53f35f3179f3a4a71d0d198e73b88f401a862163368fa04d30e873c7a28fe4f36c2072763757d77785
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
# ActiveRecord RDB Adapter
|
2
|
-
|
3
|
-
ActiveRecord adapter that allows you to use ActiveRecord 5+(**Rails 5.2 is recommended**) and **Ruby 2.5+** with [RedDatabase 3+](http://reddatabase.ru/) and Firebird 3
|
4
|
-
|
5
|
-
[](https://badge.fury.io/rb/activerecord-rdb-adapter)
|
6
|
-
|
7
|
-
GUI Database Editor for RedDatabase: [RedExpert](http://reddatabase.ru/downloads/redexpert/)
|
8
|
-
|
1
|
+
# ActiveRecord RDB Adapter
|
2
|
+
|
3
|
+
ActiveRecord adapter that allows you to use ActiveRecord 5+(**Rails 5.2 is recommended**) and **Ruby 2.5+** with [RedDatabase 3+](http://reddatabase.ru/) and Firebird 3
|
4
|
+
|
5
|
+
[](https://badge.fury.io/rb/activerecord-rdb-adapter)
|
6
|
+
|
7
|
+
GUI Database Editor for RedDatabase: [RedExpert](http://reddatabase.ru/downloads/redexpert/)
|
8
|
+
|
9
9
|
inspired by [activerecord-fb-adapter](https://github.com/rowland/activerecord-fb-adapter) and [firebird_adapter](https://github.com/FabioMR/firebird_adapter)
|
data/extconf.rb
CHANGED
@@ -1,93 +1,93 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# = Windows
|
3
|
-
# === Sample of Makefile creation:
|
4
|
-
# <tt>ruby extconf.rb --with-opt-dir=C:/Progra~1/Firebird/Firebird_2_5</tt>
|
5
|
-
# === Notes
|
6
|
-
# * Windows is known to build with Ruby from rubyinstaller.org.
|
7
|
-
# * New in this release is automatically finding your Firebird install under Program Files.
|
8
|
-
# * If your install is some place non-standard (or on a non-English version of Windows), you'll need to run extconf.rb manually as above.
|
9
|
-
# * mkmf doesn't like directories with spaces, hence the 8.3 notation in the example above.
|
10
|
-
# = Linux
|
11
|
-
# === Notes
|
12
|
-
# * Build seems to "just work."
|
13
|
-
# * Unit tests take about 10 times as long to complete using Firebird Classic. Default xinetd.conf settings may not allow the tests to complete due to the frequency with which new attachments are made.
|
14
|
-
# = Mac OS X (Intel)
|
15
|
-
# * Works
|
16
|
-
|
17
|
-
def unquote(string)
|
18
|
-
string.sub(/\A(['"])?(.*?)\1?\z/m, '\2') unless string.nil?
|
19
|
-
end
|
20
|
-
|
21
|
-
def key_exists?(path)
|
22
|
-
begin
|
23
|
-
Win32::Registry::HKEY_LOCAL_MACHINE.open(path, ::Win32::Registry::KEY_READ)
|
24
|
-
return true
|
25
|
-
rescue
|
26
|
-
return false
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def read_firebird_registry
|
31
|
-
require 'win32/registry'
|
32
|
-
if key_exists?('SOFTWARE\Firebird Project\Firebird Server\Instances')
|
33
|
-
Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Firebird Project\Firebird Server\Instances', Win32::Registry::Constants::KEY_READ) do |reg|
|
34
|
-
return reg.read_s('DefaultInstance') rescue nil
|
35
|
-
end
|
36
|
-
else
|
37
|
-
return false
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def search_firebird_path
|
42
|
-
program_files = ENV['ProgramFiles'].gsub('\\', '/').gsub(/(\w+\s+[\w\s]+)/) { |s| s.size > 8 ? s[0,6] + '~1' : s }
|
43
|
-
program_files_x86 = ENV['ProgramFiles'].gsub('\\', '/').gsub(/(\w+\s+[\w\s]+)/) { |s| s.size > 8 ? s[0,6] + '~2' : s }
|
44
|
-
result = Dir["#{program_files}/Firebird/Firebird_*"].sort.last || Dir["#{program_files_x86}/Firebird/Firebird_*"].sort.last
|
45
|
-
end
|
46
|
-
|
47
|
-
if RUBY_PLATFORM =~ /(mingw32|mswin32)/ and ARGV.grep(/^--with-opt-dir=/).empty?
|
48
|
-
opt = unquote(ENV['FIREBIRD'])
|
49
|
-
opt = opt || read_firebird_registry
|
50
|
-
opt = opt || search_firebird_path
|
51
|
-
if opt
|
52
|
-
ARGV << "--with-opt-dir=#{opt}"
|
53
|
-
else
|
54
|
-
puts "No any Firebird instances found in system."
|
55
|
-
exit
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
require 'mkmf'
|
60
|
-
|
61
|
-
libs = %w/ fbclient gds /
|
62
|
-
|
63
|
-
case RUBY_PLATFORM
|
64
|
-
when /bccwin32/
|
65
|
-
libs.push "fbclient_bor"
|
66
|
-
when /mswin32/, /mingw32/
|
67
|
-
$CFLAGS = $CFLAGS + " -DOS_WIN32"
|
68
|
-
libs.push "fbclient_ms"
|
69
|
-
when /darwin/
|
70
|
-
# hosttype = `uname -m`.chomp
|
71
|
-
$CFLAGS += " -DOS_UNIX"
|
72
|
-
# $CFLAGS.gsub!(/-arch (\w+)/) { |m| $1 == hosttype ? m : '' }
|
73
|
-
# $LDFLAGS.gsub!(/-arch (\w+)/) { |m| $1 == hosttype ? m : '' }
|
74
|
-
# CONFIG['LDSHARED'].gsub!(/-arch (\w+)/) { |m| $1 == hosttype ? m : '' }
|
75
|
-
$CPPFLAGS += " -I/Library/Frameworks/Firebird.framework/Headers"
|
76
|
-
$LDFLAGS += " -framework Firebird"
|
77
|
-
when /linux/
|
78
|
-
$CFLAGS = $CFLAGS + " -DOS_UNIX"
|
79
|
-
end
|
80
|
-
|
81
|
-
dir_config("firebird")
|
82
|
-
|
83
|
-
test_func = "isc_attach_database"
|
84
|
-
|
85
|
-
case RUBY_PLATFORM
|
86
|
-
when /mswin32/, /mingw32/
|
87
|
-
libs.find {|lib| have_library(lib) } and
|
88
|
-
have_func(test_func, ["ibase.h"])
|
89
|
-
else
|
90
|
-
libs.find {|lib| have_library(lib, test_func) }
|
91
|
-
end
|
92
|
-
|
93
|
-
create_makefile("fb")
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# = Windows
|
3
|
+
# === Sample of Makefile creation:
|
4
|
+
# <tt>ruby extconf.rb --with-opt-dir=C:/Progra~1/Firebird/Firebird_2_5</tt>
|
5
|
+
# === Notes
|
6
|
+
# * Windows is known to build with Ruby from rubyinstaller.org.
|
7
|
+
# * New in this release is automatically finding your Firebird install under Program Files.
|
8
|
+
# * If your install is some place non-standard (or on a non-English version of Windows), you'll need to run extconf.rb manually as above.
|
9
|
+
# * mkmf doesn't like directories with spaces, hence the 8.3 notation in the example above.
|
10
|
+
# = Linux
|
11
|
+
# === Notes
|
12
|
+
# * Build seems to "just work."
|
13
|
+
# * Unit tests take about 10 times as long to complete using Firebird Classic. Default xinetd.conf settings may not allow the tests to complete due to the frequency with which new attachments are made.
|
14
|
+
# = Mac OS X (Intel)
|
15
|
+
# * Works
|
16
|
+
|
17
|
+
def unquote(string)
|
18
|
+
string.sub(/\A(['"])?(.*?)\1?\z/m, '\2') unless string.nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
def key_exists?(path)
|
22
|
+
begin
|
23
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.open(path, ::Win32::Registry::KEY_READ)
|
24
|
+
return true
|
25
|
+
rescue
|
26
|
+
return false
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def read_firebird_registry
|
31
|
+
require 'win32/registry'
|
32
|
+
if key_exists?('SOFTWARE\Firebird Project\Firebird Server\Instances')
|
33
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Firebird Project\Firebird Server\Instances', Win32::Registry::Constants::KEY_READ) do |reg|
|
34
|
+
return reg.read_s('DefaultInstance') rescue nil
|
35
|
+
end
|
36
|
+
else
|
37
|
+
return false
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def search_firebird_path
|
42
|
+
program_files = ENV['ProgramFiles'].gsub('\\', '/').gsub(/(\w+\s+[\w\s]+)/) { |s| s.size > 8 ? s[0,6] + '~1' : s }
|
43
|
+
program_files_x86 = ENV['ProgramFiles'].gsub('\\', '/').gsub(/(\w+\s+[\w\s]+)/) { |s| s.size > 8 ? s[0,6] + '~2' : s }
|
44
|
+
result = Dir["#{program_files}/Firebird/Firebird_*"].sort.last || Dir["#{program_files_x86}/Firebird/Firebird_*"].sort.last
|
45
|
+
end
|
46
|
+
|
47
|
+
if RUBY_PLATFORM =~ /(mingw32|mswin32)/ and ARGV.grep(/^--with-opt-dir=/).empty?
|
48
|
+
opt = unquote(ENV['FIREBIRD'])
|
49
|
+
opt = opt || read_firebird_registry
|
50
|
+
opt = opt || search_firebird_path
|
51
|
+
if opt
|
52
|
+
ARGV << "--with-opt-dir=#{opt}"
|
53
|
+
else
|
54
|
+
puts "No any Firebird instances found in system."
|
55
|
+
exit
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
require 'mkmf'
|
60
|
+
|
61
|
+
libs = %w/ fbclient gds /
|
62
|
+
|
63
|
+
case RUBY_PLATFORM
|
64
|
+
when /bccwin32/
|
65
|
+
libs.push "fbclient_bor"
|
66
|
+
when /mswin32/, /mingw32/
|
67
|
+
$CFLAGS = $CFLAGS + " -DOS_WIN32"
|
68
|
+
libs.push "fbclient_ms"
|
69
|
+
when /darwin/
|
70
|
+
# hosttype = `uname -m`.chomp
|
71
|
+
$CFLAGS += " -DOS_UNIX"
|
72
|
+
# $CFLAGS.gsub!(/-arch (\w+)/) { |m| $1 == hosttype ? m : '' }
|
73
|
+
# $LDFLAGS.gsub!(/-arch (\w+)/) { |m| $1 == hosttype ? m : '' }
|
74
|
+
# CONFIG['LDSHARED'].gsub!(/-arch (\w+)/) { |m| $1 == hosttype ? m : '' }
|
75
|
+
$CPPFLAGS += " -I/Library/Frameworks/Firebird.framework/Headers"
|
76
|
+
$LDFLAGS += " -framework Firebird"
|
77
|
+
when /linux/
|
78
|
+
$CFLAGS = $CFLAGS + " -DOS_UNIX"
|
79
|
+
end
|
80
|
+
|
81
|
+
dir_config("firebird")
|
82
|
+
|
83
|
+
test_func = "isc_attach_database"
|
84
|
+
|
85
|
+
case RUBY_PLATFORM
|
86
|
+
when /mswin32/, /mingw32/
|
87
|
+
libs.find {|lib| have_library(lib) } and
|
88
|
+
have_func(test_func, ["ibase.h"])
|
89
|
+
else
|
90
|
+
libs.find {|lib| have_library(lib, test_func) }
|
91
|
+
end
|
92
|
+
|
93
|
+
create_makefile("fb")
|