embulk-filter-mysql 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7dee585e2b80d2158e70ee32028bee401ea9f21
4
- data.tar.gz: ce71e605f40be4a449379e6322927457ca18558e
3
+ metadata.gz: 7020a8e284723e9158697c85419dfce529911072
4
+ data.tar.gz: 0f7d65646e185d7f5aee2e73288475a0cf7dfcb0
5
5
  SHA512:
6
- metadata.gz: 18c8bf4569c9be072cfaa39bcf213fa5aed4875902a1010a3aa8c785d2fedbb28dcfe8afb9fc2a6c831f1ee5d8bf34cefae16f28c33483eaeb1a56e13ba5365f
7
- data.tar.gz: 2043954828f36a5778dbd8a1eaa7589f22cae8e667ad572dabdf53de3f8c565f799ca0c4694006b8e32d39a9c4b50225eb259eaac9cb270b074101ae235fd163
6
+ metadata.gz: 0f089e8d9c715fb00c1fd4db24280fefa7d588e7dff919d409e8ccb3c5aaadacd76e4d8fb22fb9a63dfc95abd1ddfd66860d7b0ae47f653c417ab94bab24a39e
7
+ data.tar.gz: d4c74cb9b1d702408e11d559b2234d9bc7a7ccee937058df16c80a11c43c3ff198241996de43cae66c884458b069185fe4546b038370847eccab66afe0ecbe33
@@ -1 +1 @@
1
- jruby-9.0.4.0
1
+ jruby-9.1.5.0
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-filter-mysql"
4
- spec.version = "0.1.1"
4
+ spec.version = "0.1.2"
5
5
  spec.authors = ["toyama0919"]
6
6
  spec.summary = "Mysql filter plugin for Embulk. Execute prepared statements query."
7
7
  spec.description = "Mysql filter plugin for Embulk. Execute prepared statements query."
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.require_paths = ["lib"]
15
15
 
16
16
  spec.add_dependency 'ffi-mysql'
17
- spec.add_development_dependency 'embulk', ['>= 0.8.3']
17
+ spec.add_development_dependency 'embulk', ['>= 0.8.16']
18
18
  spec.add_development_dependency 'bundler', ['>= 1.10.6']
19
19
  spec.add_development_dependency 'rake', ['>= 10.0']
20
20
  end
@@ -1,6 +1,7 @@
1
1
  # coding: UTF-8
2
2
  require 'ffi-mysql'
3
-
3
+ require_relative 'mysql/field'
4
+
4
5
  module Embulk
5
6
  module Filter
6
7
  class Mysql < FilterPlugin
@@ -24,59 +25,28 @@ module Embulk
24
25
  columns = columns + in_schema if task['keep_input']
25
26
 
26
27
  statement.result_metadata.fetch_fields.each do |field|
27
- columns << Column.new(nil, field.name, get_type(field.type))
28
+ columns << Column.new(nil, field.name, get_type(field.name, field.type))
28
29
  end
29
30
 
30
31
  yield(task, columns)
31
32
  end
32
33
 
33
- # ::Mysql::Field::TYPE_DECIMAL = 0
34
- # ::Mysql::Field::TYPE_TINY = 1
35
- # ::Mysql::Field::TYPE_SHORT = 2
36
- # ::Mysql::Field::TYPE_LONG = 3
37
- # ::Mysql::Field::TYPE_FLOAT = 4
38
- # ::Mysql::Field::TYPE_DOUBLE = 5
39
- # ::Mysql::Field::TYPE_NULL = 6
40
- # ::Mysql::Field::TYPE_TIMESTAMP = 7
41
- # ::Mysql::Field::TYPE_LONGLONG = 8
42
- # ::Mysql::Field::TYPE_INT24 = 9
43
- # ::Mysql::Field::TYPE_DATE = 10
44
- # ::Mysql::Field::TYPE_TIME = 11
45
- # ::Mysql::Field::TYPE_DATETIME = 12
46
- # ::Mysql::Field::TYPE_YEAR = 13
47
- # ::Mysql::Field::TYPE_NEWDATE = 14
48
- # ::Mysql::Field::TYPE_VARCHAR = 15
49
- # ::Mysql::Field::TYPE_BIT = 16
50
- # ::Mysql::Field::TYPE_TIMESTAMP2 = 17
51
- # ::Mysql::Field::TYPE_DATETIME2 = 18
52
- # ::Mysql::Field::TYPE_TIME2 = 19
53
- # ::Mysql::Field::TYPE_JSON = 245
54
- # ::Mysql::Field::TYPE_NEWDECIMAL = 246
55
- # ::Mysql::Field::TYPE_ENUM = 247
56
- # ::Mysql::Field::TYPE_SET = 248
57
- # ::Mysql::Field::TYPE_TINY_BLOB = 249
58
- # ::Mysql::Field::TYPE_MEDIUM_BLOB = 250
59
- # ::Mysql::Field::TYPE_LONG_BLOB = 251
60
- # ::Mysql::Field::TYPE_BLOB = 252
61
- # ::Mysql::Field::TYPE_VAR_STRING = 253
62
- # ::Mysql::Field::TYPE_STRING = 254
63
- # ::Mysql::Field::TYPE_GEOMETRY = 255
64
- # ::Mysql::Field::TYPE_CHAR = TYPE_TINY
65
- # ::Mysql::Field::TYPE_INTERVAL = TYPE_ENUM
66
- def self.get_type(type)
34
+ def self.get_type(name, type)
67
35
  case type
68
- when ::Mysql::Field::TYPE_TINY
36
+ when Mysql::Field::TYPE_TINY
69
37
  :boolean
70
- when ::Mysql::Field::TYPE_SHORT, ::Mysql::Field::TYPE_LONG
38
+ when Mysql::Field::TYPE_SHORT, Mysql::Field::TYPE_LONG, Mysql::Field::TYPE_LONGLONG
71
39
  :long
72
- when ::Mysql::Field::TYPE_DOUBLE, ::Mysql::Field::TYPE_FLOAT
40
+ when Mysql::Field::TYPE_DOUBLE, Mysql::Field::TYPE_FLOAT
73
41
  :double
74
- when ::Mysql::Field::TYPE_DATE, ::Mysql::Field::TYPE_DATETIME, ::Mysql::Field::TYPE_TIMESTAMP
42
+ when Mysql::Field::TYPE_DATE, Mysql::Field::TYPE_DATETIME, Mysql::Field::TYPE_TIMESTAMP
75
43
  :timestamp
76
- when ::Mysql::Field::TYPE_BLOB, ::Mysql::Field::TYPE_STRING, ::Mysql::Field::TYPE_VAR_STRING, ::Mysql::Field::TYPE_VARCHAR
44
+ when Mysql::Field::TYPE_BLOB, Mysql::Field::TYPE_STRING, Mysql::Field::TYPE_VAR_STRING, Mysql::Field::TYPE_VARCHAR
77
45
  :string
46
+ when Mysql::Field::TYPE_JSON
47
+ :json
78
48
  else
79
- raise
49
+ raise ConfigError.new "Not support column [#{name}], type_no => [#{type}]"
80
50
  end
81
51
  end
82
52
 
@@ -0,0 +1,62 @@
1
+ module Embulk
2
+ module Filter
3
+ class Mysql < FilterPlugin
4
+ class Field
5
+ TYPE_DECIMAL = 0
6
+ TYPE_TINY = 1
7
+ TYPE_SHORT = 2
8
+ TYPE_LONG = 3
9
+ TYPE_FLOAT = 4
10
+ TYPE_DOUBLE = 5
11
+ TYPE_NULL = 6
12
+ TYPE_TIMESTAMP = 7
13
+ TYPE_LONGLONG = 8
14
+ TYPE_INT24 = 9
15
+ TYPE_DATE = 10
16
+ TYPE_TIME = 11
17
+ TYPE_DATETIME = 12
18
+ TYPE_YEAR = 13
19
+ TYPE_NEWDATE = 14
20
+ TYPE_VARCHAR = 15
21
+ TYPE_BIT = 16
22
+ TYPE_TIMESTAMP2 = 17
23
+ TYPE_DATETIME2 = 18
24
+ TYPE_TIME2 = 19
25
+ TYPE_JSON = 245
26
+ TYPE_NEWDECIMAL = 246
27
+ TYPE_ENUM = 247
28
+ TYPE_SET = 248
29
+ TYPE_TINY_BLOB = 249
30
+ TYPE_MEDIUM_BLOB = 250
31
+ TYPE_LONG_BLOB = 251
32
+ TYPE_BLOB = 252
33
+ TYPE_VAR_STRING = 253
34
+ TYPE_STRING = 254
35
+ TYPE_GEOMETRY = 255
36
+ TYPE_CHAR = TYPE_TINY
37
+ TYPE_INTERVAL = TYPE_ENUM
38
+
39
+ # Flag
40
+ NOT_NULL_FLAG = 1
41
+ PRI_KEY_FLAG = 2
42
+ UNIQUE_KEY_FLAG = 4
43
+ MULTIPLE_KEY_FLAG = 8
44
+ BLOB_FLAG = 16
45
+ UNSIGNED_FLAG = 32
46
+ ZEROFILL_FLAG = 64
47
+ BINARY_FLAG = 128
48
+ ENUM_FLAG = 256
49
+ AUTO_INCREMENT_FLAG = 512
50
+ TIMESTAMP_FLAG = 1024
51
+ SET_FLAG = 2048
52
+ NO_DEFAULT_VALUE_FLAG = 4096
53
+ ON_UPDATE_NOW_FLAG = 8192
54
+ NUM_FLAG = 32768
55
+ PART_KEY_FLAG = 16384
56
+ GROUP_FLAG = 32768
57
+ UNIQUE_FLAG = 65536
58
+ BINCMP_FLAG = 131072
59
+ end
60
+ end
61
+ end
62
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-filter-mysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - toyama0919
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2017-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.8.3
32
+ version: 0.8.16
33
33
  name: embulk
34
34
  prerelease: false
35
35
  type: :development
@@ -37,7 +37,7 @@ dependencies:
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.8.3
40
+ version: 0.8.16
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
@@ -81,6 +81,7 @@ files:
81
81
  - Rakefile
82
82
  - embulk-filter-mysql.gemspec
83
83
  - lib/embulk/filter/mysql.rb
84
+ - lib/embulk/filter/mysql/field.rb
84
85
  homepage: https://github.com/toyama0919/embulk-filter-mysql
85
86
  licenses:
86
87
  - MIT
@@ -101,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
102
  version: '0'
102
103
  requirements: []
103
104
  rubyforge_project:
104
- rubygems_version: 2.4.8
105
+ rubygems_version: 2.6.6
105
106
  signing_key:
106
107
  specification_version: 4
107
108
  summary: Mysql filter plugin for Embulk. Execute prepared statements query.