db-mariadb 0.2.2 → 0.4.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/lib/db/mariadb.rb +1 -1
- data/lib/db/mariadb/connection.rb +2 -6
- data/lib/db/mariadb/native/connection.rb +10 -4
- data/lib/db/mariadb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a5fec76a4d531cdcad6ea1d54e10b6a251895a47207d74acec924a02edc3da5
|
4
|
+
data.tar.gz: a9890c37d02dc2e0493eee2d7af4f89f05de994464c99435eb10ff43bea13ef7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f5aa5144c1194868398e71eaab0dd42361d2c2b8674e41d0f1dda22f2c2f73367f2eda61eca900e8bca5deb5b5a810848db6816a2343217bf0b45be720557a8
|
7
|
+
data.tar.gz: a7a18fa736f1766dbbc0b38b01b71c15c6b844a5b8212063f85c6517db942588c63b92b036e9b229326cf55d2c99cde5c179592496149a05d3210824a0d5d9e3
|
data/lib/db/mariadb.rb
CHANGED
@@ -21,16 +21,12 @@
|
|
21
21
|
# THE SOFTWARE.
|
22
22
|
|
23
23
|
require 'async/pool/resource'
|
24
|
+
require 'async/io/generic'
|
25
|
+
|
24
26
|
require_relative 'native/connection'
|
25
27
|
|
26
28
|
module DB
|
27
29
|
module MariaDB
|
28
|
-
module IO
|
29
|
-
def self.new(fd, mode)
|
30
|
-
Async::IO::Generic.new(::IO.new(fd, mode, autoclose: false))
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
30
|
# This implements the interface between the underyling native interface interface and "standardised" connection interface.
|
35
31
|
class Connection < Async::Pool::Resource
|
36
32
|
def initialize(**options)
|
@@ -19,7 +19,7 @@
|
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
21
|
require_relative 'result'
|
22
|
-
|
22
|
+
require_relative '../error'
|
23
23
|
|
24
24
|
module DB
|
25
25
|
module MariaDB
|
@@ -63,8 +63,14 @@ module DB
|
|
63
63
|
|
64
64
|
attach_function :mysql_real_escape_string, [:pointer, :pointer, :string, :size_t], :size_t
|
65
65
|
|
66
|
+
module IO
|
67
|
+
def self.new(fd, mode)
|
68
|
+
Async::IO::Generic.new(::IO.new(fd, mode, autoclose: false))
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
66
72
|
class Connection < FFI::Pointer
|
67
|
-
def self.connect(
|
73
|
+
def self.connect(wrapper: IO, host: 'localhost', user: nil, password: nil, database: nil, port: 0, unix_socket: nil, client_flags: 0, compression: false, types: DEFAULT_TYPES, **options)
|
68
74
|
pointer = Native.mysql_init(nil)
|
69
75
|
Native.mysql_options(pointer, MYSQL_OPT_NONBLOCK, nil)
|
70
76
|
|
@@ -79,7 +85,7 @@ module DB
|
|
79
85
|
status = Native.mysql_real_connect_start(result, pointer, host, user, password, database, port, unix_socket, client_flags);
|
80
86
|
|
81
87
|
if status > 0
|
82
|
-
io =
|
88
|
+
io = wrapper.new(Native.mysql_get_socket(pointer), "r+")
|
83
89
|
|
84
90
|
while status > 0
|
85
91
|
if status & MYSQL_WAIT_READ
|
@@ -101,7 +107,7 @@ module DB
|
|
101
107
|
return self.new(pointer, io, types, **options)
|
102
108
|
end
|
103
109
|
|
104
|
-
def initialize(address, io, types)
|
110
|
+
def initialize(address, io, types, **options)
|
105
111
|
super(address)
|
106
112
|
|
107
113
|
@io = io
|
data/lib/db/mariadb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db-mariadb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|