ruby-dm 0.1.0
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 +7 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/SYSDBA) +0 -0
- data/dm-0.1.0.gem +0 -0
- data/dm.gemspec +29 -0
- data/ext/client.c +520 -0
- data/ext/client.h +40 -0
- data/ext/dm_enc_name_to_ruby.h +63 -0
- data/ext/dm_ext.c +17 -0
- data/ext/dm_ext.h +43 -0
- data/ext/dm_lib_path.rb +3 -0
- data/ext/extconf.h +11 -0
- data/ext/extconf.rb +123 -0
- data/ext/result.c +1052 -0
- data/ext/result.h +39 -0
- data/ext/statement.c +666 -0
- data/ext/statement.h +36 -0
- data/lib/dm/client.rb +54 -0
- data/lib/dm/console.rb +5 -0
- data/lib/dm/error.rb +59 -0
- data/lib/dm/field.rb +3 -0
- data/lib/dm/result.rb +7 -0
- data/lib/dm/statement.rb +9 -0
- data/lib/dm/version.rb +5 -0
- data/lib/dm.rb +65 -0
- metadata +94 -0
data/ext/extconf.rb
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'pp'
|
2
|
+
require 'mkmf'
|
3
|
+
|
4
|
+
|
5
|
+
if ENV['MAINTAINER_MODE']
|
6
|
+
$stderr.puts "Maintainer mode enabled."
|
7
|
+
$CFLAGS <<
|
8
|
+
' -Wall' <<
|
9
|
+
' -g3' <<
|
10
|
+
' -DDEBUG' <<
|
11
|
+
' -pedantic'
|
12
|
+
$LDFLAGS <<
|
13
|
+
' -g3'
|
14
|
+
end
|
15
|
+
|
16
|
+
if enable_config("windows-cross")
|
17
|
+
# Avoid dependency to external libgcc.dll on x86-mingw32
|
18
|
+
$LDFLAGS << " -static-libgcc"
|
19
|
+
# Don't use pg_config for cross build, but --with-pg-* path options
|
20
|
+
dir_config 'dm'
|
21
|
+
end
|
22
|
+
|
23
|
+
if ENV['DM_HOME']
|
24
|
+
if /mswin|mingw/ =~ RUBY_PLATFORM
|
25
|
+
incdir = ENV['DM_HOME'] + "\\include"
|
26
|
+
libdir = ENV['DM_HOME'] + "\\bin"
|
27
|
+
else
|
28
|
+
incdir = ENV['DM_HOME'] + '/include'
|
29
|
+
libdir = ENV['DM_HOME'] + '/bin'
|
30
|
+
end
|
31
|
+
dlldir = libdir
|
32
|
+
dir_config('dm',incdir,libdir)
|
33
|
+
# Try to use runtime path linker option, even if RbConfig doesn't know about it.
|
34
|
+
# The rpath option is usually set implicit by dir_config(), but so far not
|
35
|
+
# on MacOS-X.
|
36
|
+
if dlldir && RbConfig::CONFIG["RPATHFLAG"].to_s.empty?
|
37
|
+
append_ldflags "-Wl,-rpath,#{dlldir.quote}"
|
38
|
+
end
|
39
|
+
|
40
|
+
if /mswin/ =~ RUBY_PLATFORM
|
41
|
+
$libs = append_library($libs, 'ws2_32')
|
42
|
+
end
|
43
|
+
|
44
|
+
else
|
45
|
+
# Native build
|
46
|
+
incdir, libdir = dir_config 'dm'
|
47
|
+
dlldir = libdir
|
48
|
+
|
49
|
+
# Try to use runtime path linker option, even if RbConfig doesn't know about it.
|
50
|
+
# The rpath option is usually set implicit by dir_config(), but so far not
|
51
|
+
# on MacOS-X.
|
52
|
+
if dlldir && RbConfig::CONFIG["RPATHFLAG"].to_s.empty?
|
53
|
+
append_ldflags "-Wl,-rpath,#{dlldir.quote}"
|
54
|
+
end
|
55
|
+
|
56
|
+
if /mswin/ =~ RUBY_PLATFORM
|
57
|
+
$libs = append_library($libs, 'ws2_32')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
$stderr.puts "Using dpi from #{dlldir}"
|
62
|
+
|
63
|
+
File.write("dm_lib_path.rb", <<-EOT)
|
64
|
+
module Dm
|
65
|
+
DM_LIB_PATH = #{dlldir.inspect}
|
66
|
+
end
|
67
|
+
EOT
|
68
|
+
$INSTALLFILES = {
|
69
|
+
"./dm_lib_path.rb" => "$(RUBYLIBDIR)/dm/"
|
70
|
+
}
|
71
|
+
|
72
|
+
if RUBY_VERSION >= '2.3.0' && /solaris/ =~ RUBY_PLATFORM
|
73
|
+
append_cppflags( '-D__EXTENSIONS__' )
|
74
|
+
end
|
75
|
+
|
76
|
+
begin
|
77
|
+
find_header( 'DPI.h' ) or abort "Can't find the DPI.h header"
|
78
|
+
find_header( 'DPIext.h' ) or abort "Can't find the DPIext.h header"
|
79
|
+
find_header( 'DPItypes.h' ) or abort "Can't find the DPItypes.h header"
|
80
|
+
|
81
|
+
abort "Can't find the DM library (dpi)" unless
|
82
|
+
have_library( 'dmdpi', 'dpi_login' ) ||
|
83
|
+
have_library( 'libdmdpi', 'dpi_login' )
|
84
|
+
|
85
|
+
rescue SystemExit
|
86
|
+
$stderr.puts <<-EOT
|
87
|
+
*****************************************************************************
|
88
|
+
|
89
|
+
Unable to find dm library.
|
90
|
+
|
91
|
+
pelease set library paths manually with:
|
92
|
+
gem install dm -- --with-dm-include=/path/to/DPI.h/ --with-pg-lib=/path/to/libdmdpi.so/
|
93
|
+
|
94
|
+
EOT
|
95
|
+
raise
|
96
|
+
end
|
97
|
+
|
98
|
+
if /mingw/ =~ RUBY_PLATFORM && RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
|
99
|
+
# Work around: https://sourceware.org/bugzilla/show_bug.cgi?id=22504
|
100
|
+
checking_for "workaround gcc version with link issue" do
|
101
|
+
`#{RbConfig::MAKEFILE_CONFIG['CC']} --version`.chomp =~ /\s(\d+)\.\d+\.\d+(\s|$)/ &&
|
102
|
+
$1.to_i >= 6 &&
|
103
|
+
have_library(':dmdpi.lib') # Prefer linking to libpq.lib over libpq.dll if available
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
have_func 'timegm'
|
108
|
+
have_func 'rb_gc_adjust_memory_usage' # since ruby-2.4
|
109
|
+
have_func 'rb_gc_mark_movable' # since ruby-2.7
|
110
|
+
have_func 'rb_io_wait' # since ruby-3.0
|
111
|
+
have_func 'rb_io_descriptor' # since ruby-3.1
|
112
|
+
|
113
|
+
# unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
|
114
|
+
have_header 'unistd.h'
|
115
|
+
have_header 'inttypes.h'
|
116
|
+
have_header('ruby/fiber/scheduler.h') if RUBY_PLATFORM=~/mingw|mswin/
|
117
|
+
checking_for "C99 variable length arrays" do
|
118
|
+
$defs.push( "-DHAVE_VARIABLE_LENGTH_ARRAYS" ) if try_compile('void test_vla(int l){ int vla[l]; }')
|
119
|
+
end
|
120
|
+
|
121
|
+
create_header()
|
122
|
+
create_makefile( "dm/dm_ext" )
|
123
|
+
|