Straight mapping of OCI transaction functions to ruby-oci8 #213
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@tomasjura
This is a one-to-one mapping. I won't merge it because it isn't easy-to-use and some methods' usages are obscure for me.
The following classes and methods are added.
OCI8::Xid
- a mapping of XID structure defined in xa.h.#new(format_id, gtrid, bqual)
- creates a new Xid instance using format id, global transaction id and branch qualifier.C code:
#format_id
- gets format id as Integer.#gtrid
- gets global transaction id as ASCII-8bit String.#bqual
- gets branch qualifier as ASCII-8bit String.OCI8::TransHandle
- a mapping of transaction handle.#new
- creates a new transaction handle byOCIHandleAlloc(envhp, (void **)&handle, OCI_HTYPE_TRANS, 0, 0)
#name=string
- sets the string value to the OCI_ATTR_TRANS_NAME attribute.#name
- gets the OCI_ATTR_TRANS_NAME attribute.As far as I checked, it seems same with
#xid.gtrid
#timeout=integer
- sets the integer value to the OCI_ATTR_TRANS_TIMEOUT attrbiute.#timeout
- gets the OCI_ATTR_TRANS_TIMEOUT attrbiute.#xid=xid
- sets the xid value, which must be an instance ofOCI8::Xid
, to the OCI_ATTR_XID attribute#xid
- gets the OCI_ATTR_XID attribute asOCI8::Xid
OCI8
- connection#trans_handle=handle
- sets the transaction handleIt corresponds to
OCIAttrSet(svchp, OCI_HTYPE_SVCCTX, txnhp, 0, OCI_ATTR_TRANS, errhp)
. The handle is set to@trans_handle
instance variable ofself
also in order to prevent it from being freed by GC.#trans_handle
- gets the transaction handle set by#trans_handle=
.#commit(flag...)
- calls OCITransCommit.Flags are specified by symbol.
:two_phase
OCI_TRANS_TWOPHASE
:write_immediate
OCI_TRANS_WRITEIMMED
:write_batch
OCI_TRANS_WRITEBATCH
:write_wait
OCI_TRANS_WRITEWAIT
:write_no_wait
OCI_TRANS_WRITENOWAIT
#trans_detach
- calls OCITransDetach.#trans_forget
- calls OCITransForget.#trans_prepare
- calls OCITransPrepare.It returns
true
when the transaction must be committed byconn.commit(:two_phase)
.false
whenORA-24767: transaction branch prepare returns read-only
.#trans_start(timeout, flag...)
- calls OCITransStart.Flags are specified by symbol.
:new
OCI_TRANS_NEW
:tight
OCI_TRANS_TIGHT
:loose
OCI_TRANS_LOOSE
:resume
OCI_TRANS_RESUME
:readonly
OCI_TRANS_READONLY
:serializable
OCI_TRANS_SERIALIZABLE