neo4j-ruby-driver 1.7.0 → 1.7.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d33153e299b755a419d12e6977650124965789923b7faedaddfa78dfde1bd6d1
4
- data.tar.gz: abdaeef0e7c8dc83c6dc38d052e10630836a0cb3c9999976f8a1fed5b616a650
3
+ metadata.gz: cd9fa45ff22c9cb38139fda7089c5e73f10ba00ba79768c65201106bcc2e08a6
4
+ data.tar.gz: 12ede6184057ce7bfe24e33a739abedf2bb47e4b9e920012dfa4b89fdda5cd3e
5
5
  SHA512:
6
- metadata.gz: e72296857ec72dd8d624098be60d5567a775fcbd4a0d3c6fcc931314072114c7ffcc8d33ac1a4f72dd8983ec9548d5da88609d7e1319b3223cc7450459f8e13c
7
- data.tar.gz: e9a45e37d1332e0391230900949891945ee5e1182c89d6b63d87fe5992659fa14f2ef4bd6bfe80c42c2aa3daaa620013fbbef273141070341c78beccd8a37e34
6
+ metadata.gz: e23309e67f7d78c389239fb56164d22f6d63dfdaef26ac7ba5cdb95e5bd1d4da7f631b445bd542414e05867100a039d1082a58905b2dc862c6efb88ce34316cf
7
+ data.tar.gz: 5c99db2e46c631acaa793fbdfd639725cc32a43e9ff513c9a60990ea502be395e7f3751a2cfd6f1b78c67b2ab6ab5eb6908ca8b68f59430c6f590ea4ad89b758
data/ffi/neo4j/driver.rb CHANGED
@@ -41,6 +41,7 @@ end
41
41
 
42
42
  require 'active_support/concern'
43
43
  require 'active_support/core_ext/array/grouping'
44
+ require 'active_support/logger'
44
45
  require 'concurrent/atomic/atomic_boolean'
45
46
  require 'concurrent/atomic/atomic_reference'
46
47
  require 'ffi'
@@ -22,11 +22,11 @@ module Neo4j
22
22
 
23
23
  def write_and_flush(statement, parameters, boomarks_holder, config, run_handler, pull_handler)
24
24
  check_error Bolt::Connection.clear_run(bolt_connection)
25
- check_error Bolt::Connection.set_run_cypher(bolt_connection, statement, statement.size, parameters.size)
25
+ check_error Bolt::Connection.set_run_cypher(bolt_connection, statement, statement.bytesize, parameters.size)
26
26
  parameters.each_with_index do |(name, object), index|
27
27
  name = name.to_s
28
28
  Value::ValueAdapter.to_neo(
29
- Bolt::Connection.set_run_cypher_parameter(bolt_connection, index, name, name.size), object
29
+ Bolt::Connection.set_run_cypher_parameter(bolt_connection, index, name, name.bytesize), object
30
30
  )
31
31
  end
32
32
  set_bookmarks(:set_run_bookmarks, boomarks_holder.bookmarks)
@@ -23,7 +23,8 @@ module Neo4j
23
23
  def create_connector(uri, auth_token, routing_context, config)
24
24
  address = Bolt::Address.create(host(uri).gsub(/^\[(.*)\]$/, '\\1'), port(uri).to_s)
25
25
  bolt_config = bolt_config(config)
26
- logger = InternalLogger.register(bolt_config, config[:logger])
26
+ # callbacks from C to ruby used in logger may cause deadlocks on MRI
27
+ logger = InternalLogger.register(bolt_config, config[:logger]) if RUBY_PLATFORM.match?(/java/)
27
28
  set_socket_options(bolt_config, config)
28
29
  set_routing_context(bolt_config, routing_context)
29
30
  set_scheme(bolt_config, uri, routing_context)
@@ -82,7 +82,11 @@ module Neo4j
82
82
  end
83
83
 
84
84
  def throw(error)
85
- on_failure(error)
85
+ if @failure
86
+ error.add_suppressed(@failure)
87
+ else
88
+ on_failure(error)
89
+ end
86
90
  raise error
87
91
  end
88
92
 
@@ -61,12 +61,11 @@ module Neo4j
61
61
  end
62
62
 
63
63
  def on_failure(error)
64
+ @failure = error
64
65
  summary
65
66
  @finished = true
66
67
 
67
68
  after_failure(error)
68
-
69
- @failure = error
70
69
  end
71
70
 
72
71
  def finalize
@@ -95,7 +94,7 @@ module Neo4j
95
94
  nil
96
95
  end
97
96
  rescue StandardError => e
98
- on_failure(e)
97
+ on_failure(e) unless @failure
99
98
  raise e
100
99
  end
101
100
  end
@@ -34,8 +34,8 @@ module Neo4j
34
34
  after_success(nil)
35
35
  else
36
36
  return if previous&.failure
37
- @failure = Value::ValueAdapter.to_ruby(Bolt::Connection.failure(bolt_connection))
38
- raise new_neo4j_error(**@failure)
37
+ failure = Value::ValueAdapter.to_ruby(Bolt::Connection.failure(bolt_connection))
38
+ raise @failure = new_neo4j_error(**failure)
39
39
  end
40
40
  end
41
41
 
@@ -13,7 +13,7 @@ module Neo4j
13
13
  nodes = [prev_node] # Start node is always 0, and isn't encoded in the sequence
14
14
  rels = []
15
15
  path = Types::Path.new(nodes, rels)
16
- sequence.in_groups_of(2) do |node_idx, rel_idx|
16
+ sequence.in_groups_of(2) do |rel_idx, node_idx|
17
17
  node = uniq_nodes[node_idx]
18
18
  nodes << node
19
19
  rel = uniq_rels[rel_idx.abs - 1] # -1 because rel idx are 1-indexed
@@ -50,6 +50,8 @@ module Neo4j
50
50
  when String
51
51
  object = object.encode(Encoding::UTF_8) unless object.encoding == Encoding::UTF_8
52
52
  Bolt::Value.format_as_string(value, object, object.bytesize)
53
+ when Symbol
54
+ to_neo(value, object.to_s)
53
55
  when Hash
54
56
  Bolt::Value.format_as_dictionary(value, object.size)
55
57
  object.each_with_index do |(key, elem), index|
@@ -63,8 +65,6 @@ module Neo4j
63
65
  object = object.to_a
64
66
  Bolt::Value.format_as_list(value, object.size)
65
67
  object.each_with_index { |elem, index| to_neo(Bolt::List.value(value, index), elem) }
66
- when Date
67
- DateValue.to_neo(value, object)
68
68
  when ActiveSupport::Duration
69
69
  DurationValue.to_neo(value, object)
70
70
  when Neo4j::Driver::Types::Point
@@ -84,8 +84,10 @@ module Neo4j
84
84
  LocalDateTimeValue.to_neo(value, object)
85
85
  when ActiveSupport::TimeWithZone
86
86
  TimeWithZoneIdValue.to_neo(value, object)
87
- when Time
87
+ when Time, DateTime
88
88
  TimeWithZoneOffsetValue.to_neo(value, object)
89
+ when Date
90
+ DateValue.to_neo(value, object)
89
91
  else
90
92
  Exceptions::ClientException.unable_to_convert(object)
91
93
  end
@@ -4,7 +4,7 @@ module Neo4j
4
4
  module Driver
5
5
  module Types
6
6
  class Path < Array
7
- attr_reader :modes, :relationships
7
+ attr_reader :nodes, :relationships
8
8
 
9
9
  class Segment
10
10
  attr_reader :start_node, :relationship, :end_node
@@ -4,12 +4,11 @@ module Neo4j
4
4
  module Driver
5
5
  module Exceptions
6
6
  class Neo4jException < RuntimeError
7
- attr_reader :code, :cause, :suppressed
7
+ attr_reader :code, :suppressed
8
8
 
9
9
  def initialize(*args)
10
10
  @code = args.shift if args.count > 1
11
11
  message = args.shift
12
- @cause = args.shift
13
12
  @suppressed = args.shift
14
13
  super(message)
15
14
  end
@@ -6,7 +6,8 @@ module Neo4j
6
6
  module DurationNormalizer
7
7
  class << self
8
8
  def normalize(object)
9
- parts = object.parts
9
+ parts = object.parts.to_h
10
+ parts.default = 0
10
11
  months_i, months_remainder_seconds = divmod(months(parts), ActiveSupport::Duration::SECONDS_PER_MONTH)
11
12
  months_days, months_remainder_seconds =
12
13
  months_remainder_seconds.divmod(ActiveSupport::Duration::SECONDS_PER_DAY)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '1.7.0'
5
+ VERSION = '1.7.5'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-ruby-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-07 00:00:00.000000000 Z
11
+ date: 2021-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -319,7 +319,7 @@ licenses:
319
319
  - MIT
320
320
  metadata:
321
321
  homepage_uri: https://github.com/neo4jrb/neo4j-ruby-driver
322
- post_install_message:
322
+ post_install_message:
323
323
  rdoc_options:
324
324
  - "--main"
325
325
  - README.md
@@ -337,8 +337,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
337
  - !ruby/object:Gem::Version
338
338
  version: '0'
339
339
  requirements: []
340
- rubygems_version: 3.1.2
341
- signing_key:
340
+ rubygems_version: 3.2.3
341
+ signing_key:
342
342
  specification_version: 4
343
343
  summary: ''
344
344
  test_files: []