pgsql 1.2 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/lib/conn_exec.c +39 -20
- data/lib/module.c +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTM2YjZhYjdkMzM5ZDdjYTAyZmJjOTMzYTM3NTFiY2M0Y2Y0ZWI1ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
YWVlZTViMjA4YmYwYzg2MjVlYWYwNjdjNTA1N2ExMmRlMDU5MTY3MA==
|
7
|
+
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWY0NWYwYzA0ZjZkZWFjYjkwMGNhOGFiZmQ3M2U5ZWRmZjY3ODc4NjRkNzhl
|
10
|
+
MDg2YzdlMmVkZDAzZjZiY2RmOWFkNTgyZTFjNzQxMTM1ZjRhN2ExNmU4OWEx
|
11
|
+
MmQzZTAwOGI4NGNkZmNhNDQyMGNhM2Y3Yjg0ODNlNDQxODFmNTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTc3ZWJkMDg0MWUwYjdhZDdkMGViMDM5MzE5YmU2MGVmZTBkYTNlMGIwNWZh
|
14
|
+
YzQwN2Y4ZjQ0ZjE2Yjk4OWI1OTFmMzY4NGVjNmY5NDk2MjIzYTIyMzc5MWI0
|
15
|
+
ODFiNTRjMjBkN2YxNDljN2FlYWJmOWUzMDQwMDE1ODAyYWQyZGY=
|
data/lib/conn_exec.c
CHANGED
@@ -37,10 +37,12 @@ static VALUE pgconn_select_values( int argc, VALUE *argv, VALUE self);
|
|
37
37
|
static VALUE pgconn_get_notify( VALUE self);
|
38
38
|
|
39
39
|
static VALUE pgconn_transaction( int argc, VALUE *argv, VALUE self);
|
40
|
-
static VALUE
|
40
|
+
static VALUE rollback_transaction( VALUE self);
|
41
|
+
static VALUE commit_transaction( VALUE self);
|
41
42
|
static VALUE yield_transaction( VALUE self);
|
42
43
|
static VALUE pgconn_subtransaction( int argc, VALUE *argv, VALUE self);
|
43
|
-
static VALUE
|
44
|
+
static VALUE rollback_subtransaction( VALUE ary);
|
45
|
+
static VALUE release_subtransaction( VALUE ary);
|
44
46
|
static VALUE yield_subtransaction( VALUE ary);
|
45
47
|
static VALUE pgconn_transaction_status( VALUE self);
|
46
48
|
|
@@ -460,11 +462,17 @@ pgconn_transaction( int argc, VALUE *argv, VALUE self)
|
|
460
462
|
rb_raise( rb_ePgConnTrans,
|
461
463
|
"Nested transaction block. Use Conn#subtransaction.");
|
462
464
|
pgresult_clear( pg_statement_exec( self, cmd, Qnil));
|
463
|
-
return
|
465
|
+
return rb_ensure( yield_transaction, self, commit_transaction, self);
|
464
466
|
}
|
465
467
|
|
466
468
|
VALUE
|
467
|
-
|
469
|
+
yield_transaction( VALUE self)
|
470
|
+
{
|
471
|
+
return rb_rescue( rb_yield, self, rollback_transaction, self);
|
472
|
+
}
|
473
|
+
|
474
|
+
VALUE
|
475
|
+
rollback_transaction( VALUE self)
|
468
476
|
{
|
469
477
|
pgresult_clear( pg_statement_exec( self, rb_str_new2( "rollback;"), Qnil));
|
470
478
|
rb_exc_raise( RB_ERRINFO);
|
@@ -472,13 +480,14 @@ rescue_transaction( VALUE self)
|
|
472
480
|
}
|
473
481
|
|
474
482
|
VALUE
|
475
|
-
|
483
|
+
commit_transaction( VALUE self)
|
476
484
|
{
|
477
|
-
|
485
|
+
struct pgconn_data *c;
|
478
486
|
|
479
|
-
|
480
|
-
|
481
|
-
|
487
|
+
Data_Get_Struct( self, struct pgconn_data, c);
|
488
|
+
if (PQtransactionStatus( c->conn) > PQTRANS_IDLE)
|
489
|
+
pgresult_clear( pg_statement_exec( self, rb_str_new2( "commit;"), Qnil));
|
490
|
+
return Qnil;
|
482
491
|
}
|
483
492
|
|
484
493
|
|
@@ -514,11 +523,17 @@ pgconn_subtransaction( int argc, VALUE *argv, VALUE self)
|
|
514
523
|
rb_str_buf_cat2( cmd, ";");
|
515
524
|
|
516
525
|
pgresult_clear( pg_statement_exec( self, cmd, Qnil));
|
517
|
-
return
|
526
|
+
return rb_ensure( yield_subtransaction, ya, release_subtransaction, ya);
|
518
527
|
}
|
519
528
|
|
520
529
|
VALUE
|
521
|
-
|
530
|
+
yield_subtransaction( VALUE ary)
|
531
|
+
{
|
532
|
+
return rb_rescue( rb_yield, ary, rollback_subtransaction, ary);
|
533
|
+
}
|
534
|
+
|
535
|
+
VALUE
|
536
|
+
rollback_subtransaction( VALUE ary)
|
522
537
|
{
|
523
538
|
VALUE cmd;
|
524
539
|
|
@@ -526,21 +541,25 @@ rescue_subtransaction( VALUE ary)
|
|
526
541
|
rb_str_buf_append( cmd, rb_ary_entry( ary, 1));
|
527
542
|
rb_str_buf_cat2( cmd, ";");
|
528
543
|
pgresult_clear( pg_statement_exec( rb_ary_entry( ary, 0), cmd, Qnil));
|
544
|
+
rb_ary_store( ary, 1, Qnil);
|
529
545
|
rb_exc_raise( RB_ERRINFO);
|
530
546
|
return Qnil;
|
531
547
|
}
|
532
548
|
|
533
549
|
VALUE
|
534
|
-
|
550
|
+
release_subtransaction( VALUE ary)
|
535
551
|
{
|
536
|
-
VALUE
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
552
|
+
VALUE cmd;
|
553
|
+
VALUE n;
|
554
|
+
|
555
|
+
n = rb_ary_entry( ary, 1);
|
556
|
+
if (!NIL_P( n)) {
|
557
|
+
cmd = rb_str_buf_new2( "release savepoint ");
|
558
|
+
rb_str_buf_append( cmd, n);
|
559
|
+
rb_str_buf_cat2( cmd, ";");
|
560
|
+
pgresult_clear( pg_statement_exec( rb_ary_entry( ary, 0), cmd, Qnil));
|
561
|
+
}
|
562
|
+
return Qnil;
|
544
563
|
}
|
545
564
|
|
546
565
|
|
data/lib/module.c
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgsql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: autorake
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
80
80
|
- PostgreSQL
|
81
81
|
rubyforge_project: NONE
|
82
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.1.11
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: PostgreSQL-API for Ruby
|