db-mariadb 0.1.0 → 0.2.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/connection.rb +11 -1
- data/lib/db/mariadb/native/connection.rb +3 -9
- data/lib/db/mariadb/version.rb +1 -1
- metadata +2 -3
- data/lib/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a67b6bf206b453ebb0fb94ee60f27581bc6ebe6d9acdc5190e6e61b3ba35a839
|
4
|
+
data.tar.gz: afca519606ee8d3125ac11c1301612dcb496d1bf93eeaec951e7162c0ff6b7fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b8a9d6b33e6603dfafe5b0935cb335f13c1265da97a7f814bdff5cc9cd4ca91cbfc396d8723260232f00025c2a237c34287ab765c6a4b8f8c730840a32e0e6
|
7
|
+
data.tar.gz: c15bfe8bf00dfde7c022e88a737382eb4e0ceb8ece8af80a5e54eb70d5f368cfe3b500c2806d3c4f65f9ca12b61f62d720bce0c8c3fab09690cb816a40ee2afe
|
@@ -25,6 +25,12 @@ require_relative 'native/connection'
|
|
25
25
|
|
26
26
|
module DB
|
27
27
|
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
|
+
|
28
34
|
# This implements the interface between the underyling native interface interface and "standardised" connection interface.
|
29
35
|
class Connection < Async::Pool::Resource
|
30
36
|
def initialize(**options)
|
@@ -49,8 +55,12 @@ module DB
|
|
49
55
|
case value
|
50
56
|
when Numeric
|
51
57
|
buffer << value.to_s
|
58
|
+
when TrueClass
|
59
|
+
buffer << 'TRUE'
|
60
|
+
when FalseClass
|
61
|
+
buffer << 'FALSE'
|
52
62
|
when nil
|
53
|
-
buffer <<
|
63
|
+
buffer << 'NULL'
|
54
64
|
else
|
55
65
|
append_string(value, buffer)
|
56
66
|
end
|
@@ -62,14 +62,8 @@ module DB
|
|
62
62
|
|
63
63
|
attach_function :mysql_real_escape_string, [:pointer, :pointer, :string, :size_t], :size_t
|
64
64
|
|
65
|
-
module IO
|
66
|
-
def self.new(fd, mode)
|
67
|
-
Async::IO::Generic.new(::IO.new(fd, mode, autoclose: false))
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
65
|
class Connection < FFI::Pointer
|
72
|
-
def self.connect(host: 'localhost', user: nil, password: nil, database: nil, port: 0, unix_socket: nil, client_flags: 0, compression: false, types: DEFAULT_TYPES, **options)
|
66
|
+
def self.connect(io: IO, host: 'localhost', user: nil, password: nil, database: nil, port: 0, unix_socket: nil, client_flags: 0, compression: false, types: DEFAULT_TYPES, **options)
|
73
67
|
pointer = Native.mysql_init(nil)
|
74
68
|
Native.mysql_options(pointer, MYSQL_OPT_NONBLOCK, nil)
|
75
69
|
|
@@ -103,10 +97,10 @@ module DB
|
|
103
97
|
raise "Could not connect: #{Native.mysql_error(pointer)}!"
|
104
98
|
end
|
105
99
|
|
106
|
-
return self.new(pointer, io, types
|
100
|
+
return self.new(pointer, io, types, **options)
|
107
101
|
end
|
108
102
|
|
109
|
-
def initialize(address, io, types
|
103
|
+
def initialize(address, io, types)
|
110
104
|
super(address)
|
111
105
|
|
112
106
|
@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.2.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-
|
11
|
+
date: 2020-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -114,7 +114,6 @@ executables: []
|
|
114
114
|
extensions: []
|
115
115
|
extra_rdoc_files: []
|
116
116
|
files:
|
117
|
-
- lib/.DS_Store
|
118
117
|
- lib/db/mariadb.rb
|
119
118
|
- lib/db/mariadb/adapter.rb
|
120
119
|
- lib/db/mariadb/connection.rb
|
data/lib/.DS_Store
DELETED
Binary file
|