infrataster-plugin-mysql 0.1.2 → 0.1.3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8c86c8951f7d448315c546bacbe92db28886686
|
4
|
+
data.tar.gz: b628cd15324540c64a621e1c16c6edaca4b0ed23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe5b84d00a55a8e0c9a6fd1d6e1ef23a13398d0cf23b40b3cb7e4e9b366fddcd6b49a30cd47db5525830f8266c65dc0e965983a235ae53934f728b2467a250d6
|
7
|
+
data.tar.gz: ba6215dd523fd663936efdac8284150a118cc4c4b70755fcf11ed621da1ed2c8e65acb8c20bbea00c30b86ffc755a5bae414120d1276e8d8cb878f98770a21ed
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "infrataster-plugin-mysql"
|
4
|
-
spec.version = '0.1.
|
4
|
+
spec.version = '0.1.3'
|
5
5
|
spec.authors = ["Ryota Arai"]
|
6
6
|
spec.email = ["ryota.arai@gmail.com"]
|
7
7
|
spec.summary = %q{MySQL plugin for Infrataster}
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.require_paths = ["lib"]
|
15
15
|
|
16
16
|
spec.add_runtime_dependency "infrataster", "~> 0.2.6"
|
17
|
-
spec.add_runtime_dependency "mysql2"
|
17
|
+
spec.add_runtime_dependency "mysql2-cs-bind"
|
18
18
|
|
19
19
|
spec.add_development_dependency "bundler", "~> 1.6"
|
20
20
|
spec.add_development_dependency "rake"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'infrataster'
|
2
|
-
require 'mysql2'
|
2
|
+
require 'mysql2-cs-bind'
|
3
3
|
|
4
4
|
module Infrataster
|
5
5
|
module Contexts
|
@@ -17,7 +17,7 @@ module Infrataster
|
|
17
17
|
username: options[:user],
|
18
18
|
password: options[:password],
|
19
19
|
)
|
20
|
-
client.
|
20
|
+
client.xquery(resource.query, *resource.params)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -5,15 +5,16 @@ module Infrataster
|
|
5
5
|
class MysqlQueryResource < BaseResource
|
6
6
|
Error = Class.new(StandardError)
|
7
7
|
|
8
|
-
attr_reader :query
|
8
|
+
attr_reader :query, :params
|
9
9
|
|
10
|
-
def initialize(query,
|
10
|
+
def initialize(query, *args)
|
11
11
|
@query = query
|
12
|
-
@options =
|
12
|
+
@options = args.last.is_a?(Hash) ? args.pop : {}
|
13
|
+
@params = args
|
13
14
|
end
|
14
15
|
|
15
16
|
def to_s
|
16
|
-
"mysql '#{@query}'"
|
17
|
+
"mysql '#{@query}' with #{@params}"
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
data/spec/mysql_query_spec.rb
CHANGED
@@ -7,5 +7,13 @@ describe server(:db) do
|
|
7
7
|
expect(row['Value'].to_i).to be > 0
|
8
8
|
end
|
9
9
|
end
|
10
|
+
|
11
|
+
describe mysql_query('SELECT User, Host FROM mysql.user WHERE User=? AND Host=?', 'app', '%') do
|
12
|
+
it 'binds arguments to query' do
|
13
|
+
row = results.first
|
14
|
+
expect(row['User']).to eq 'app'
|
15
|
+
expect(row['Host']).to eq '%'
|
16
|
+
end
|
17
|
+
end
|
10
18
|
end
|
11
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infrataster-plugin-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: infrataster
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.2.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: mysql2
|
28
|
+
name: mysql2-cs-bind
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.2.2
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: MySQL plugin for Infrataster
|