kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 75 forks source link

Straight mapping of OCI transaction functions to ruby-oci8 #213

Open kubo opened 5 years ago

kubo commented 5 years ago

@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.

tomasjura commented 5 years ago

Wow, thank you. You are very quick and productive. I haven't finished feasibility of XA transaction on the second resource manager - MQ server ( https://github.com/reidmorrison/rubywmq ) in Ruby and you are finished with OCI. I will pull, study and test your XA improvements.

kubo commented 5 years ago

This is just a draft. It is a first step to learn the usage and find more usable methods. I may remove OCI8::Xid and OCI8::TransHandle later.

Start a global transaction using the current draft methods:

txn = OCI8::TransHandle.new()
txn.xid = OCI8::Xid.new(1000, "\x01\x02\x03", "\x01")
conn.trans_handle = txn
conn.trans_start(90, :new)

This may be changed as follows:

conn.trans_start([1000, "\x01\x02\x03", "\x01"], timeout: 90)

TransHandle is allocated internally. Xid is specified by an array or any object which has format_id, gtrid and bqual methods. timeout: is optional because it is required only when trans_detach() is called later and I guess that almost users don't need it.

cjbj commented 5 years ago

@kubo send me email with questions about XA and I will find answers.