fluiddb2 0.0.1 → 0.0.2

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: 7d3233bc931c69ea807e944dd613485b0f10212c
4
- data.tar.gz: 3c14618c2e985e2a1e419ebffa298dd05b6afccd
3
+ metadata.gz: 6d7fc768792a572f2f218882388672402c9e997f
4
+ data.tar.gz: bd7b314edea9ee8b374d7d25d1c23b5bc4dc58c2
5
5
  SHA512:
6
- metadata.gz: 96a412a1de13c85d00e0fe36ed6bcb144fff9c9a38bb8a48f7e45592793bb1da83b1f104dea45d4c743bebb2448c4cd4c3cef4ad468046cd4a83c6c03cb01dde
7
- data.tar.gz: 3204ac238c68f9a31121de945ae4f5dd3070b0f10732b9deb741623e224c3f5062cbfd64e6cbe62be0be30233600590ac0fde34446275a507380c72073bad799
6
+ metadata.gz: 433accb089f32098956b4e96e7ada53cee25915a1dd0b84df332ba901e2c2055190bdcd8568dbb52c67cf939aa46831ca3ae806a3bb1fbb8ed86f1b5adb86065
7
+ data.tar.gz: 589236691d306c76597dccbe56052932d455498fc03576dbc0be440dd04cac9e515f521508054350b74e15fad6698d07cf02ee915cf6de0e193e5e5457ee95bf
data/lib/fluiddb2.rb CHANGED
@@ -2,8 +2,6 @@ require 'date'
2
2
  require 'time'
3
3
  require 'uri'
4
4
 
5
- require 'fluiddb/db'
6
-
7
5
  # FluidDb2
8
6
  module FluidDb2
9
7
  class ConnectionError < StandardError
@@ -1,4 +1,4 @@
1
- require 'FluidDb2'
1
+ require 'fluiddb2'
2
2
  require 'fb'
3
3
  include Fb
4
4
 
data/lib/fluiddb2/mock.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'FluidDb2'
1
+ require 'fluiddb2'
2
2
 
3
3
  module FluidDb2
4
4
  class SqlNotMatchedError < StandardError
@@ -1,4 +1,4 @@
1
- require 'FluidDb2'
1
+ require 'fluiddb2'
2
2
  require 'mysql'
3
3
 
4
4
  module FluidDb2
@@ -20,31 +20,31 @@ module FluidDb2
20
20
  end
21
21
 
22
22
  def query_for_array(sql, params = [])
23
- sql = format_to_sql(sql, params)
23
+ sql = FluidDb2.format_to_sql(sql, params)
24
24
  results = @connection.query(sql)
25
25
 
26
26
  case results.num_rows
27
27
  when -1
28
- fail FluidDb::ConnectionError
28
+ fail FluidDb2::ConnectionError
29
29
  when 0
30
- fail FluidDb::NoDataFoundError
30
+ fail FluidDb2::NoDataFoundError
31
31
  when 1
32
32
  r = results.fetch_hash
33
33
  return r
34
34
  else
35
- fail FluidDb::TooManyRowsError
35
+ fail FluidDb2::TooManyRowsError
36
36
  end
37
37
  end
38
38
 
39
39
  def query_for_value(sql, params = [])
40
- sql = format_to_sql(sql, params)
40
+ sql = FluidDb2.format_to_sql(sql, params)
41
41
  results = @connection.query(sql)
42
42
 
43
43
  case results.num_rows
44
44
  when -1
45
- fail FluidDb::ConnectionError
45
+ fail FluidDb2::ConnectionError
46
46
  when 0
47
- fail FluidDb::NoDataFoundError
47
+ fail FluidDb2::NoDataFoundError
48
48
  when 1
49
49
  r = nil
50
50
  results.each do |row|
@@ -52,17 +52,17 @@ module FluidDb2
52
52
  end
53
53
  return r[0]
54
54
  else
55
- fail FluidDb::TooManyRowsError
55
+ fail FluidDb2::TooManyRowsError
56
56
  end
57
57
  end
58
58
 
59
59
  def query_for_resultset(sql, params = [])
60
- sql = format_to_sql(sql, params)
60
+ sql = FluidDb2.format_to_sql(sql, params)
61
61
  results = @connection.query(sql)
62
62
 
63
63
  case results.num_rows
64
64
  when -1
65
- fail FluidDb::ConnectionError
65
+ fail FluidDb2::ConnectionError
66
66
  else
67
67
  list = []
68
68
  results.each_hash do |row|
@@ -73,7 +73,7 @@ module FluidDb2
73
73
  end
74
74
 
75
75
  def execute(sql, params = [], expected_affected_rows = nil)
76
- sql = format_to_sql(sql, params)
76
+ sql = FluidDb2.format_to_sql(sql, params)
77
77
  @connection.query(sql)
78
78
 
79
79
  if !expected_affected_rows.nil? && @connection.affected_rows != expected_affected_rows
@@ -1,7 +1,8 @@
1
- require 'FluidDb2'
1
+ require 'fluiddb2'
2
2
  require 'mysql2'
3
3
 
4
4
  module FluidDb2
5
+ # Mysql2
5
6
  class Mysql2 < Base
6
7
  # Connect to Db.
7
8
  #
@@ -12,6 +13,7 @@ module FluidDb2
12
13
  @connection = ::Mysql2::Client.new(:host => uri.host,
13
14
  :database => uri.path.sub('/', ''),
14
15
  :username => uri.user,
16
+ :password => uri.password,
15
17
  :flags => ::Mysql2::Client::FOUND_ROWS)
16
18
  end
17
19
 
@@ -20,14 +22,14 @@ module FluidDb2
20
22
  end
21
23
 
22
24
  def query_for_array(sql, params = [])
23
- sql = format_to_sql(sql, params)
25
+ sql = FluidDb2.format_to_sql(sql, params)
24
26
  results = @connection.query(sql)
25
27
 
26
28
  case results.count
27
29
  when -1
28
- fail FluidDb::ConnectionError
30
+ fail FluidDb2::ConnectionError
29
31
  when 0
30
- fail FluidDb::NoDataFoundError
32
+ fail FluidDb2::NoDataFoundError
31
33
  when 1
32
34
  r = nil
33
35
  results.each do |row|
@@ -35,19 +37,19 @@ module FluidDb2
35
37
  end
36
38
  return r
37
39
  else
38
- fail FluidDb::TooManyRowsError
40
+ fail FluidDb2::TooManyRowsError
39
41
  end
40
42
  end
41
43
 
42
44
  def query_for_value(sql, params = [])
43
- sql = format_to_sql(sql, params)
45
+ sql = FluidDb2.format_to_sql(sql, params)
44
46
  results = @connection.query(sql, :as => :array)
45
47
 
46
48
  case results.count
47
49
  when -1
48
- fail FluidDb::ConnectionError
50
+ fail FluidDb2::ConnectionError
49
51
  when 0
50
- fail FluidDb::NoDataFoundError
52
+ fail FluidDb2::NoDataFoundError
51
53
  when 1
52
54
  r = nil
53
55
  results.each do |row|
@@ -55,17 +57,17 @@ module FluidDb2
55
57
  end
56
58
  return r[0]
57
59
  else
58
- fail FluidDb::TooManyRowsError
60
+ fail FluidDb2::TooManyRowsError
59
61
  end
60
62
  end
61
63
 
62
64
  def query_for_resultset(sql, params = [])
63
- sql = format_to_sql(sql, params)
65
+ sql = FluidDb2.format_to_sql(sql, params)
64
66
  results = @connection.query(sql)
65
67
 
66
68
  case results.count
67
69
  when -1
68
- fail FluidDb::ConnectionError
70
+ fail FluidDb2::ConnectionError
69
71
  else
70
72
  list = []
71
73
  results.each do |row|
@@ -76,7 +78,7 @@ module FluidDb2
76
78
  end
77
79
 
78
80
  def execute(sql, params = [], expected_affected_rows = nil)
79
- sql = format_to_sql(sql, params)
81
+ sql = FluidDb2.format_to_sql(sql, params)
80
82
  @connection.query(sql)
81
83
 
82
84
  if !expected_affected_rows.nil? && @connection.affected_rows != expected_affected_rows
@@ -1,4 +1,4 @@
1
- require 'FluidDb2'
1
+ require 'fluiddb2'
2
2
  require 'pg'
3
3
 
4
4
  module FluidDb2
@@ -1,4 +1,4 @@
1
- require 'FluidDb2'
1
+ require 'fluiddb2'
2
2
  require 'sqlite3'
3
3
 
4
4
  module FluidDb2
@@ -18,60 +18,60 @@ module FluidDb2
18
18
  end
19
19
 
20
20
  def query_for_array(sql, params = [])
21
- sql = format_to_sql(sql, params)
21
+ sql = FluidDb2.format_to_sql(sql, params)
22
22
  @connection.results_as_hash = true
23
23
  results = @connection.execute(sql)
24
24
 
25
25
  case results.length
26
26
  when -1
27
- fail FluidDb::ConnectionError
27
+ fail FluidDb2::ConnectionError
28
28
  when 0
29
- fail FluidDb::NoDataFoundError
29
+ fail FluidDb2::NoDataFoundError
30
30
  when 1
31
31
  return results[0]
32
32
  else
33
- fail FluidDb::TooManyRowsError
33
+ fail FluidDb2::TooManyRowsError
34
34
  end
35
35
  end
36
36
 
37
37
  def query_for_value(sql, params = [])
38
- sql = format_to_sql(sql, params)
38
+ sql = FluidDb2.format_to_sql(sql, params)
39
39
  @connection.results_as_hash = false
40
40
  results = @connection.execute(sql)
41
41
 
42
42
  case results.length
43
43
  when -1
44
- fail FluidDb::ConnectionError
44
+ fail FluidDb2::ConnectionError
45
45
  when 0
46
- fail FluidDb::NoDataFoundError
46
+ fail FluidDb2::NoDataFoundError
47
47
  when 1
48
48
  return results[0][0]
49
49
  else
50
- fail FluidDb::TooManyRowsError
50
+ fail FluidDb2::TooManyRowsError
51
51
  end
52
52
  end
53
53
 
54
54
  def query_for_resultset(sql, params = [])
55
- sql = format_to_sql(sql, params)
55
+ sql = FluidDb2.format_to_sql(sql, params)
56
56
  @connection.results_as_hash = true
57
57
  results = @connection.execute(sql)
58
58
 
59
59
  case results.length
60
60
  when -1
61
- fail FluidDb::ConnectionError
61
+ fail FluidDb2::ConnectionError
62
62
  else
63
63
  return results
64
64
  end
65
65
  end
66
66
 
67
67
  def execute(sql, params = [], expected_affected_rows = nil)
68
- sql = format_to_sql(sql, params)
68
+ sql = FluidDb2.format_to_sql(sql, params)
69
69
 
70
70
  verbose_log "#{self.class.name}.execute. #{sql}"
71
71
  r = @connection.execute(sql)
72
72
 
73
- if !expected_affected_rows.nil? && r.changes != expected_affected_rows
74
- fail ExpectedAffectedRowsError, "Expected affected rows, #{expected_affected_rows}, Actual affected rows, #{r.cmd_tuples}"
73
+ if !expected_affected_rows.nil? && @connection.changes != expected_affected_rows
74
+ fail ExpectedAffectedRowsError, "Expected affected rows, #{expected_affected_rows}, Actual affected rows, #{@connection.changes}"
75
75
  end
76
76
  end
77
77
 
@@ -1,4 +1,4 @@
1
- require 'FluidDb2'
1
+ require 'fluiddb2'
2
2
  require 'tiny_tds'
3
3
  require 'cgi'
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluiddb2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Irvine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-30 00:00:00.000000000 Z
11
+ date: 2016-07-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A semantic layer for db interaction
14
14
  email: guy@guyirvine.com