pg_conn 0.41.1 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +19 -17
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d9aafa29dec55b879562f1ee2925322ccbde2c829d1c23c0529d41c171210e4
|
|
4
|
+
data.tar.gz: de71188ab165e6c0d3b8d1d1e947e5ea9deb0615287da2467dfffa7ae048d910
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7852a85c9a0b0ec2d31429a800cc1362e0c42d9a143cff80dfc47f81c2cad4fa3517777e91143f2a4876148b641a252d888e9316f53642af8f341772bce2bf8f
|
|
7
|
+
data.tar.gz: faf876c344f385b50f6813249114df1cec630ce85313517abb3e8a5a521524d14746fd58bed085cfc098298d0514bfa1c5bf17fa84fce0cb06790376a50699d4
|
data/lib/pg_conn/version.rb
CHANGED
data/lib/pg_conn.rb
CHANGED
|
@@ -1068,16 +1068,6 @@ module PgConn
|
|
|
1068
1068
|
|
|
1069
1069
|
# TODO: Move to TransactionMethods
|
|
1070
1070
|
|
|
1071
|
-
def commit()
|
|
1072
|
-
if transaction?
|
|
1073
|
-
pop_transaction(fail: false)
|
|
1074
|
-
else
|
|
1075
|
-
pg_exec("commit")
|
|
1076
|
-
end
|
|
1077
|
-
end
|
|
1078
|
-
|
|
1079
|
-
def rollback() raise Rollback end
|
|
1080
|
-
|
|
1081
1071
|
# True if a transaction is in progress
|
|
1082
1072
|
#
|
|
1083
1073
|
# Note that this requires all transactions to be started using PgConn's
|
|
@@ -1113,6 +1103,7 @@ module PgConn
|
|
|
1113
1103
|
end
|
|
1114
1104
|
end
|
|
1115
1105
|
|
|
1106
|
+
# FIXME :exception is unused
|
|
1116
1107
|
def pop_transaction(commit: true, fail: true, exception: true)
|
|
1117
1108
|
if transaction?
|
|
1118
1109
|
if savepoint = @savepoints.pop
|
|
@@ -1156,13 +1147,11 @@ module PgConn
|
|
|
1156
1147
|
|
|
1157
1148
|
# Start a transaction. If called with a block, the block is executed within
|
|
1158
1149
|
# a transaction that is auto-committed if the commit option is true (the
|
|
1159
|
-
# default).
|
|
1160
|
-
#
|
|
1161
|
-
#
|
|
1162
|
-
#
|
|
1163
|
-
#
|
|
1164
|
-
# that the transaction timestamp is set to the start of the first
|
|
1165
|
-
# transaction even if transactions are nested
|
|
1150
|
+
# default). The transaction is rolled back automatically if :commit is
|
|
1151
|
+
# false or if a PgConn::Rollback is raised with the block. #transaction
|
|
1152
|
+
# returns the result of the block or nil if no block was given. Note that
|
|
1153
|
+
# the transaction timestamp is set to the start of the first transaction
|
|
1154
|
+
# even if transactions are nested
|
|
1166
1155
|
#
|
|
1167
1156
|
# FIXME: There is some strange problem in rspec where #insert handles
|
|
1168
1157
|
# an exception correctly while #exec, #execute, and #transaction does not
|
|
@@ -1187,6 +1176,19 @@ module PgConn
|
|
|
1187
1176
|
end
|
|
1188
1177
|
end
|
|
1189
1178
|
|
|
1179
|
+
# The flow to global transactions is
|
|
1180
|
+
#
|
|
1181
|
+
# conn.transaction # Starts a transaction
|
|
1182
|
+
# ...
|
|
1183
|
+
# if ok
|
|
1184
|
+
# conn.commit
|
|
1185
|
+
# else
|
|
1186
|
+
# conn.rollback
|
|
1187
|
+
# end
|
|
1188
|
+
#
|
|
1189
|
+
def commit() pop_transaction(fail: false) end
|
|
1190
|
+
def rollback() pop_transaction(commit: false, fail: false) end
|
|
1191
|
+
|
|
1190
1192
|
def dump(*query)
|
|
1191
1193
|
records = self.records(*query)
|
|
1192
1194
|
|