ibm_db 1.5.0-mswin32 → 2.0.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +4 -0
- data/LICENSE +1 -1
- data/ParameterizedQueries README +39 -0
- data/README +1 -1
- data/ext/ibm_db.c +663 -436
- data/ext/ruby_ibm_db.h +6 -2
- data/ext/ruby_ibm_db_cli.c +3 -3
- data/ext/ruby_ibm_db_cli.h +17 -8
- data/lib/IBM_DB.rb +1 -1
- data/lib/active_record/connection_adapters/ibm_db_adapter.rb +383 -70
- data/lib/active_record/connection_adapters/ibm_db_pstmt.rb +1902 -0
- data/lib/mswin32/ibm_db.so +0 -0
- data/test/cases/calculations_test.rb +5 -1
- data/test/cases/helper.rb +75 -0
- data/test/connections/native_ibm_db/connection.rb +26 -24
- data/test/schema/schema.rb +1 -0
- metadata +5 -3
- data/ext/mkmf.log +0 -45
data/lib/mswin32/ibm_db.so
CHANGED
Binary file
|
@@ -168,7 +168,11 @@ class CalculationsTest < ActiveRecord::TestCase
|
|
168
168
|
end
|
169
169
|
|
170
170
|
def test_should_group_by_association_with_non_numeric_foreign_key
|
171
|
-
ActiveRecord::Base.connection.
|
171
|
+
if( ActiveRecord::Base.connection.respond_to?(:pstmt_support_on) && ActiveRecord::Base.connection.pstmt_support_on == true )
|
172
|
+
ActiveRecord::Base.connection.expects(:prepared_select).returns([{"count_all" => 1, "firm_id" => "ABC"}])
|
173
|
+
else
|
174
|
+
ActiveRecord::Base.connection.expects(:select_all).returns([{"count_all" => 1, "firm_id" => "ABC"}])
|
175
|
+
end
|
172
176
|
|
173
177
|
firm = mock()
|
174
178
|
firm.expects(:id).returns("ABC")
|
@@ -0,0 +1,75 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib')
|
3
|
+
|
4
|
+
require 'config'
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'test/unit'
|
8
|
+
require 'stringio'
|
9
|
+
|
10
|
+
require 'active_record'
|
11
|
+
require 'active_record/test_case'
|
12
|
+
require 'active_record/fixtures'
|
13
|
+
require 'connection'
|
14
|
+
|
15
|
+
require 'cases/repair_helper'
|
16
|
+
|
17
|
+
# Show backtraces for deprecated behavior for quicker cleanup.
|
18
|
+
ActiveSupport::Deprecation.debug = true
|
19
|
+
|
20
|
+
# Quote "type" if it's a reserved word for the current connection.
|
21
|
+
QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type')
|
22
|
+
|
23
|
+
def current_adapter?(*types)
|
24
|
+
types.any? do |type|
|
25
|
+
ActiveRecord::ConnectionAdapters.const_defined?(type) &&
|
26
|
+
ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters.const_get(type))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
ActiveRecord::Base.connection.class.class_eval do
|
31
|
+
IGNORED_SQL = [/^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/, /SHOW FIELDS/]
|
32
|
+
|
33
|
+
def execute_with_query_record(sql, name = nil, &block)
|
34
|
+
$queries_executed ||= []
|
35
|
+
$queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r }
|
36
|
+
execute_without_query_record(sql, name, &block)
|
37
|
+
end
|
38
|
+
|
39
|
+
def execute_prepared_stmt_with_query_record(pstmt, param_array = nil)
|
40
|
+
$queries_executed ||= []
|
41
|
+
$queries_executed << "#{@prepared_sql} + #{param_array}" unless IGNORED_SQL.any? { |r| @prepared_sql =~ r }
|
42
|
+
execute_prepared_stmt_without_query_record(pstmt, param_array)
|
43
|
+
end
|
44
|
+
|
45
|
+
alias_method_chain :execute, :query_record
|
46
|
+
alias_method_chain :execute_prepared_stmt, :query_record
|
47
|
+
end
|
48
|
+
|
49
|
+
# Make with_scope public for tests
|
50
|
+
class << ActiveRecord::Base
|
51
|
+
public :with_scope, :with_exclusive_scope
|
52
|
+
end
|
53
|
+
|
54
|
+
unless ENV['FIXTURE_DEBUG']
|
55
|
+
module ActiveRecord::TestFixtures::ClassMethods
|
56
|
+
def try_to_load_dependency_with_silence(*args)
|
57
|
+
ActiveRecord::Base.logger.silence { try_to_load_dependency_without_silence(*args)}
|
58
|
+
end
|
59
|
+
|
60
|
+
alias_method_chain :try_to_load_dependency, :silence
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class ActiveSupport::TestCase
|
65
|
+
include ActiveRecord::TestFixtures
|
66
|
+
include ActiveRecord::Testing::RepairHelper
|
67
|
+
|
68
|
+
self.fixture_path = FIXTURES_ROOT
|
69
|
+
self.use_instantiated_fixtures = false
|
70
|
+
self.use_transactional_fixtures = true
|
71
|
+
|
72
|
+
def create_fixtures(*table_names, &block)
|
73
|
+
Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names, {}, &block)
|
74
|
+
end
|
75
|
+
end
|
@@ -7,32 +7,34 @@ ActiveRecord::Base.logger.level = Logger::FATAL
|
|
7
7
|
|
8
8
|
ActiveRecord::Base.configurations = {
|
9
9
|
'arunit' => {
|
10
|
-
:adapter
|
11
|
-
:username
|
12
|
-
:password
|
13
|
-
:host
|
14
|
-
:port
|
15
|
-
:schema
|
16
|
-
:account
|
17
|
-
:app_user
|
18
|
-
:application
|
19
|
-
:workstation
|
20
|
-
:start_id
|
21
|
-
:database
|
10
|
+
:adapter => 'ibm_db',
|
11
|
+
:username => 'db2user',
|
12
|
+
:password => 'secret',
|
13
|
+
:host => 'bilbao',
|
14
|
+
:port => '50000',
|
15
|
+
:schema => 'rails123',
|
16
|
+
:account => 'tester',
|
17
|
+
:app_user => 'tester_11',
|
18
|
+
:application => 'rails_tests',
|
19
|
+
:workstation => 'auckland',
|
20
|
+
:start_id => 100,
|
21
|
+
:database => 'ARUNIT',
|
22
|
+
:parameterized => false
|
22
23
|
},
|
23
24
|
'arunit2' => {
|
24
|
-
:adapter
|
25
|
-
:username
|
26
|
-
:password
|
27
|
-
:host
|
28
|
-
:port
|
29
|
-
:schema
|
30
|
-
:account
|
31
|
-
:app_user
|
32
|
-
:application
|
33
|
-
:workstation
|
34
|
-
:start_id
|
35
|
-
:database
|
25
|
+
:adapter => 'ibm_db',
|
26
|
+
:username => 'db2user',
|
27
|
+
:password => 'secret',
|
28
|
+
:host => 'bilbao',
|
29
|
+
:port => '50000',
|
30
|
+
:schema => 'rails123',
|
31
|
+
:account => 'tester',
|
32
|
+
:app_user => 'tester_11',
|
33
|
+
:application => 'rails_tests',
|
34
|
+
:workstation => 'auckland',
|
35
|
+
:start_id => 100,
|
36
|
+
:database => 'ARUNIT2',
|
37
|
+
:parameterized => false
|
36
38
|
}
|
37
39
|
}
|
38
40
|
|
data/test/schema/schema.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibm_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: mswin32
|
6
6
|
authors:
|
7
7
|
- IBM
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-21 00:00:00 +05:30
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -37,17 +37,18 @@ files:
|
|
37
37
|
- ext/extconf.rb
|
38
38
|
- ext/ibm_db.c
|
39
39
|
- ext/Makefile.nt32
|
40
|
-
- ext/mkmf.log
|
41
40
|
- ext/ruby_ibm_db.h
|
42
41
|
- ext/ruby_ibm_db_cli.c
|
43
42
|
- ext/ruby_ibm_db_cli.h
|
44
43
|
- init.rb
|
45
44
|
- lib/active_record/connection_adapters/ibm_db_adapter.rb
|
45
|
+
- lib/active_record/connection_adapters/ibm_db_pstmt.rb
|
46
46
|
- lib/active_record/vendor/db2-i5-zOS.yaml
|
47
47
|
- lib/IBM_DB.rb
|
48
48
|
- lib/mswin32/ibm_db.so
|
49
49
|
- LICENSE
|
50
50
|
- MANIFEST
|
51
|
+
- ParameterizedQueries README
|
51
52
|
- README
|
52
53
|
- test/cases/adapter_test.rb
|
53
54
|
- test/cases/associations/cascaded_eager_loading_test.rb
|
@@ -60,6 +61,7 @@ files:
|
|
60
61
|
- test/cases/calculations_test.rb
|
61
62
|
- test/cases/finder_test.rb
|
62
63
|
- test/cases/fixtures_test.rb
|
64
|
+
- test/cases/helper.rb
|
63
65
|
- test/cases/migration_test.rb
|
64
66
|
- test/cases/schema_dumper_test.rb
|
65
67
|
- test/cases/validations_test.rb
|
data/ext/mkmf.log
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
have_library: checking for SQLConnect() in db2cli.lib... -------------------- yes
|
2
|
-
|
3
|
-
"cl -nologo -Feconftest -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -IC:/Progra~1/IBM/SQLLIB/include -MD -Zi -O2b2xg- -G6 conftest.c msvcrt-ruby18-static.lib db2cli.lib oldnames.lib user32.lib advapi32.lib ws2_32.lib -link -libpath:"." -libpath:"c:/ruby/lib" -libpath:"C:/Progra~1/IBM/SQLLIB/lib" -stack:0x2000000"
|
4
|
-
cl : Command line warning D9035 : option 'Og-' has been deprecated and will be removed in a future release
|
5
|
-
cl : Command line warning D9002 : ignoring unknown option '-G6'
|
6
|
-
conftest.c
|
7
|
-
conftest.c(7) : error C2065: 'SQLConnect' : undeclared identifier
|
8
|
-
checked program was:
|
9
|
-
/* begin */
|
10
|
-
1: #define WIN32_LEAN_AND_MEAN
|
11
|
-
2: #include <winsock2.h>
|
12
|
-
3: #include <windows.h>
|
13
|
-
4:
|
14
|
-
5: /*top*/
|
15
|
-
6: int main() { return 0; }
|
16
|
-
7: int t() { void ((*volatile p)()); p = (void ((*)()))SQLConnect; return 0; }
|
17
|
-
/* end */
|
18
|
-
|
19
|
-
"cl -nologo -Feconftest -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -IC:/Progra~1/IBM/SQLLIB/include -MD -Zi -O2b2xg- -G6 conftest.c msvcrt-ruby18-static.lib db2cli.lib oldnames.lib user32.lib advapi32.lib ws2_32.lib -link -libpath:"." -libpath:"c:/ruby/lib" -libpath:"C:/Progra~1/IBM/SQLLIB/lib" -stack:0x2000000"
|
20
|
-
cl : Command line warning D9035 : option 'Og-' has been deprecated and will be removed in a future release
|
21
|
-
cl : Command line warning D9002 : ignoring unknown option '-G6'
|
22
|
-
conftest.c
|
23
|
-
checked program was:
|
24
|
-
/* begin */
|
25
|
-
1: /*top*/
|
26
|
-
2: int main() { return 0; }
|
27
|
-
3: int t() { SQLConnect(); return 0; }
|
28
|
-
/* end */
|
29
|
-
|
30
|
-
--------------------
|
31
|
-
|
32
|
-
have_header: checking for gil_release_version... -------------------- no
|
33
|
-
|
34
|
-
"cl -nologo -E -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -IC:/Progra~1/IBM/SQLLIB/include -MD -Zi -O2b2xg- -G6 conftest.c -P"
|
35
|
-
cl : Command line warning D9035 : option 'Og-' has been deprecated and will be removed in a future release
|
36
|
-
cl : Command line warning D9002 : ignoring unknown option '-G6'
|
37
|
-
conftest.c
|
38
|
-
conftest.c(1) : fatal error C1083: Cannot open include file: 'gil_release_version': No such file or directory
|
39
|
-
checked program was:
|
40
|
-
/* begin */
|
41
|
-
1: #include <gil_release_version>
|
42
|
-
/* end */
|
43
|
-
|
44
|
-
--------------------
|
45
|
-
|