db-mariadb 0.2.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/db/mariadb.rb +1 -1
- data/lib/db/mariadb/adapter.rb +0 -2
- data/lib/db/mariadb/connection.rb +0 -6
- data/lib/db/mariadb/native/connection.rb +17 -4
- data/lib/db/mariadb/native/field.rb +3 -0
- data/lib/db/mariadb/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: 86a404e12eedc21b57a6de7b9bdbd5233ec8e026f4983425482a6282850b208c
|
4
|
+
data.tar.gz: cfac0f1fd6b91606ddb9cf50c8bf4fc2a5cdf70ec7227f360b8f447e8cd8ba0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cebdcc060495de35cc9940d092cc613f598b3d512339b2589e8abdf45ab62c9e38f43c166ddeac76061ec44756dbe33b031db212c264cda2cade1e7eb9d70c28
|
7
|
+
data.tar.gz: 9df850b4e73f27df943c6154f21c9a870fe8c26bb88a4569ff66449e0cdb3e16f71f6e094c39463dbd0ce1ab86ecf92d6563d9ce771f6292b7c4664ac61aed27
|
data/lib/db/mariadb.rb
CHANGED
data/lib/db/mariadb/adapter.rb
CHANGED
@@ -27,12 +27,6 @@ require_relative 'native/connection'
|
|
27
27
|
|
28
28
|
module DB
|
29
29
|
module MariaDB
|
30
|
-
module IO
|
31
|
-
def self.new(fd, mode)
|
32
|
-
Async::IO::Generic.new(::IO.new(fd, mode, autoclose: false))
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
30
|
# This implements the interface between the underyling native interface interface and "standardised" connection interface.
|
37
31
|
class Connection < Async::Pool::Resource
|
38
32
|
def initialize(**options)
|
@@ -24,6 +24,9 @@ require_relative '../error'
|
|
24
24
|
module DB
|
25
25
|
module MariaDB
|
26
26
|
module Native
|
27
|
+
MYSQL_PROTOCOL_TCP = 1
|
28
|
+
|
29
|
+
MYSQL_OPT_PROTOCOL = 9
|
27
30
|
MYSQL_OPT_NONBLOCK = 6000
|
28
31
|
|
29
32
|
MYSQL_WAIT_READ = 1
|
@@ -63,11 +66,21 @@ module DB
|
|
63
66
|
|
64
67
|
attach_function :mysql_real_escape_string, [:pointer, :pointer, :string, :size_t], :size_t
|
65
68
|
|
69
|
+
module IO
|
70
|
+
def self.new(fd, mode)
|
71
|
+
Async::IO::Generic.new(::IO.new(fd, mode, autoclose: false))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
66
75
|
class Connection < FFI::Pointer
|
67
|
-
def self.connect(
|
76
|
+
def self.connect(wrapper: IO, host: 'localhost', username: nil, password: nil, database: nil, port: 0, unix_socket: nil, client_flags: 0, compression: false, types: DEFAULT_TYPES, **options)
|
68
77
|
pointer = Native.mysql_init(nil)
|
69
78
|
Native.mysql_options(pointer, MYSQL_OPT_NONBLOCK, nil)
|
70
79
|
|
80
|
+
# if protocol
|
81
|
+
# Native.mysql_options(pointer, MYSQL_OPT_PROTOCOL, FFI::MemoryPointer.new(:uint, protocol))
|
82
|
+
# end
|
83
|
+
|
71
84
|
client_flags |= CLIENT_MULTI_STATEMENT | CLIENT_MULTI_RESULTS
|
72
85
|
|
73
86
|
if compression
|
@@ -76,11 +89,11 @@ module DB
|
|
76
89
|
|
77
90
|
result = FFI::MemoryPointer.new(:pointer)
|
78
91
|
|
79
|
-
status = Native.mysql_real_connect_start(result, pointer, host,
|
92
|
+
status = Native.mysql_real_connect_start(result, pointer, host, username, password, database, port, unix_socket, client_flags);
|
93
|
+
|
94
|
+
io = wrapper.new(Native.mysql_get_socket(pointer), "r+")
|
80
95
|
|
81
96
|
if status > 0
|
82
|
-
io = IO.new(Native.mysql_get_socket(pointer), "r+")
|
83
|
-
|
84
97
|
while status > 0
|
85
98
|
if status & MYSQL_WAIT_READ
|
86
99
|
io.wait_readable
|
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.6.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:
|
11
|
+
date: 2021-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
146
|
+
rubygems_version: 3.1.2
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: An event-driven interface for MariaDB and MySQL servers.
|