do_postgres 0.10.10 → 0.10.11
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.markdown +4 -0
- data/ext/do_postgres/do_common.c +43 -43
- data/ext/do_postgres/do_common.h +9 -10
- data/ext/do_postgres/do_postgres.c +41 -41
- data/lib/do_postgres/version.rb +1 -1
- data/tasks/compile.rake +1 -1
- metadata +5 -5
data/ChangeLog.markdown
CHANGED
data/ext/do_postgres/do_common.c
CHANGED
@@ -11,13 +11,13 @@
|
|
11
11
|
*/
|
12
12
|
|
13
13
|
// To store rb_intern values
|
14
|
-
ID
|
15
|
-
ID
|
16
|
-
ID
|
17
|
-
ID
|
18
|
-
ID
|
19
|
-
ID
|
20
|
-
ID
|
14
|
+
ID DO_ID_NEW;
|
15
|
+
ID DO_ID_NEW_DATE;
|
16
|
+
ID DO_ID_CONST_GET;
|
17
|
+
ID DO_ID_RATIONAL;
|
18
|
+
ID DO_ID_ESCAPE;
|
19
|
+
ID DO_ID_STRFTIME;
|
20
|
+
ID DO_ID_LOG;
|
21
21
|
|
22
22
|
// Reference to Extlib module
|
23
23
|
VALUE mExtlib;
|
@@ -33,8 +33,8 @@ VALUE cDO_Reader;
|
|
33
33
|
VALUE cDO_Logger;
|
34
34
|
VALUE cDO_Logger_Message;
|
35
35
|
VALUE cDO_Extension;
|
36
|
-
VALUE
|
37
|
-
VALUE
|
36
|
+
VALUE eDO_ConnectionError;
|
37
|
+
VALUE eDO_DataError;
|
38
38
|
|
39
39
|
// References to Ruby classes that we'll need
|
40
40
|
VALUE rb_cDate;
|
@@ -47,7 +47,7 @@ VALUE rb_cBigDecimal;
|
|
47
47
|
|
48
48
|
|
49
49
|
VALUE data_objects_const_get(VALUE scope, const char *constant) {
|
50
|
-
return rb_funcall(scope,
|
50
|
+
return rb_funcall(scope, DO_ID_CONST_GET, 1, rb_str_new2(constant));
|
51
51
|
}
|
52
52
|
|
53
53
|
void data_objects_debug(VALUE connection, VALUE string, struct timeval *start) {
|
@@ -58,9 +58,9 @@ void data_objects_debug(VALUE connection, VALUE string, struct timeval *start) {
|
|
58
58
|
gettimeofday(&stop, NULL);
|
59
59
|
duration = (stop.tv_sec - start->tv_sec) * 1000000 + stop.tv_usec - start->tv_usec;
|
60
60
|
|
61
|
-
message = rb_funcall(cDO_Logger_Message,
|
61
|
+
message = rb_funcall(cDO_Logger_Message, DO_ID_NEW, 3, string, rb_time_new(start->tv_sec, start->tv_usec), INT2NUM(duration));
|
62
62
|
|
63
|
-
rb_funcall(connection,
|
63
|
+
rb_funcall(connection, DO_ID_LOG, 1, message);
|
64
64
|
}
|
65
65
|
|
66
66
|
void data_objects_raise_error(VALUE self, const struct errcodes *errors, int errnum, const char *message, VALUE query, VALUE state) {
|
@@ -80,7 +80,7 @@ void data_objects_raise_error(VALUE self, const struct errcodes *errors, int err
|
|
80
80
|
|
81
81
|
exception = rb_funcall(
|
82
82
|
data_objects_const_get(mDO, exception_type),
|
83
|
-
|
83
|
+
DO_ID_NEW,
|
84
84
|
5,
|
85
85
|
rb_str_new2(message),
|
86
86
|
INT2NUM(errnum),
|
@@ -125,7 +125,7 @@ VALUE data_objects_build_query_from_args(VALUE klass, int count, VALUE *args) {
|
|
125
125
|
rb_ary_push(array, args[i]);
|
126
126
|
}
|
127
127
|
|
128
|
-
return rb_funcall(klass,
|
128
|
+
return rb_funcall(klass, DO_ID_ESCAPE, 1, array);
|
129
129
|
}
|
130
130
|
|
131
131
|
// Find the greatest common denominator and reduce the provided numerator and denominator.
|
@@ -163,7 +163,7 @@ VALUE data_objects_seconds_to_offset(long seconds_offset) {
|
|
163
163
|
do_int64 den = 86400;
|
164
164
|
|
165
165
|
data_objects_reduce(&num, &den);
|
166
|
-
return rb_funcall(rb_mKernel,
|
166
|
+
return rb_funcall(rb_mKernel, DO_ID_RATIONAL, 2, rb_ll2inum(num), rb_ll2inum(den));
|
167
167
|
}
|
168
168
|
|
169
169
|
VALUE data_objects_timezone_to_offset(int hour_offset, int minute_offset) {
|
@@ -189,7 +189,7 @@ VALUE data_objects_parse_date(const char *date) {
|
|
189
189
|
return Qnil;
|
190
190
|
}
|
191
191
|
|
192
|
-
return rb_funcall(rb_cDate,
|
192
|
+
return rb_funcall(rb_cDate, DO_ID_NEW, 3, INT2NUM(year), INT2NUM(month), INT2NUM(day));
|
193
193
|
}
|
194
194
|
|
195
195
|
VALUE data_objects_parse_time(const char *date) {
|
@@ -299,11 +299,11 @@ VALUE data_objects_parse_date_time(const char *date) {
|
|
299
299
|
break;
|
300
300
|
|
301
301
|
default: /* Any other combo of missing tokens and we can't do anything */
|
302
|
-
rb_raise(
|
302
|
+
rb_raise(eDO_DataError, "Couldn't parse date: %s", date);
|
303
303
|
}
|
304
304
|
|
305
305
|
offset = data_objects_timezone_to_offset(hour_offset, minute_offset);
|
306
|
-
return rb_funcall(rb_cDateTime,
|
306
|
+
return rb_funcall(rb_cDateTime, DO_ID_NEW, 7, INT2NUM(year), INT2NUM(month), INT2NUM(day),
|
307
307
|
INT2NUM(hour), INT2NUM(min), INT2NUM(sec), offset);
|
308
308
|
}
|
309
309
|
|
@@ -320,17 +320,17 @@ VALUE data_objects_cConnection_ssl_cipher(VALUE self) {
|
|
320
320
|
}
|
321
321
|
|
322
322
|
VALUE data_objects_cConnection_quote_time(VALUE self, VALUE value) {
|
323
|
-
return rb_funcall(value,
|
323
|
+
return rb_funcall(value, DO_ID_STRFTIME, 1, rb_str_new2("'%Y-%m-%d %H:%M:%S'"));
|
324
324
|
}
|
325
325
|
|
326
326
|
VALUE data_objects_cConnection_quote_date_time(VALUE self, VALUE value) {
|
327
327
|
// TODO: Support non-local dates. we need to call #new_offset on the date to be
|
328
328
|
// quoted and pass in the current locale's date offset (self.new_offset((hours * 3600).to_r / 86400)
|
329
|
-
return rb_funcall(value,
|
329
|
+
return rb_funcall(value, DO_ID_STRFTIME, 1, rb_str_new2("'%Y-%m-%d %H:%M:%S'"));
|
330
330
|
}
|
331
331
|
|
332
332
|
VALUE data_objects_cConnection_quote_date(VALUE self, VALUE value) {
|
333
|
-
return rb_funcall(value,
|
333
|
+
return rb_funcall(value, DO_ID_STRFTIME, 1, rb_str_new2("'%Y-%m-%d'"));
|
334
334
|
}
|
335
335
|
|
336
336
|
/*
|
@@ -379,7 +379,7 @@ VALUE data_objects_cReader_values(VALUE self) {
|
|
379
379
|
VALUE values = rb_iv_get(self, "@values");
|
380
380
|
|
381
381
|
if (state == Qnil || state == Qfalse || values == Qnil) {
|
382
|
-
rb_raise(
|
382
|
+
rb_raise(eDO_DataError, "Reader is not initialized");
|
383
383
|
}
|
384
384
|
|
385
385
|
return rb_iv_get(self, "@values");
|
@@ -400,24 +400,24 @@ void data_objects_common_init(void) {
|
|
400
400
|
rb_require("data_objects");
|
401
401
|
|
402
402
|
// Needed by data_objects_const_get
|
403
|
-
|
403
|
+
DO_ID_CONST_GET = rb_intern("const_get");
|
404
404
|
|
405
405
|
// Get references classes needed for Date/Time parsing
|
406
406
|
rb_cDate = data_objects_const_get(rb_mKernel, "Date");
|
407
407
|
rb_cDateTime = data_objects_const_get(rb_mKernel, "DateTime");
|
408
408
|
rb_cBigDecimal = data_objects_const_get(rb_mKernel, "BigDecimal");
|
409
409
|
|
410
|
-
|
410
|
+
DO_ID_NEW = rb_intern("new");
|
411
411
|
#ifdef RUBY_LESS_THAN_186
|
412
|
-
|
412
|
+
DO_ID_NEW_DATE = rb_intern("new0");
|
413
413
|
#else
|
414
|
-
|
414
|
+
DO_ID_NEW_DATE = rb_intern("new!");
|
415
415
|
#endif
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
416
|
+
DO_ID_CONST_GET = rb_intern("const_get");
|
417
|
+
DO_ID_RATIONAL = rb_intern("Rational");
|
418
|
+
DO_ID_ESCAPE = rb_intern("escape_sql");
|
419
|
+
DO_ID_STRFTIME = rb_intern("strftime");
|
420
|
+
DO_ID_LOG = rb_intern("log");
|
421
421
|
|
422
422
|
// Get references to the Extlib module
|
423
423
|
mExtlib = data_objects_const_get(rb_mKernel, "Extlib");
|
@@ -434,15 +434,15 @@ void data_objects_common_init(void) {
|
|
434
434
|
cDO_Logger_Message = data_objects_const_get(cDO_Logger, "Message");
|
435
435
|
cDO_Extension = data_objects_const_get(mDO, "Extension");
|
436
436
|
|
437
|
-
|
438
|
-
|
437
|
+
eDO_ConnectionError = data_objects_const_get(mDO, "ConnectionError");
|
438
|
+
eDO_DataError = data_objects_const_get(mDO, "DataError");
|
439
439
|
|
440
|
-
rb_global_variable(&
|
441
|
-
rb_global_variable(&
|
442
|
-
rb_global_variable(&
|
443
|
-
rb_global_variable(&
|
444
|
-
rb_global_variable(&
|
445
|
-
rb_global_variable(&
|
440
|
+
rb_global_variable(&DO_ID_NEW_DATE);
|
441
|
+
rb_global_variable(&DO_ID_RATIONAL);
|
442
|
+
rb_global_variable(&DO_ID_CONST_GET);
|
443
|
+
rb_global_variable(&DO_ID_ESCAPE);
|
444
|
+
rb_global_variable(&DO_ID_LOG);
|
445
|
+
rb_global_variable(&DO_ID_NEW);
|
446
446
|
|
447
447
|
rb_global_variable(&rb_cDate);
|
448
448
|
rb_global_variable(&rb_cDateTime);
|
@@ -452,8 +452,8 @@ void data_objects_common_init(void) {
|
|
452
452
|
rb_global_variable(&mDO);
|
453
453
|
rb_global_variable(&cDO_Logger_Message);
|
454
454
|
|
455
|
-
rb_global_variable(&
|
456
|
-
rb_global_variable(&
|
455
|
+
rb_global_variable(&eDO_ConnectionError);
|
456
|
+
rb_global_variable(&eDO_DataError);
|
457
457
|
|
458
458
|
tzset();
|
459
459
|
}
|
@@ -478,7 +478,7 @@ extern VALUE data_objects_typecast(const char *value, long length, const VALUE t
|
|
478
478
|
return rb_float_new(rb_cstr_to_dbl(value, Qfalse));
|
479
479
|
}
|
480
480
|
else if (type == rb_cBigDecimal) {
|
481
|
-
return rb_funcall(rb_cBigDecimal,
|
481
|
+
return rb_funcall(rb_cBigDecimal, DO_ID_NEW, 1, rb_str_new(value, length));
|
482
482
|
}
|
483
483
|
else if (type == rb_cDate) {
|
484
484
|
return data_objects_parse_date(value);
|
@@ -493,7 +493,7 @@ extern VALUE data_objects_typecast(const char *value, long length, const VALUE t
|
|
493
493
|
return (!value || strcmp("0", value) == 0) ? Qfalse : Qtrue;
|
494
494
|
}
|
495
495
|
else if (type == rb_cByteArray) {
|
496
|
-
return rb_funcall(rb_cByteArray,
|
496
|
+
return rb_funcall(rb_cByteArray, DO_ID_NEW, 1, rb_str_new(value, length));
|
497
497
|
}
|
498
498
|
else if (type == rb_cClass) {
|
499
499
|
return rb_funcall(mDO, rb_intern("full_const_get"), 1, rb_str_new(value, length));
|
data/ext/do_postgres/do_common.h
CHANGED
@@ -54,13 +54,13 @@ typedef signed long long int do_int64;
|
|
54
54
|
#endif
|
55
55
|
|
56
56
|
// To store rb_intern values
|
57
|
-
extern ID
|
58
|
-
extern ID
|
59
|
-
extern ID
|
60
|
-
extern ID
|
61
|
-
extern ID
|
62
|
-
extern ID
|
63
|
-
extern ID
|
57
|
+
extern ID DO_ID_NEW;
|
58
|
+
extern ID DO_ID_NEW_DATE;
|
59
|
+
extern ID DO_ID_CONST_GET;
|
60
|
+
extern ID DO_ID_RATIONAL;
|
61
|
+
extern ID DO_ID_ESCAPE;
|
62
|
+
extern ID DO_ID_STRFTIME;
|
63
|
+
extern ID DO_ID_LOG;
|
64
64
|
|
65
65
|
// Reference to Extlib module
|
66
66
|
extern VALUE mExtlib;
|
@@ -68,7 +68,6 @@ extern VALUE rb_cByteArray;
|
|
68
68
|
|
69
69
|
// References to DataObjects base classes
|
70
70
|
extern VALUE mDO;
|
71
|
-
extern VALUE mEncoding;
|
72
71
|
extern VALUE cDO_Quoting;
|
73
72
|
extern VALUE cDO_Connection;
|
74
73
|
extern VALUE cDO_Command;
|
@@ -77,8 +76,8 @@ extern VALUE cDO_Reader;
|
|
77
76
|
extern VALUE cDO_Logger;
|
78
77
|
extern VALUE cDO_Logger_Message;
|
79
78
|
extern VALUE cDO_Extension;
|
80
|
-
extern VALUE
|
81
|
-
extern VALUE
|
79
|
+
extern VALUE eDO_ConnectionError;
|
80
|
+
extern VALUE eDO_DataError;
|
82
81
|
|
83
82
|
// References to Ruby classes that we'll need
|
84
83
|
extern VALUE rb_cDate;
|
@@ -42,12 +42,12 @@
|
|
42
42
|
|
43
43
|
#include "do_common.h"
|
44
44
|
|
45
|
-
VALUE
|
46
|
-
VALUE
|
47
|
-
VALUE
|
48
|
-
VALUE
|
49
|
-
VALUE
|
50
|
-
VALUE
|
45
|
+
VALUE mDO_Postgres;
|
46
|
+
VALUE mDO_PostgresEncoding;
|
47
|
+
VALUE cDO_PostgresConnection;
|
48
|
+
VALUE cDO_PostgresCommand;
|
49
|
+
VALUE cDO_PostgresResult;
|
50
|
+
VALUE cDO_PostgresReader;
|
51
51
|
|
52
52
|
void do_postgres_full_connect(VALUE self, PGconn *db);
|
53
53
|
|
@@ -88,7 +88,7 @@ VALUE do_postgres_typecast(const char *value, long length, const VALUE type, int
|
|
88
88
|
else if (type == rb_cByteArray) {
|
89
89
|
size_t new_length = 0;
|
90
90
|
char *unescaped = (char *)PQunescapeBytea((unsigned char*)value, &new_length);
|
91
|
-
VALUE byte_array = rb_funcall(rb_cByteArray,
|
91
|
+
VALUE byte_array = rb_funcall(rb_cByteArray, DO_ID_NEW, 1, rb_str_new(unescaped, new_length));
|
92
92
|
|
93
93
|
PQfreemem(unescaped);
|
94
94
|
return byte_array;
|
@@ -155,7 +155,7 @@ VALUE do_postgres_cConnection_quote_string(VALUE self, VALUE string) {
|
|
155
155
|
quoted_length = PQescapeStringConn(db, escaped + 1, source, source_len, &error);
|
156
156
|
|
157
157
|
if(error) {
|
158
|
-
rb_raise(
|
158
|
+
rb_raise(eDO_DataError, "%s", PQerrorMessage(db));
|
159
159
|
}
|
160
160
|
|
161
161
|
// Wrap the escaped string in single-quotes, this is DO's convention
|
@@ -228,7 +228,7 @@ PGresult * do_postgres_cCommand_execute_sync(VALUE self, VALUE connection, PGcon
|
|
228
228
|
}
|
229
229
|
|
230
230
|
if(!response) {
|
231
|
-
rb_raise(
|
231
|
+
rb_raise(eDO_ConnectionError, PQerrorMessage(db));
|
232
232
|
}
|
233
233
|
}
|
234
234
|
|
@@ -264,7 +264,7 @@ PGresult * do_postgres_cCommand_execute_async(VALUE self, VALUE connection, PGco
|
|
264
264
|
}
|
265
265
|
|
266
266
|
if (!retval) {
|
267
|
-
rb_raise(
|
267
|
+
rb_raise(eDO_ConnectionError, "%s", PQerrorMessage(db));
|
268
268
|
}
|
269
269
|
}
|
270
270
|
|
@@ -285,7 +285,7 @@ PGresult * do_postgres_cCommand_execute_async(VALUE self, VALUE connection, PGco
|
|
285
285
|
}
|
286
286
|
|
287
287
|
if (PQconsumeInput(db) == 0) {
|
288
|
-
rb_raise(
|
288
|
+
rb_raise(eDO_ConnectionError, "%s", PQerrorMessage(db));
|
289
289
|
}
|
290
290
|
|
291
291
|
if (PQisBusy(db) == 0) {
|
@@ -412,7 +412,7 @@ void do_postgres_full_connect(VALUE self, PGconn *db) {
|
|
412
412
|
);
|
413
413
|
|
414
414
|
if (PQstatus(db) == CONNECTION_BAD) {
|
415
|
-
rb_raise(
|
415
|
+
rb_raise(eDO_ConnectionError, "%s", PQerrorMessage(db));
|
416
416
|
}
|
417
417
|
|
418
418
|
PGresult *result;
|
@@ -465,11 +465,11 @@ void do_postgres_full_connect(VALUE self, PGconn *db) {
|
|
465
465
|
|
466
466
|
VALUE encoding = rb_iv_get(self, "@encoding");
|
467
467
|
#ifdef HAVE_PQSETCLIENTENCODING
|
468
|
-
VALUE pg_encoding = rb_hash_aref(data_objects_const_get(
|
468
|
+
VALUE pg_encoding = rb_hash_aref(data_objects_const_get(mDO_PostgresEncoding, "MAP"), encoding);
|
469
469
|
|
470
470
|
if (pg_encoding != Qnil) {
|
471
471
|
if (PQsetClientEncoding(db, rb_str_ptr_readonly(pg_encoding))) {
|
472
|
-
rb_raise(
|
472
|
+
rb_raise(eDO_ConnectionError, "Couldn't set encoding: %s", rb_str_ptr_readonly(encoding));
|
473
473
|
}
|
474
474
|
else {
|
475
475
|
#ifdef HAVE_RUBY_ENCODING_H
|
@@ -497,7 +497,7 @@ VALUE do_postgres_cCommand_execute_non_query(int argc, VALUE *argv, VALUE self)
|
|
497
497
|
VALUE postgres_connection = rb_iv_get(connection, "@connection");
|
498
498
|
|
499
499
|
if (postgres_connection == Qnil) {
|
500
|
-
rb_raise(
|
500
|
+
rb_raise(eDO_ConnectionError, "This connection has already been closed.");
|
501
501
|
}
|
502
502
|
|
503
503
|
VALUE query = data_objects_build_query_from_args(self, argc, argv);
|
@@ -530,7 +530,7 @@ VALUE do_postgres_cCommand_execute_non_query(int argc, VALUE *argv, VALUE self)
|
|
530
530
|
}
|
531
531
|
|
532
532
|
PQclear(response);
|
533
|
-
return rb_funcall(
|
533
|
+
return rb_funcall(cDO_PostgresResult, DO_ID_NEW, 3, self, affected_rows, insert_id);
|
534
534
|
}
|
535
535
|
|
536
536
|
VALUE do_postgres_cCommand_execute_reader(int argc, VALUE *argv, VALUE self) {
|
@@ -538,7 +538,7 @@ VALUE do_postgres_cCommand_execute_reader(int argc, VALUE *argv, VALUE self) {
|
|
538
538
|
VALUE postgres_connection = rb_iv_get(connection, "@connection");
|
539
539
|
|
540
540
|
if (postgres_connection == Qnil) {
|
541
|
-
rb_raise(
|
541
|
+
rb_raise(eDO_ConnectionError, "This connection has already been closed.");
|
542
542
|
}
|
543
543
|
|
544
544
|
VALUE query = data_objects_build_query_from_args(self, argc, argv);
|
@@ -550,7 +550,7 @@ VALUE do_postgres_cCommand_execute_reader(int argc, VALUE *argv, VALUE self) {
|
|
550
550
|
}
|
551
551
|
|
552
552
|
int field_count = PQnfields(response);
|
553
|
-
VALUE reader = rb_funcall(
|
553
|
+
VALUE reader = rb_funcall(cDO_PostgresReader, DO_ID_NEW, 0);
|
554
554
|
|
555
555
|
rb_iv_set(reader, "@connection", connection);
|
556
556
|
rb_iv_set(reader, "@reader", Data_Wrap_Struct(rb_cObject, 0, 0, response));
|
@@ -614,7 +614,7 @@ VALUE do_postgres_cReader_next(VALUE self) {
|
|
614
614
|
VALUE reader = rb_iv_get(self, "@reader");
|
615
615
|
|
616
616
|
if(reader == Qnil) {
|
617
|
-
rb_raise(
|
617
|
+
rb_raise(eDO_ConnectionError, "This result set has already been closed.");
|
618
618
|
return Qfalse;
|
619
619
|
}
|
620
620
|
|
@@ -668,32 +668,32 @@ VALUE do_postgres_cReader_next(VALUE self) {
|
|
668
668
|
void Init_do_postgres() {
|
669
669
|
data_objects_common_init();
|
670
670
|
|
671
|
-
|
672
|
-
|
671
|
+
mDO_Postgres = rb_define_module_under(mDO, "Postgres");
|
672
|
+
mDO_PostgresEncoding = rb_define_module_under(mDO_Postgres, "Encoding");
|
673
673
|
|
674
|
-
|
675
|
-
rb_define_method(
|
676
|
-
rb_define_method(
|
677
|
-
rb_define_method(
|
678
|
-
rb_define_method(
|
679
|
-
rb_define_method(
|
674
|
+
cDO_PostgresConnection = rb_define_class_under(mDO_Postgres, "Connection", cDO_Connection);
|
675
|
+
rb_define_method(cDO_PostgresConnection, "initialize", do_postgres_cConnection_initialize, 1);
|
676
|
+
rb_define_method(cDO_PostgresConnection, "dispose", do_postgres_cConnection_dispose, 0);
|
677
|
+
rb_define_method(cDO_PostgresConnection, "character_set", data_objects_cConnection_character_set , 0);
|
678
|
+
rb_define_method(cDO_PostgresConnection, "quote_string", do_postgres_cConnection_quote_string, 1);
|
679
|
+
rb_define_method(cDO_PostgresConnection, "quote_byte_array", do_postgres_cConnection_quote_byte_array, 1);
|
680
680
|
|
681
|
-
|
682
|
-
rb_define_method(
|
683
|
-
rb_define_method(
|
684
|
-
rb_define_method(
|
681
|
+
cDO_PostgresCommand = rb_define_class_under(mDO_Postgres, "Command", cDO_Command);
|
682
|
+
rb_define_method(cDO_PostgresCommand, "set_types", data_objects_cCommand_set_types, -1);
|
683
|
+
rb_define_method(cDO_PostgresCommand, "execute_non_query", do_postgres_cCommand_execute_non_query, -1);
|
684
|
+
rb_define_method(cDO_PostgresCommand, "execute_reader", do_postgres_cCommand_execute_reader, -1);
|
685
685
|
|
686
|
-
|
686
|
+
cDO_PostgresResult = rb_define_class_under(mDO_Postgres, "Result", cDO_Result);
|
687
687
|
|
688
|
-
|
689
|
-
rb_define_method(
|
690
|
-
rb_define_method(
|
691
|
-
rb_define_method(
|
692
|
-
rb_define_method(
|
693
|
-
rb_define_method(
|
688
|
+
cDO_PostgresReader = rb_define_class_under(mDO_Postgres, "Reader", cDO_Reader);
|
689
|
+
rb_define_method(cDO_PostgresReader, "close", do_postgres_cReader_close, 0);
|
690
|
+
rb_define_method(cDO_PostgresReader, "next!", do_postgres_cReader_next, 0);
|
691
|
+
rb_define_method(cDO_PostgresReader, "values", data_objects_cReader_values, 0);
|
692
|
+
rb_define_method(cDO_PostgresReader, "fields", data_objects_cReader_fields, 0);
|
693
|
+
rb_define_method(cDO_PostgresReader, "field_count", data_objects_cReader_field_count, 0);
|
694
694
|
|
695
|
-
rb_global_variable(&
|
696
|
-
rb_global_variable(&
|
695
|
+
rb_global_variable(&cDO_PostgresResult);
|
696
|
+
rb_global_variable(&cDO_PostgresReader);
|
697
697
|
|
698
|
-
data_objects_define_errors(
|
698
|
+
data_objects_define_errors(mDO_Postgres, do_postgres_errors);
|
699
699
|
}
|
data/lib/do_postgres/version.rb
CHANGED
data/tasks/compile.rake
CHANGED
@@ -70,7 +70,7 @@ begin
|
|
70
70
|
ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar'
|
71
71
|
ext.java_compiling do |gem|
|
72
72
|
gem.add_dependency 'jdbc-postgres', '>=8.2'
|
73
|
-
gem.add_dependency 'do_jdbc', '0.10.
|
73
|
+
gem.add_dependency 'do_jdbc', '0.10.11'
|
74
74
|
end
|
75
75
|
end
|
76
76
|
rescue LoadError
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 10
|
8
|
-
-
|
9
|
-
version: 0.10.
|
8
|
+
- 11
|
9
|
+
version: 0.10.11
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Dirkjan Bussink
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2012-12-29 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,8 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 0
|
29
29
|
- 10
|
30
|
-
-
|
31
|
-
version: 0.10.
|
30
|
+
- 11
|
31
|
+
version: 0.10.11
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|