swift-db-postgres 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.2.1 (2012-07-30)
2
+
3
+ * rb_protect yielding result tuples.
4
+
1
5
  == 0.2.0 (2012-07-29)
2
6
 
3
7
  * Added Adapter#native_bind_format and Adapter#native_bind_format=
@@ -32,11 +32,9 @@ Result* db_postgres_result_handle(VALUE self) {
32
32
  void db_postgres_result_mark(Result *r) {
33
33
  if (r) {
34
34
  if (r->fields)
35
- rb_gc_mark_maybe(r->fields);
35
+ rb_gc_mark(r->fields);
36
36
  if (r->types)
37
- rb_gc_mark_maybe(r->types);
38
- if (r->rows)
39
- rb_gc_mark_maybe(r->rows);
37
+ rb_gc_mark(r->types);
40
38
  }
41
39
  }
42
40
 
@@ -61,7 +59,6 @@ VALUE db_postgres_result_load(VALUE self, PGresult *result) {
61
59
  Result *r = db_postgres_result_handle(self);
62
60
  r->fields = rb_ary_new();
63
61
  r->types = rb_ary_new();
64
- r->rows = rb_ary_new();
65
62
  r->result = result;
66
63
  r->affected = atol(PQcmdTuples(result));
67
64
  r->selected = PQntuples(result);
@@ -101,7 +98,7 @@ VALUE db_postgres_result_load(VALUE self, PGresult *result) {
101
98
  }
102
99
 
103
100
  VALUE db_postgres_result_each(VALUE self) {
104
- int row, col;
101
+ int row, col, status;
105
102
  Result *r = db_postgres_result_handle(self);
106
103
 
107
104
  if (!r->result)
@@ -124,7 +121,11 @@ VALUE db_postgres_result_each(VALUE self) {
124
121
  );
125
122
  }
126
123
  }
127
- rb_yield(tuple);
124
+ rb_gc_register_address(&tuple);
125
+ rb_protect(rb_yield, tuple, &status);
126
+ rb_gc_unregister_address(&tuple);
127
+ if (status != 0)
128
+ rb_jump_tag(status);
128
129
  }
129
130
  return Qtrue;
130
131
  }
@@ -38,7 +38,7 @@ Statement* db_postgres_statement_handle_safe(VALUE self) {
38
38
 
39
39
  void db_postgres_statement_mark(Statement *s) {
40
40
  if (s && s->adapter)
41
- rb_gc_mark_maybe(s->adapter);
41
+ rb_gc_mark(s->adapter);
42
42
  }
43
43
 
44
44
  VALUE db_postgres_statement_deallocate(Statement *s) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swift-db-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-29 00:00:00.000000000 Z
12
+ date: 2012-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake