bezel-app 0.1.10 → 0.1.11

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: c30968d753082d5f2b34fbabc9b8669422cc5469
4
- data.tar.gz: 08c33c687334679bfde1e7ce705cbeb68b2d503c
3
+ metadata.gz: 712cead3fa2404bdb93797fdb6d41b573d0a0743
4
+ data.tar.gz: 788b2c44e730c5d752c0343c7ef22775fd3153c8
5
5
  SHA512:
6
- metadata.gz: 2cdae1047afa5149718065eb39a0c2b728010ee8256068e796f31cf064dfe813a1b2b0ff0f96275f2dce4b28afaf8f4f39ca8c10a2140aa51def0e9cf3099bf3
7
- data.tar.gz: a38b4893d7a1cb377340552a4fb2abf2ee176f3f4380df910aa02055aabac07a1d942074b7c0d18819e7439675df473c8aed437bd19273530d350ab22e0b012c
6
+ metadata.gz: 13d2fc6951a86b8bcbd8e707ac129b85946b27e0cadb13d25e37fcb034af03b600069084a081a93b70b67e9fe46426dbdbd4904f7c1df65da4cae33c45b4f3e7
7
+ data.tar.gz: a5e354a65fde9cdc440c79a0ec789f5468d0f663f632bf0c9144eb7fbd0d0a09f06aa9d2754521ecad9e9f7b009e71678b234ab8ddba3607bed8ab731ae39532
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'bezel-app'
8
- spec.version = '0.1.10'
8
+ spec.version = '0.1.11'
9
9
  spec.authors = ['Keith Thompson']
10
10
  spec.email = ['KeithM_Thompson@outlook.com']
11
11
 
@@ -90,7 +90,7 @@ module Bezel
90
90
  def insert
91
91
  columns = self.class.columns
92
92
  columns = columns.reject { |col| col == :id }
93
- debugger
93
+
94
94
  DBConnection.execute(<<-SQL, attribute_values)
95
95
  INSERT INTO
96
96
  #{ self.class.table_name } (#{ columns.join(", ") })
@@ -43,9 +43,10 @@ MIGRATIONS = Dir.glob('./db/migrate/*.sql').to_a
43
43
  SQL
44
44
  end
45
45
 
46
- def self.execute(*args)
47
- print_query(*args)
48
- instance.exec(*args)
46
+ def self.execute(query, params = [])
47
+ query = number_placeholders(query)
48
+ print_query(query, params)
49
+ instance.exec(query, params)
49
50
  end
50
51
 
51
52
  def self.instance
@@ -86,7 +87,19 @@ MIGRATIONS = Dir.glob('./db/migrate/*.sql').to_a
86
87
  filename[0..u_idx - 1]
87
88
  end
88
89
 
89
- def self.print_query(query, *interpolation_args)
90
+ def self.number_placeholders(query_string)
91
+ count = 0
92
+ query_string.chars.map do |char|
93
+ if char == "?"
94
+ count += 1
95
+ "$#{count}"
96
+ else
97
+ char
98
+ end
99
+ end.join("")
100
+ end
101
+
102
+ def self.print_query(query, interpolation_args)
90
103
  return unless PRINT_QUERIES
91
104
 
92
105
  puts '--------------------'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bezel-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Thompson