intersys 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/Makefile +143 -0
- data/lib/common.c +3 -7
- data/lib/common.o +0 -0
- data/lib/database.c +3 -2
- data/lib/database.o +0 -0
- data/lib/definition.c +120 -112
- data/lib/definition.o +0 -0
- data/lib/extconf.rb +23 -4
- data/lib/intersys.c +3 -15
- data/lib/intersys.h +9 -5
- data/lib/intersys.o +0 -0
- data/lib/intersys.rb +83 -62
- data/lib/intersys_cache.bundle +0 -0
- data/lib/mkmf.log +177 -0
- data/lib/object.c +2 -4
- data/lib/object.o +0 -0
- data/lib/query.c +15 -1
- data/lib/query.o +0 -0
- data/lib/test.rb +15 -0
- data/test/object.rb +14 -4
- data/test/query.rb +1 -0
- data/test/reflection.rb +12 -13
- metadata +12 -2
data/lib/object.c
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
static void intersys_object_free(struct rbObject* object) {
|
5
|
-
// printf("Releasing object %d\n", object->oref);
|
6
5
|
if (object->oref) {
|
7
6
|
RUN(cbind_object_release(object->database, object->oref));
|
8
7
|
}
|
@@ -23,12 +22,11 @@ VALUE intersys_object_s_allocate(VALUE klass) {
|
|
23
22
|
VALUE intersys_object_initialize(VALUE self) {
|
24
23
|
struct rbObject* object;
|
25
24
|
struct rbDatabase* base;
|
26
|
-
VALUE
|
27
|
-
VALUE database = rb_funcall(klass, rb_intern("database"), 0);
|
25
|
+
VALUE database = rb_funcall(rb_obj_class(self), rb_intern("database"), 0);
|
28
26
|
Data_Get_Struct(self, struct rbObject, object);
|
29
27
|
Data_Get_Struct(database, struct rbDatabase, base);
|
30
28
|
object->database = base->database;
|
31
|
-
object->class_name = TOWCHAR(rb_funcall(
|
29
|
+
object->class_name = TOWCHAR(rb_funcall(rb_obj_class(self), rb_intern("class_name"), 0));
|
32
30
|
return self;
|
33
31
|
}
|
34
32
|
|
data/lib/object.o
ADDED
Binary file
|
data/lib/query.c
CHANGED
@@ -1,9 +1,22 @@
|
|
1
1
|
#include "intersys.h"
|
2
|
+
#ifdef __CYGWIN__
|
3
|
+
#include <windef.h>
|
4
|
+
#endif
|
2
5
|
#include <sql.h>
|
3
6
|
#include <sqlext.h>
|
4
7
|
#include <sqlucode.h>
|
5
8
|
|
9
|
+
static void query_close(struct rbQuery* query) {
|
10
|
+
printf("Trying to close query (%d,%d)\n", query->closed, query->executed);
|
11
|
+
if(!query->closed && query->executed) {
|
12
|
+
printf("Closing query\n");
|
13
|
+
RUN(cbind_query_close(query->query));
|
14
|
+
query->closed = 1;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
6
18
|
void intersys_query_free(struct rbQuery* query) {
|
19
|
+
query_close(query);
|
7
20
|
RUN(cbind_free_query(query->query));
|
8
21
|
free(query);
|
9
22
|
}
|
@@ -32,6 +45,7 @@ VALUE intersys_query_execute(VALUE self) {
|
|
32
45
|
Data_Get_Struct(self, struct rbQuery, query);
|
33
46
|
RUN(cbind_query_execute(query->query, &sql_code));
|
34
47
|
RUN(cbind_query_get_num_pars(query->query, &res));
|
48
|
+
query->executed = 1;
|
35
49
|
return self;
|
36
50
|
}
|
37
51
|
|
@@ -148,6 +162,6 @@ VALUE intersys_query_fetch(VALUE self) {
|
|
148
162
|
VALUE intersys_query_close(VALUE self) {
|
149
163
|
struct rbQuery* query;
|
150
164
|
Data_Get_Struct(self, struct rbQuery, query);
|
151
|
-
|
165
|
+
query_close(query);
|
152
166
|
return self;
|
153
167
|
}
|
data/lib/query.o
ADDED
Binary file
|
data/lib/test.rb
ADDED
@@ -0,0 +1,15 @@
|
|
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.method("%OpenId", nil)
|
9
|
+
end
|
10
|
+
def class_mtd
|
11
|
+
my_mtd.class_method?
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
Person.intersys_call("%OpenId", 20)
|
data/test/object.rb
CHANGED
@@ -7,11 +7,21 @@ end
|
|
7
7
|
|
8
8
|
class QueryTest < Test::Unit::TestCase
|
9
9
|
def test_open_and_save
|
10
|
-
@p = Person.open(21)
|
11
10
|
@name = "Anni Fyo"
|
11
|
+
@id = 26001
|
12
|
+
#assert Person.intersys_call("Populate", 1000)
|
13
|
+
assert @p = Person.open(@id)
|
12
14
|
@p.name = @name
|
13
|
-
@p.save
|
14
|
-
@p =
|
15
|
+
assert @p.save
|
16
|
+
assert @p = Person.open(@id)
|
15
17
|
assert_equal @name, @p.name
|
18
|
+
assert Person.intersys_call("%DeleteExtent")
|
16
19
|
end
|
17
|
-
|
20
|
+
|
21
|
+
def test_create
|
22
|
+
assert @p = Person.intersys_call("%New")
|
23
|
+
@p.name = "Test user"
|
24
|
+
assert @p.save
|
25
|
+
puts @p.id
|
26
|
+
end
|
27
|
+
end
|
data/test/query.rb
CHANGED
data/test/reflection.rb
CHANGED
@@ -2,9 +2,12 @@ require 'test/unit'
|
|
2
2
|
require File.dirname(__FILE__) + '/../lib/intersys'
|
3
3
|
|
4
4
|
|
5
|
-
class
|
5
|
+
class MyTest < Intersys::Object
|
6
6
|
prefix "Sample"
|
7
7
|
end
|
8
|
+
|
9
|
+
class Article < Intersys::Object
|
10
|
+
end
|
8
11
|
class Person < Intersys::Object
|
9
12
|
end
|
10
13
|
|
@@ -14,17 +17,17 @@ class ReflectionTest < Test::Unit::TestCase
|
|
14
17
|
assert_equal "%Dictionary.ClassDefinition", @cdef.name
|
15
18
|
assert_equal "persistent", @cdef.class_type
|
16
19
|
assert_equal "%Persistent,%Dictionary.ClassDefinitionQuery", @cdef.super
|
17
|
-
|
18
|
-
|
20
|
+
assert 50 < @cdef.properties.size
|
21
|
+
assert 10 < @cdef._methods.size
|
19
22
|
end
|
20
23
|
|
21
24
|
def test_class_names
|
22
|
-
assert_equal
|
23
|
-
assert_equal Person,
|
25
|
+
assert_equal MyTest, MyTest.lookup("Sample.MyTest")
|
26
|
+
assert_equal Person, Person.lookup("User.Person")
|
24
27
|
end
|
25
28
|
|
26
29
|
def test_class_create
|
27
|
-
@cdef = Intersys::Reflection::ClassDefinition.call("%New", "User.
|
30
|
+
@cdef = Intersys::Reflection::ClassDefinition.call("%New", "User.Article")
|
28
31
|
@cdef.class_type = "persistent"
|
29
32
|
@cdef.super = "%Persistent,%Populate,%XML.Adaptor"
|
30
33
|
@props = @cdef.properties
|
@@ -53,13 +56,9 @@ class ReflectionTest < Test::Unit::TestCase
|
|
53
56
|
assert @props << @prop
|
54
57
|
@prop.type = "Sample.Address"
|
55
58
|
|
56
|
-
assert_equal "User.
|
59
|
+
assert_equal "User.Article", @cdef.name
|
57
60
|
assert_equal 6, @cdef.properties.size
|
58
61
|
#@cdef.save
|
59
62
|
end
|
60
|
-
|
61
|
-
|
62
|
-
assert Person.intersys_call("Populate", 1000)
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
63
|
+
end
|
64
|
+
|
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.0.
|
7
|
-
date: 2006-09-
|
6
|
+
version: 0.0.4
|
7
|
+
date: 2006-09-08 00:00:00 +04:00
|
8
8
|
summary: Intersystems Cache ruby driver
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -33,14 +33,24 @@ files:
|
|
33
33
|
- test/reflection.rb
|
34
34
|
- test/strings.rb
|
35
35
|
- lib/common.c
|
36
|
+
- lib/common.o
|
36
37
|
- lib/database.c
|
38
|
+
- lib/database.o
|
37
39
|
- lib/definition.c
|
40
|
+
- lib/definition.o
|
38
41
|
- lib/extconf.rb
|
39
42
|
- lib/intersys.c
|
40
43
|
- lib/intersys.h
|
44
|
+
- lib/intersys.o
|
41
45
|
- lib/intersys.rb
|
46
|
+
- lib/intersys_cache.bundle
|
47
|
+
- lib/Makefile
|
48
|
+
- lib/mkmf.log
|
42
49
|
- lib/object.c
|
50
|
+
- lib/object.o
|
43
51
|
- lib/query.c
|
52
|
+
- lib/query.o
|
53
|
+
- lib/test.rb
|
44
54
|
- README
|
45
55
|
test_files: []
|
46
56
|
|