nwrfc 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OGYwZjQ5ZGFiZTg5NzY4OGZiMmUzZTE1ZTcwNWRjZDIyZjAwMjk4Nw==
5
- data.tar.gz: !binary |-
6
- Y2JjNjJjODMyNjA5ZmM4NjFmMzZkYTE2NzYxMWNhY2I0NjQxZjE4Yw==
2
+ SHA1:
3
+ metadata.gz: 2d5fbd12b903409ea2b837947e2d208e08327a9e
4
+ data.tar.gz: 34780bd7e20e25151fbc12209e82e45fb871edfe
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NTk4NTEyYTljOGU5OTg5YWY3YjQ4Yzk4YmFkMGI0ZWZhMjIyMTBiNTdhMjNl
10
- MzcyZTFkZTdjZGJkM2I3OGIxNWU4OGIzN2UwMmRhODFmNDQ1YTVkNmQwMjU2
11
- ZmQwYzI1NGU2YzhkNGRjOGNkM2RjNGI3YjA5NjJhMTdmMmYyYmM=
12
- data.tar.gz: !binary |-
13
- OWQ0YWI5OWNhNDZhZmQ0ZThjMDEwYTkzN2EwMDc5ZTMyZjNlMTRiZDQ0ZDA3
14
- OTMwY2RjOWYzYWUzMGJhNWUzOGNhYWJiN2U1ODliZTlkNTUwZjIxNmViMjdi
15
- MzRiZjg2MzM3OWViZGM5OTNkZDNkZWQ0NTEwODg2NDA0ZmQ5N2E=
6
+ metadata.gz: d3f0cadb07a457568e861cd8886ba446c4feabec9f8d7f2679af301e291d488e8fac2e8a629844fde7f018ff3ea1a5f4ffdc83bb5d126e167d632cc24c06fe3c
7
+ data.tar.gz: 82a15775e12295af6cf215301bd9edb7a1360a8b981dd764c64fde06e2c54b78916b720864ba0d5d5f6e4887fa46d78db1f77d7e4e0639e067de76a3c040e78e
@@ -84,6 +84,10 @@ so that ["system2"] at the end points to whatever label you gave it in the YAML
84
84
 
85
85
  == Release Notes
86
86
 
87
+ === Available in 0.0.9
88
+
89
+ * Support for qRFC/tRFC
90
+
87
91
  === Available in 0.0.8
88
92
 
89
93
  * BigDecimal support added for BCD values (BCD is also returned as BigDecimal to cater for very big numbers like timestamps)
@@ -111,6 +111,37 @@ module NWRFC
111
111
 
112
112
  alias :close :disconnect
113
113
 
114
+ def start_transaction(queue_name = nil)
115
+ @tid = FFI::MemoryPointer.new(:char, 50)
116
+ rc = NWRFCLib.get_transaction_id(@handle, @tid, @error)
117
+ NWRFC.check_error(@error) if rc > 0
118
+ queue_name = FFI::MemoryPointer.from_string(queue_name.to_s.cU) if queue_name
119
+ transaction_handle = NWRFCLib.create_transaction(@handle, @tid, queue_name, @error)
120
+ NWRFC.check_error(@error)
121
+ Transaction.new(transaction_handle)
122
+ end
123
+
124
+ end
125
+
126
+ class Transaction
127
+ attr_reader :handle
128
+
129
+ def initialize(handle)
130
+ @handle = handle
131
+ @error = NWRFCLib::RFCError.new
132
+ end
133
+
134
+ def commit
135
+ rc = NWRFCLib.submit_transaction(@handle, @error)
136
+ NWRFC.check_error(@error) if rc > 0
137
+ rc = NWRFCLib.confirm_transaction(@handle, @error)
138
+ NWRFC.check_error(@error) if rc > 0
139
+ rc = NWRFCLib.destroy_transaction(@handle, @error)
140
+ NWRFC.check_error(@error) if rc > 0
141
+ end
142
+
143
+ alias :submit :commit
144
+
114
145
  end
115
146
 
116
147
  # Converts ABAP true/false into Ruby true/false
@@ -280,11 +311,16 @@ module NWRFC
280
311
 
281
312
  # Execute the function on the connected ABAP system
282
313
  #@raise NWRFC::NWError
283
- def invoke
314
+ def invoke(tx = nil)
284
315
  raise "Not a callable function" unless @connection
285
- rc = NWRFCLib.invoke(@connection.handle, @handle, @error.to_ptr)
286
- #@todo Handle function exceptions by checking for :RFC_ABAP_EXCEPTION (5)
287
- NWRFC.check_error(@error) if rc > 0
316
+ if tx
317
+ rc = NWRFCLib.invoke_in_transaction(tx.handle, @handle, @error.to_ptr)
318
+ NWRFC.check_error(@error) if rc > 0
319
+ else
320
+ rc = NWRFCLib.invoke(@connection.handle, @handle, @error.to_ptr)
321
+ #@todo Handle function exceptions by checking for :RFC_ABAP_EXCEPTION (5)
322
+ NWRFC.check_error(@error) if rc > 0
323
+ end
288
324
  end
289
325
 
290
326
  # Returns whether or not a given parameter is active, i.e. whether it will be sent to the server during the RFC
@@ -61,7 +61,7 @@ if STRING_SUPPORTS_ENCODE
61
61
 
62
62
  # Convert string from UTF-8 to double-null terminated UTF-16LE string
63
63
  def cU
64
- (self.dup << "\0").force_encoding('UTF-8').encode('UTF-16LE')
64
+ (self.to_s + "\0").force_encoding('UTF-8').encode('UTF-16LE')
65
65
  end
66
66
 
67
67
  # Convert string from UTF-16LE to UTF-8 and trim trailing whitespace
metadata CHANGED
@@ -1,31 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nwrfc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Ceronio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-05 00:00:00.000000000 Z
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.9.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.9.3
27
27
  description: SAP Netweaver RFC Library Wrapper using Ruby-FFI
28
- email: martin.ceronio@infosize.co.za
28
+ email: mydoghasworms@gmail.com
29
29
  executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files:
@@ -33,11 +33,11 @@ extra_rdoc_files:
33
33
  files:
34
34
  - README.rdoc
35
35
  - Rakefile
36
+ - lib/nwrfc.rb
36
37
  - lib/nwrfc/datacontainer.rb
37
38
  - lib/nwrfc/nwerror.rb
38
39
  - lib/nwrfc/nwrfclib.rb
39
40
  - lib/nwrfc/server.rb
40
- - lib/nwrfc.rb
41
41
  homepage: http://rubygems.org/gems/nwrfc
42
42
  licenses:
43
43
  - MIT
@@ -48,17 +48,17 @@ require_paths:
48
48
  - lib
49
49
  required_ruby_version: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ! '>='
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - ! '>='
56
+ - - ">="
57
57
  - !ruby/object:Gem::Version
58
58
  version: '0'
59
59
  requirements: []
60
60
  rubyforge_project:
61
- rubygems_version: 2.1.11
61
+ rubygems_version: 2.2.3
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: SAP Netweaver RFC Library Wrapper