baza 0.0.36 → 0.0.37

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
- SHA1:
3
- metadata.gz: fae6535d9e34fae8460213071209a7657c8dbe97
4
- data.tar.gz: a3289f1628a01ca32000f3d9e96beef9033b00f8
2
+ SHA256:
3
+ metadata.gz: d202a1ba85d839b238bbeece2e3fc217257f14ac2eb75f95c60385051fa20b62
4
+ data.tar.gz: 6781add95eb27f16cb5597ab550da7ee3ad0bf174de1ac146afc18278645c75e
5
5
  SHA512:
6
- metadata.gz: 5a71d39ad1ba7a1b682a0b88800567ced7e94cfe3e489049f00e09b0dd8383645eca9ab04e45f68e8c3abf14e35b596efe5a58d8da647054c65b25b26bbee6f1
7
- data.tar.gz: 1e5ec98de5eef606d1f483d67109a8563ca8bb65e9d52cff3c25e2cecd8eca809611552790ad9826b2499eca8ccbbebd831ed6000485b4349b260fb6ba43f9a2
6
+ metadata.gz: 2b3d6816458dd8b48668bd8706af772ba7cfefb3051c56cedd8fb829ca9c0259eb6f0b25f428022ad29c9dee15edb14599ac3938caedd8eaad6507a8f1940b46
7
+ data.tar.gz: 1842d03a4097a659c8d8ed3a42f7283102553be3d4e25eae38216f05c0750ec8efd6d09d53c3a6beed8fbd92f931d1199eeb866bcb63c83aca95ea3432a1433e
@@ -1 +1 @@
1
- 2.3.6
1
+ 2.5.7
data/Gemfile CHANGED
@@ -28,5 +28,5 @@ group :development, :test do
28
28
  gem "rdoc"
29
29
  gem "rspec", "3.4.0"
30
30
  gem "rubocop", "0.39.0", require: false
31
- gem "sqlite3", platform: :ruby
31
+ gem "sqlite3", "< 1.5", platform: :ruby
32
32
  end
@@ -1,21 +1,20 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activemodel (5.2.0)
5
- activesupport (= 5.2.0)
6
- activerecord (5.2.0)
7
- activemodel (= 5.2.0)
8
- activesupport (= 5.2.0)
9
- arel (>= 9.0)
10
- activerecord-jdbc-adapter (50.0)
11
- activerecord (>= 2.2)
12
- activesupport (5.2.0)
4
+ activemodel (6.0.2.1)
5
+ activesupport (= 6.0.2.1)
6
+ activerecord (6.0.2.1)
7
+ activemodel (= 6.0.2.1)
8
+ activesupport (= 6.0.2.1)
9
+ activerecord-jdbc-adapter (60.1-java)
10
+ activerecord (~> 6.0.0)
11
+ activesupport (6.0.2.1)
13
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
13
  i18n (>= 0.7, < 2)
15
14
  minitest (~> 5.1)
16
15
  tzinfo (~> 1.1)
16
+ zeitwerk (~> 2.2)
17
17
  addressable (2.4.0)
18
- arel (9.0.0)
19
18
  array_enumerator (0.0.10)
20
19
  ast (2.4.0)
21
20
  auto_autoloader (0.0.5)
@@ -24,8 +23,7 @@ GEM
24
23
  auto_autoloader
25
24
  builder (3.2.3)
26
25
  coderay (1.1.2)
27
- concurrent-ruby (1.0.5)
28
- concurrent-ruby (1.0.5-java)
26
+ concurrent-ruby (1.1.5)
29
27
  datet (0.0.25)
30
28
  descendants_tracker (0.0.4)
31
29
  thread_safe (~> 0.3, >= 0.3.1)
@@ -33,8 +31,7 @@ GEM
33
31
  event_handler (0.0.0)
34
32
  faraday (0.9.2)
35
33
  multipart-post (>= 1.2, < 3)
36
- ffi (1.9.23)
37
- ffi (1.9.23-java)
34
+ ffi (1.11.1-java)
38
35
  git (1.3.0)
39
36
  github_api (0.16.0)
40
37
  addressable (~> 2.4.0)
@@ -45,11 +42,11 @@ GEM
45
42
  oauth2 (~> 1.0)
46
43
  hashie (3.5.7)
47
44
  highline (1.7.10)
48
- i18n (1.0.1)
45
+ i18n (1.7.0)
49
46
  concurrent-ruby (~> 1.0)
50
47
  jar-dependencies (0.3.12)
51
- jdbc-mysql (5.1.44)
52
- jdbc-sqlite3 (3.20.1)
48
+ jdbc-mysql (5.1.47)
49
+ jdbc-sqlite3 (3.28.0)
53
50
  jeweler (2.3.9)
54
51
  builder
55
52
  bundler
@@ -62,17 +59,17 @@ GEM
62
59
  rdoc
63
60
  semver2
64
61
  jwt (1.5.6)
65
- method_source (0.9.0)
62
+ method_source (0.9.2)
66
63
  mime-types (2.99.3)
67
- mini_portile2 (2.3.0)
68
- minitest (5.11.3)
64
+ mini_portile2 (2.4.0)
65
+ minitest (5.13.0)
69
66
  multi_json (1.13.1)
70
67
  multi_xml (0.6.0)
71
68
  multipart-post (2.0.0)
72
69
  mysql2 (0.4.10)
73
- nokogiri (1.8.2)
74
- mini_portile2 (~> 2.3.0)
75
- nokogiri (1.8.2-java)
70
+ nokogiri (1.10.5)
71
+ mini_portile2 (~> 2.4.0)
72
+ nokogiri (1.10.5-java)
76
73
  oauth2 (1.4.0)
77
74
  faraday (>= 0.8, < 0.13)
78
75
  jwt (~> 1.0)
@@ -83,21 +80,21 @@ GEM
83
80
  ast (~> 2.4.0)
84
81
  pg (0.21.0)
85
82
  powerpack (0.1.1)
86
- pry (0.11.3)
83
+ pry (0.12.2)
87
84
  coderay (~> 1.1.0)
88
85
  method_source (~> 0.9.0)
89
- pry (0.11.3-java)
86
+ pry (0.12.2-java)
90
87
  coderay (~> 1.1.0)
91
88
  method_source (~> 0.9.0)
92
89
  spoon (~> 0.0)
93
90
  psych (3.0.2)
94
91
  psych (3.0.2-java)
95
92
  jar-dependencies (>= 0.1.7)
96
- rack (2.0.4)
93
+ rack (2.0.8)
97
94
  rainbow (2.2.2)
98
95
  rake
99
96
  rake (12.3.1)
100
- rdoc (6.0.3)
97
+ rdoc (6.2.1)
101
98
  rspec (3.4.0)
102
99
  rspec-core (~> 3.4.0)
103
100
  rspec-expectations (~> 3.4.0)
@@ -122,14 +119,15 @@ GEM
122
119
  simple_delegate (0.0.2)
123
120
  spoon (0.0.6)
124
121
  ffi
125
- sqlite3 (1.3.13)
122
+ sqlite3 (1.4.2)
126
123
  string-cases (0.0.4)
127
124
  thread_safe (0.3.6)
128
125
  thread_safe (0.3.6-java)
129
- tzinfo (1.2.5)
126
+ tzinfo (1.2.6)
130
127
  thread_safe (~> 0.1)
131
128
  unicode-display_width (1.3.0)
132
129
  wref (0.0.8)
130
+ zeitwerk (2.2.2)
133
131
 
134
132
  PLATFORMS
135
133
  java
@@ -154,9 +152,9 @@ DEPENDENCIES
154
152
  rspec (= 3.4.0)
155
153
  rubocop (= 0.39.0)
156
154
  simple_delegate (~> 0.0.2)
157
- sqlite3
155
+ sqlite3 (< 1.5)
158
156
  string-cases (~> 0.0.4)
159
157
  wref (~> 0.0.8)
160
158
 
161
159
  BUNDLED WITH
162
- 1.16.2
160
+ 1.17.3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.36
1
+ 0.0.37
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: baza 0.0.36 ruby lib
5
+ # stub: baza 0.0.37 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "baza".freeze
9
- s.version = "0.0.36"
9
+ s.version = "0.0.37"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Kasper Johansen".freeze]
14
- s.date = "2018-06-27"
14
+ s.date = "2020-01-07"
15
15
  s.description = "A database abstraction layer, model framework and database framework.".freeze
16
16
  s.email = "kj@gfish.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -175,6 +175,7 @@ Gem::Specification.new do |s|
175
175
  "spec/drivers/mysql2_spec.rb",
176
176
  "spec/drivers/mysql_spec.rb",
177
177
  "spec/drivers/pg/columns_spec.rb",
178
+ "spec/drivers/pg/table_spec.rb",
178
179
  "spec/drivers/pg_spec.rb",
179
180
  "spec/drivers/sqlite3_spec.rb",
180
181
  "spec/drivers/tiny_spec.rb",
@@ -206,7 +207,7 @@ Gem::Specification.new do |s|
206
207
  ]
207
208
  s.homepage = "http://github.com/kaspernj/baza".freeze
208
209
  s.licenses = ["MIT".freeze]
209
- s.rubygems_version = "2.6.14".freeze
210
+ s.rubygems_version = "3.0.6".freeze
210
211
  s.summary = "A database abstraction layer, model framework and database framework.".freeze
211
212
 
212
213
  if s.respond_to? :specification_version then
@@ -233,7 +234,7 @@ Gem::Specification.new do |s|
233
234
  s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
234
235
  s.add_development_dependency(%q<rspec>.freeze, ["= 3.4.0"])
235
236
  s.add_development_dependency(%q<rubocop>.freeze, ["= 0.39.0"])
236
- s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
237
+ s.add_development_dependency(%q<sqlite3>.freeze, ["< 1.5"])
237
238
  else
238
239
  s.add_dependency(%q<array_enumerator>.freeze, ["~> 0.0.10"])
239
240
  s.add_dependency(%q<auto_autoloader>.freeze, ["~> 0.0.5"])
@@ -255,7 +256,7 @@ Gem::Specification.new do |s|
255
256
  s.add_dependency(%q<rdoc>.freeze, [">= 0"])
256
257
  s.add_dependency(%q<rspec>.freeze, ["= 3.4.0"])
257
258
  s.add_dependency(%q<rubocop>.freeze, ["= 0.39.0"])
258
- s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
259
+ s.add_dependency(%q<sqlite3>.freeze, ["< 1.5"])
259
260
  end
260
261
  else
261
262
  s.add_dependency(%q<array_enumerator>.freeze, ["~> 0.0.10"])
@@ -278,7 +279,7 @@ Gem::Specification.new do |s|
278
279
  s.add_dependency(%q<rdoc>.freeze, [">= 0"])
279
280
  s.add_dependency(%q<rspec>.freeze, ["= 3.4.0"])
280
281
  s.add_dependency(%q<rubocop>.freeze, ["= 0.39.0"])
281
- s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
282
+ s.add_dependency(%q<sqlite3>.freeze, ["< 1.5"])
282
283
  end
283
284
  end
284
285
 
@@ -14,7 +14,9 @@ class Baza::Driver::ActiveRecord::Result < Baza::ResultBase
14
14
  return unless @result
15
15
 
16
16
  @result.each do |result|
17
- result = result.delete_if { |k, _v| k.class.name == "Fixnum" } # Seems like this happens depending on the version installed? - kaspernj
17
+ # Seems like this happens depending on the version installed? - kaspernj
18
+ result = result.delete_if { |k, _v| k.class.name == "Integer" || k.class.name == "Fixnum" }
19
+
18
20
  result = Hash[result.map { |k, v| [k, v.to_s] }] if @type_translation == :string
19
21
 
20
22
  yield result.symbolize_keys
@@ -70,7 +70,7 @@ class Baza::Driver::Pg < Baza::BaseSqlDriver
70
70
 
71
71
  args = {dbname: db.opts.fetch(:db)}
72
72
  args[:port] = db.opts.fetch(:port) if db.opts[:port]
73
- args[:hostaddr] = db.opts.fetch(:host) if db.opts[:host]
73
+ args[:host] = db.opts.fetch(:host) if db.opts[:host]
74
74
  args[:user] = db.opts.fetch(:user) if db.opts[:user]
75
75
  args[:password] = db.opts.fetch(:pass) if db.opts[:pass]
76
76
 
@@ -1,9 +1,9 @@
1
1
  class Baza::Driver::Pg::Table < Baza::Table
2
2
  attr_reader :name
3
3
 
4
- def initialize(args)
5
- @db = args.fetch(:driver).db
6
- @data = args.fetch(:data)
4
+ def initialize(driver:, data:)
5
+ @db = driver.db
6
+ @data = data
7
7
  @name = @data.fetch(:table_name)
8
8
  end
9
9
 
@@ -36,7 +36,7 @@ class Baza::Driver::Pg::Table < Baza::Table
36
36
  end
37
37
 
38
38
  def native?
39
- false
39
+ name == "pg_stat_statements"
40
40
  end
41
41
 
42
42
  def columns(args = {})
@@ -1,8 +1,8 @@
1
1
  class Baza::Driver::Tiny < Baza::BaseSqlDriver
2
- SEPARATOR_DATABASE = "[".freeze
3
- SEPARATOR_TABLE = "[".freeze
4
- SEPARATOR_COLUMN = "[".freeze
5
- SEPARATOR_INDEX = "[".freeze
2
+ SEPARATOR_DATABASE = "]".freeze
3
+ SEPARATOR_TABLE = "]".freeze
4
+ SEPARATOR_COLUMN = "]".freeze
5
+ SEPARATOR_INDEX = "]".freeze
6
6
  SEPARATOR_VALUE = "'".freeze
7
7
 
8
8
  def initialize(db)
@@ -75,8 +75,7 @@ class Baza::Driver::Tiny < Baza::BaseSqlDriver
75
75
  end
76
76
 
77
77
  def query(sql)
78
- result = @client.execute(sql)
79
- Baza::Driver::Tiny::Result.new(result)
78
+ Baza::Driver::Tiny::Result.new(@client.execute(sql))
80
79
  end
81
80
 
82
81
  def self.quote_identifier(name)
@@ -1,6 +1,7 @@
1
1
  class Baza::Driver::Tiny::Result < Baza::ResultBase
2
2
  def initialize(result)
3
3
  @result = result.to_a
4
+ result.cancel
4
5
  end
5
6
 
6
7
  def each(&blk)
@@ -103,7 +103,7 @@ private
103
103
  begin
104
104
  flush_real(@db_flush_async)
105
105
  rescue => e
106
- $stderr.puts e.inspect
106
+ $stderr.puts "Baza QueryBuffer: #{e.inspect}"
107
107
  $stderr.puts e.backtrace
108
108
  end
109
109
  end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ describe Baza::Driver::Pg::Table do
4
+ let(:constant) do
5
+ const_name = "InfoPg"
6
+ require StringCases.camel_to_snake(const_name)
7
+ raise "Constant was not defined: '#{const_name}'." unless Baza.const_defined?(const_name)
8
+ Baza.const_get(const_name)
9
+ end
10
+ let(:driver) { constant.new }
11
+ let(:db) { driver.db }
12
+
13
+ describe "#native?" do
14
+ it "returns true if the table is 'pg_stat_statements'-table" do
15
+ test_table = Baza::Driver::Pg::Table.new(driver: driver, data: {table_name: "pg_stat_statements"})
16
+
17
+ expect(test_table.native?).to eq true
18
+ end
19
+ end
20
+ end
@@ -6,7 +6,7 @@ class Baza::InfoSqlite3
6
6
 
7
7
  @db = Baza::Db.new({
8
8
  type: :sqlite3,
9
- path: ":memory:",
9
+ path: "#{Dir.tmpdir}/#{SecureRandom.hex(8)}.sqlite3",
10
10
  index_append_table_name: true,
11
11
  sql_to_error: true,
12
12
  debug: false
@@ -1,4 +1,5 @@
1
1
  require "baza"
2
+ require "pry"
2
3
 
3
4
  if RUBY_PLATFORM == "java"
4
5
  require "jdbc/mysql"
@@ -340,7 +340,7 @@ shared_examples_for "a baza driver" do
340
340
  row = db_with_type_translation.select(:test, text: "Kasper").fetch
341
341
 
342
342
  expect(row.fetch(:text).class).to eq String
343
- expect(row.fetch(:number).class.name).to eq "Fixnum"
343
+ expect(row.fetch(:number).class.name).to eq "Integer"
344
344
  expect(row.fetch(:float).class).to eq Float
345
345
 
346
346
  if db.driver.conn.class.name == "ActiveRecord::ConnectionAdapters::SQLite3Adapter"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baza
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.36
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-27 00:00:00.000000000 Z
11
+ date: 2020-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: array_enumerator
@@ -294,16 +294,16 @@ dependencies:
294
294
  name: sqlite3
295
295
  requirement: !ruby/object:Gem::Requirement
296
296
  requirements:
297
- - - ">="
297
+ - - "<"
298
298
  - !ruby/object:Gem::Version
299
- version: '0'
299
+ version: '1.5'
300
300
  type: :development
301
301
  prerelease: false
302
302
  version_requirements: !ruby/object:Gem::Requirement
303
303
  requirements:
304
- - - ">="
304
+ - - "<"
305
305
  - !ruby/object:Gem::Version
306
- version: '0'
306
+ version: '1.5'
307
307
  description: A database abstraction layer, model framework and database framework.
308
308
  email: kj@gfish.com
309
309
  executables: []
@@ -468,6 +468,7 @@ files:
468
468
  - spec/drivers/mysql2_spec.rb
469
469
  - spec/drivers/mysql_spec.rb
470
470
  - spec/drivers/pg/columns_spec.rb
471
+ - spec/drivers/pg/table_spec.rb
471
472
  - spec/drivers/pg_spec.rb
472
473
  - spec/drivers/sqlite3_spec.rb
473
474
  - spec/drivers/tiny_spec.rb
@@ -515,8 +516,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
515
516
  - !ruby/object:Gem::Version
516
517
  version: '0'
517
518
  requirements: []
518
- rubyforge_project:
519
- rubygems_version: 2.6.14
519
+ rubygems_version: 3.0.6
520
520
  signing_key:
521
521
  specification_version: 4
522
522
  summary: A database abstraction layer, model framework and database framework.