trilogy 2.6.1 → 2.7.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/ext/trilogy-ruby/cext.c +3 -13
 - data/lib/trilogy/error.rb +11 -17
 - data/lib/trilogy/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f36747c1d61f440a5ff6b5d37981b0a11ad26a1b973ebeb9bab84e832b2841a3
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b654bac6dbc4d3451c5101e9f8574de4aee4044d6aa280c0736e3e18ad09c723
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 81aefe81cfe750d70a42915c6a16f6d7211455b255a6588088c8ac6c682240636df5c2269b7090e78ba2ce6f991e3266f1c2b57711130e84fde85a8d38b22a1c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3df0441086b141c6c0ebb0d3a216d14205547bd340c06cf0884e1985ac6550023ea8960200c5afe31821160883a3cd96a07a942efb05a9d335153dcdafa83976
         
     | 
    
        data/ext/trilogy-ruby/cext.c
    CHANGED
    
    | 
         @@ -17,7 +17,7 @@ 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            VALUE Trilogy_CastError;
         
     | 
| 
       19 
19 
     | 
    
         
             
            static VALUE Trilogy_BaseConnectionError, Trilogy_ProtocolError, Trilogy_SSLError, Trilogy_QueryError,
         
     | 
| 
       20 
     | 
    
         
            -
                Trilogy_ConnectionClosedError, 
     | 
| 
      
 20 
     | 
    
         
            +
                Trilogy_ConnectionClosedError,
         
     | 
| 
       21 
21 
     | 
    
         
             
                Trilogy_TimeoutError, Trilogy_SyscallError, Trilogy_Result, Trilogy_EOFError;
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            static ID id_socket, id_host, id_port, id_username, id_password, id_found_rows, id_connect_timeout, id_read_timeout,
         
     | 
| 
         @@ -88,12 +88,8 @@ static struct trilogy_ctx *get_open_ctx(VALUE obj) 
     | 
|
| 
       88 
88 
     | 
    
         
             
            NORETURN(static void trilogy_syserr_fail_str(int, VALUE));
         
     | 
| 
       89 
89 
     | 
    
         
             
            static void trilogy_syserr_fail_str(int e, VALUE msg)
         
     | 
| 
       90 
90 
     | 
    
         
             
            {
         
     | 
| 
       91 
     | 
    
         
            -
                if (e ==  
     | 
| 
       92 
     | 
    
         
            -
                     
     | 
| 
       93 
     | 
    
         
            -
                } else if (e == ECONNRESET) {
         
     | 
| 
       94 
     | 
    
         
            -
                    rb_raise(Trilogy_ConnectionResetError, "%" PRIsVALUE, msg);
         
     | 
| 
       95 
     | 
    
         
            -
                } else if (e == EPIPE) {
         
     | 
| 
       96 
     | 
    
         
            -
                    // Backwards compatibility: This error class makes no sense, but matches legacy behavior
         
     | 
| 
      
 91 
     | 
    
         
            +
                if (e == EPIPE) {
         
     | 
| 
      
 92 
     | 
    
         
            +
                    // Backwards compatibility: This error message is a bit odd, but includes "TRILOGY_CLOSED_CONNECTION" to match legacy string matching
         
     | 
| 
       97 
93 
     | 
    
         
             
                    rb_raise(Trilogy_EOFError, "%" PRIsVALUE ": TRILOGY_CLOSED_CONNECTION: EPIPE", msg);
         
     | 
| 
       98 
94 
     | 
    
         
             
                } else {
         
     | 
| 
       99 
95 
     | 
    
         
             
                    VALUE exc = rb_funcall(Trilogy_SyscallError, id_from_errno, 2, INT2NUM(e), msg);
         
     | 
| 
         @@ -1156,12 +1152,6 @@ RUBY_FUNC_EXPORTED void Init_cext() 
     | 
|
| 
       1156 
1152 
     | 
    
         
             
                Trilogy_TimeoutError = rb_const_get(Trilogy, rb_intern("TimeoutError"));
         
     | 
| 
       1157 
1153 
     | 
    
         
             
                rb_global_variable(&Trilogy_TimeoutError);
         
     | 
| 
       1158 
1154 
     | 
    
         | 
| 
       1159 
     | 
    
         
            -
                Trilogy_ConnectionRefusedError = rb_const_get(Trilogy, rb_intern("ConnectionRefusedError"));
         
     | 
| 
       1160 
     | 
    
         
            -
                rb_global_variable(&Trilogy_ConnectionRefusedError);
         
     | 
| 
       1161 
     | 
    
         
            -
             
     | 
| 
       1162 
     | 
    
         
            -
                Trilogy_ConnectionResetError = rb_const_get(Trilogy, rb_intern("ConnectionResetError"));
         
     | 
| 
       1163 
     | 
    
         
            -
                rb_global_variable(&Trilogy_ConnectionResetError);
         
     | 
| 
       1164 
     | 
    
         
            -
             
     | 
| 
       1165 
1155 
     | 
    
         
             
                Trilogy_BaseConnectionError = rb_const_get(Trilogy, rb_intern("BaseConnectionError"));
         
     | 
| 
       1166 
1156 
     | 
    
         
             
                rb_global_variable(&Trilogy_BaseConnectionError);
         
     | 
| 
       1167 
1157 
     | 
    
         | 
    
        data/lib/trilogy/error.rb
    CHANGED
    
    | 
         @@ -12,7 +12,7 @@ class Trilogy 
     | 
|
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              # Trilogy may raise various syscall errors, which we treat as Trilogy::Errors.
         
     | 
| 
       15 
     | 
    
         
            -
               
     | 
| 
      
 15 
     | 
    
         
            +
              module SyscallError
         
     | 
| 
       16 
16 
     | 
    
         
             
                ERRORS = {}
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                Errno.constants
         
     | 
| 
         @@ -20,7 +20,10 @@ class Trilogy 
     | 
|
| 
       20 
20 
     | 
    
         
             
                  .select { |c| c.is_a?(Class) && c < SystemCallError }
         
     | 
| 
       21 
21 
     | 
    
         
             
                  .each do |c|
         
     | 
| 
       22 
22 
     | 
    
         
             
                    errno_name = c.to_s.split('::').last
         
     | 
| 
       23 
     | 
    
         
            -
                    ERRORS[c::Errno] = const_set(errno_name, Class.new(c) { 
     | 
| 
      
 23 
     | 
    
         
            +
                    ERRORS[c::Errno] = const_set(errno_name, Class.new(c) {
         
     | 
| 
      
 24 
     | 
    
         
            +
                      include Trilogy::ConnectionError
         
     | 
| 
      
 25 
     | 
    
         
            +
                      singleton_class.define_method(:===, Module.instance_method(:===))
         
     | 
| 
      
 26 
     | 
    
         
            +
                    })
         
     | 
| 
       24 
27 
     | 
    
         
             
                  end
         
     | 
| 
       25 
28 
     | 
    
         | 
| 
       26 
29 
     | 
    
         
             
                ERRORS.freeze
         
     | 
| 
         @@ -32,6 +35,11 @@ class Trilogy 
     | 
|
| 
       32 
35 
     | 
    
         
             
                end
         
     | 
| 
       33 
36 
     | 
    
         
             
              end
         
     | 
| 
       34 
37 
     | 
    
         | 
| 
      
 38 
     | 
    
         
            +
              ConnectionRefusedError = SyscallError::ECONNREFUSED
         
     | 
| 
      
 39 
     | 
    
         
            +
              deprecate_constant :ConnectionRefusedError
         
     | 
| 
      
 40 
     | 
    
         
            +
              ConnectionResetError = SyscallError::ECONNRESET
         
     | 
| 
      
 41 
     | 
    
         
            +
              deprecate_constant :ConnectionResetError
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
       35 
43 
     | 
    
         
             
              class BaseError < StandardError
         
     | 
| 
       36 
44 
     | 
    
         
             
                include Error
         
     | 
| 
       37 
45 
     | 
    
         | 
| 
         @@ -58,21 +66,7 @@ class Trilogy 
     | 
|
| 
       58 
66 
     | 
    
         
             
              class CastError < ClientError
         
     | 
| 
       59 
67 
     | 
    
         
             
              end
         
     | 
| 
       60 
68 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
              class TimeoutError <  
     | 
| 
       62 
     | 
    
         
            -
                include ConnectionError
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                def initialize(error_message = nil, error_code = nil)
         
     | 
| 
       65 
     | 
    
         
            -
                  super
         
     | 
| 
       66 
     | 
    
         
            -
                  @error_code = error_code
         
     | 
| 
       67 
     | 
    
         
            -
                end
         
     | 
| 
       68 
     | 
    
         
            -
              end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
              class ConnectionRefusedError < Errno::ECONNREFUSED
         
     | 
| 
       71 
     | 
    
         
            -
                include ConnectionError
         
     | 
| 
       72 
     | 
    
         
            -
              end
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
              class ConnectionResetError < Errno::ECONNRESET
         
     | 
| 
       75 
     | 
    
         
            -
                include ConnectionError
         
     | 
| 
      
 69 
     | 
    
         
            +
              class TimeoutError < BaseConnectionError
         
     | 
| 
       76 
70 
     | 
    
         
             
              end
         
     | 
| 
       77 
71 
     | 
    
         | 
| 
       78 
72 
     | 
    
         
             
              # DatabaseError was replaced by ProtocolError, but we'll keep it around as an
         
     | 
    
        data/lib/trilogy/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: trilogy
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.7.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - GitHub Engineering
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024-01- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-01-23 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rake-compiler
         
     | 
| 
         @@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       102 
102 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       103 
103 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       104 
104 
     | 
    
         
             
            requirements: []
         
     | 
| 
       105 
     | 
    
         
            -
            rubygems_version: 3.4. 
     | 
| 
      
 105 
     | 
    
         
            +
            rubygems_version: 3.4.7
         
     | 
| 
       106 
106 
     | 
    
         
             
            signing_key:
         
     | 
| 
       107 
107 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       108 
108 
     | 
    
         
             
            summary: A friendly MySQL-compatible library for Ruby, binding to libtrilogy
         
     |