intersys 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/Makefile +9 -9
- data/lib/callable.rb +86 -0
- data/lib/database.c +21 -1
- data/lib/extconf.rb +33 -9
- data/lib/global.c +66 -0
- data/lib/intersys.c +24 -3
- data/lib/intersys.h +29 -2
- data/lib/intersys.rb +59 -350
- data/lib/intersys_adapter.rb +132 -0
- data/lib/object.rb +163 -0
- data/lib/query.c +143 -3
- data/lib/reflection.rb +113 -0
- data/lib/sql_include/iodbcunix.h +149 -0
- data/lib/sql_include/sql.h +1189 -0
- data/lib/sql_include/sqlext.h +2566 -0
- data/lib/sql_include/sqltypes.h +421 -0
- data/lib/sql_include/sqlucode.h +812 -0
- data/test/adapter.rb +19 -0
- data/test/global.rb +12 -0
- data/test/query.rb +5 -0
- data/test/reflection.rb +7 -6
- data/test/strings.rb +2 -1
- metadata +15 -3
- data/lib/test.rb +0 -30
data/test/adapter.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.dirname(__FILE__) + '/../lib/intersys'
|
3
|
+
require File.dirname(__FILE__) + '/../lib/intersys_adapter'
|
4
|
+
|
5
|
+
class QueryTest < Test::Unit::TestCase
|
6
|
+
def test_adapter
|
7
|
+
@database = Intersys::Database.new({})
|
8
|
+
@adapter = ActiveRecord::ConnectionAdapters::IntersysAdapter.new(@database, nil, {})
|
9
|
+
|
10
|
+
assert_equal 'Intersys Caché', @adapter.adapter_name
|
11
|
+
assert !@adapter.supports_migrations?
|
12
|
+
#assert @adapter.active?
|
13
|
+
assert @adapter.reconnect!
|
14
|
+
assert @cols = @adapter.columns("person")
|
15
|
+
assert @cols.last.name
|
16
|
+
assert @cols.last.klass
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/test/global.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.dirname(__FILE__) + '/../lib/intersys'
|
3
|
+
|
4
|
+
class GlobalTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_global
|
7
|
+
assert @g = Intersys::Global.new("^Employees")
|
8
|
+
@name = "John Smith"
|
9
|
+
assert_equal @name, (@g["OIT", "Database", "manager"] = @name)
|
10
|
+
assert_nil @g["OIT", "Database", "manager"]
|
11
|
+
end
|
12
|
+
end
|
data/test/query.rb
CHANGED
@@ -43,4 +43,9 @@ class QueryTest < Test::Unit::TestCase
|
|
43
43
|
assert @db.query("select %Id,name,DOB1 from sample.person")
|
44
44
|
@db.rollback
|
45
45
|
end
|
46
|
+
|
47
|
+
def test_limit_offset
|
48
|
+
@db = Intersys::Database.new({})
|
49
|
+
assert @db.query("select * from sample.person limit 4 offset 2")
|
50
|
+
end
|
46
51
|
end
|
data/test/reflection.rb
CHANGED
@@ -32,27 +32,27 @@ class ReflectionTest < Test::Unit::TestCase
|
|
32
32
|
@cdef.super = "%Persistent,%Populate,%XML.Adaptor"
|
33
33
|
@props = @cdef.properties
|
34
34
|
|
35
|
-
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "
|
35
|
+
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "Article:Name")
|
36
36
|
assert @props << @prop
|
37
37
|
@prop.type = "%String"
|
38
38
|
|
39
|
-
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "
|
39
|
+
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "Article:SSN")
|
40
40
|
assert @props << @prop
|
41
41
|
@prop.type = "%String"
|
42
42
|
|
43
|
-
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "
|
43
|
+
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "Article:Title")
|
44
44
|
assert @props << @prop
|
45
45
|
@prop.type = "%String"
|
46
46
|
|
47
|
-
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "
|
47
|
+
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "Article:DOB")
|
48
48
|
assert @props << @prop
|
49
49
|
@prop.type = "%String"
|
50
50
|
|
51
|
-
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "
|
51
|
+
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "Article:Home")
|
52
52
|
assert @props << @prop
|
53
53
|
@prop.type = "Sample.Address"
|
54
54
|
|
55
|
-
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "
|
55
|
+
@prop = Intersys::Reflection::PropertyDefinition.intersys_call("%New", "Article:Business")
|
56
56
|
assert @props << @prop
|
57
57
|
@prop.type = "Sample.Address"
|
58
58
|
|
@@ -60,5 +60,6 @@ class ReflectionTest < Test::Unit::TestCase
|
|
60
60
|
assert_equal 6, @cdef.properties.size
|
61
61
|
#@cdef.save
|
62
62
|
end
|
63
|
+
|
63
64
|
end
|
64
65
|
|
data/test/strings.rb
CHANGED
@@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/../lib/intersys'
|
|
3
3
|
|
4
4
|
class StringTest < Test::Unit::TestCase
|
5
5
|
@@wide_string = "\000\000\000a\000\000\000b\000\000\000c\000\000\000\000"
|
6
|
+
@@wide_string = "abc".to_wchar
|
6
7
|
@@simple_string = "abc"
|
7
8
|
def test_from_wchar
|
8
9
|
assert_equal @@simple_string, @@wide_string.from_wchar
|
@@ -19,4 +20,4 @@ class StringTest < Test::Unit::TestCase
|
|
19
20
|
def test_stress
|
20
21
|
assert_equal @@simple_string, @@simple_string.to_wchar.from_wchar.to_wchar.from_wchar
|
21
22
|
end
|
22
|
-
end
|
23
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: intersys
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "0.
|
7
|
-
date: 2006-09-
|
6
|
+
version: "0.2"
|
7
|
+
date: 2006-09-16 00:00:00 +04:00
|
8
8
|
summary: Intersystems Cache ruby driver
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -28,21 +28,33 @@ cert_chain:
|
|
28
28
|
authors:
|
29
29
|
- Max Lapshin
|
30
30
|
files:
|
31
|
+
- test/adapter.rb
|
32
|
+
- test/global.rb
|
31
33
|
- test/object.rb
|
32
34
|
- test/query.rb
|
33
35
|
- test/reflection.rb
|
34
36
|
- test/strings.rb
|
37
|
+
- lib/callable.rb
|
35
38
|
- lib/common.c
|
36
39
|
- lib/database.c
|
37
40
|
- lib/definition.c
|
38
41
|
- lib/extconf.rb
|
42
|
+
- lib/global.c
|
39
43
|
- lib/intersys.c
|
40
44
|
- lib/intersys.h
|
41
45
|
- lib/intersys.rb
|
46
|
+
- lib/intersys_adapter.rb
|
42
47
|
- lib/Makefile
|
43
48
|
- lib/object.c
|
49
|
+
- lib/object.rb
|
44
50
|
- lib/query.c
|
45
|
-
- lib/
|
51
|
+
- lib/reflection.rb
|
52
|
+
- lib/sql_include
|
53
|
+
- lib/sql_include/iodbcunix.h
|
54
|
+
- lib/sql_include/sql.h
|
55
|
+
- lib/sql_include/sqlext.h
|
56
|
+
- lib/sql_include/sqltypes.h
|
57
|
+
- lib/sql_include/sqlucode.h
|
46
58
|
- README
|
47
59
|
test_files: []
|
48
60
|
|
data/lib/test.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'intersys'
|
2
|
-
|
3
|
-
class Person < Intersys::Object
|
4
|
-
end
|
5
|
-
|
6
|
-
#puts Person.intersys_methods
|
7
|
-
def my_mtd
|
8
|
-
#Intersys::Reflection::ClassDefinition.intersys_method("%OpenId")
|
9
|
-
Person.intersys_method("%Delete")
|
10
|
-
end
|
11
|
-
def class_mtd
|
12
|
-
my_mtd.class_method?
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
@p = Person.intersys_call("%New")
|
17
|
-
|
18
|
-
require 'profiler'
|
19
|
-
Profiler__::start_profile
|
20
|
-
|
21
|
-
@p.name = "Test user"
|
22
|
-
puts @p.id
|
23
|
-
@p.save
|
24
|
-
puts @p.id
|
25
|
-
@p.destroy
|
26
|
-
|
27
|
-
File.open("desc","w+") {|f| f.write Person.intersys_description }
|
28
|
-
|
29
|
-
Profiler__::stop_profile
|
30
|
-
File.open("profile", "w+") {|f| Profiler__::print_profile(f)}
|