baza 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,190 +1,181 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baza
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.13
4
+ version: 0.0.14
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kasper Johansen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-06 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- version_requirements: !ruby/object:Gem::Requirement
16
- none: false
14
+ name: datet
15
+ requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - ! '>='
17
+ - - ">="
19
18
  - !ruby/object:Gem::Version
20
19
  version: '0'
21
- name: datet
22
20
  type: :runtime
23
21
  prerelease: false
24
- requirement: !ruby/object:Gem::Requirement
25
- none: false
22
+ version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
- version_requirements: !ruby/object:Gem::Requirement
32
- none: false
28
+ name: wref
29
+ requirement: !ruby/object:Gem::Requirement
33
30
  requirements:
34
- - - ! '>='
31
+ - - ">="
35
32
  - !ruby/object:Gem::Version
36
33
  version: '0'
37
- name: wref
38
34
  type: :runtime
39
35
  prerelease: false
40
- requirement: !ruby/object:Gem::Requirement
41
- none: false
36
+ version_requirements: !ruby/object:Gem::Requirement
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- version_requirements: !ruby/object:Gem::Requirement
48
- none: false
42
+ name: knjrbfw
43
+ requirement: !ruby/object:Gem::Requirement
49
44
  requirements:
50
- - - ! '>='
45
+ - - ">="
51
46
  - !ruby/object:Gem::Version
52
47
  version: '0'
53
- name: knjrbfw
54
48
  type: :runtime
55
49
  prerelease: false
56
- requirement: !ruby/object:Gem::Requirement
57
- none: false
50
+ version_requirements: !ruby/object:Gem::Requirement
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
- version_requirements: !ruby/object:Gem::Requirement
64
- none: false
56
+ name: array_enumerator
57
+ requirement: !ruby/object:Gem::Requirement
65
58
  requirements:
66
- - - ! '>='
59
+ - - ">="
67
60
  - !ruby/object:Gem::Version
68
61
  version: '0'
69
- name: array_enumerator
70
62
  type: :runtime
71
63
  prerelease: false
72
- requirement: !ruby/object:Gem::Requirement
73
- none: false
64
+ version_requirements: !ruby/object:Gem::Requirement
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
- version_requirements: !ruby/object:Gem::Requirement
80
- none: false
70
+ name: string-cases
71
+ requirement: !ruby/object:Gem::Requirement
81
72
  requirements:
82
- - - ! '>='
73
+ - - ">="
83
74
  - !ruby/object:Gem::Version
84
75
  version: '0'
85
- name: string-cases
86
76
  type: :runtime
87
77
  prerelease: false
88
- requirement: !ruby/object:Gem::Requirement
89
- none: false
78
+ version_requirements: !ruby/object:Gem::Requirement
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
- version_requirements: !ruby/object:Gem::Requirement
96
- none: false
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
97
86
  requirements:
98
- - - ~>
87
+ - - ">="
99
88
  - !ruby/object:Gem::Version
100
- version: 2.8.0
101
- name: rspec
89
+ version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
- requirement: !ruby/object:Gem::Requirement
105
- none: false
92
+ version_requirements: !ruby/object:Gem::Requirement
106
93
  requirements:
107
- - - ~>
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
- version: 2.8.0
96
+ version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
- version_requirements: !ruby/object:Gem::Requirement
112
- none: false
98
+ name: rdoc
99
+ requirement: !ruby/object:Gem::Requirement
113
100
  requirements:
114
- - - ~>
101
+ - - ">="
115
102
  - !ruby/object:Gem::Version
116
- version: '3.12'
117
- name: rdoc
103
+ version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
- requirement: !ruby/object:Gem::Requirement
121
- none: false
106
+ version_requirements: !ruby/object:Gem::Requirement
122
107
  requirements:
123
- - - ~>
108
+ - - ">="
124
109
  - !ruby/object:Gem::Version
125
- version: '3.12'
110
+ version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
- version_requirements: !ruby/object:Gem::Requirement
128
- none: false
112
+ name: bundler
113
+ requirement: !ruby/object:Gem::Requirement
129
114
  requirements:
130
- - - ! '>='
115
+ - - ">="
131
116
  - !ruby/object:Gem::Version
132
- version: 1.0.0
133
- name: bundler
117
+ version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
- requirement: !ruby/object:Gem::Requirement
137
- none: false
120
+ version_requirements: !ruby/object:Gem::Requirement
138
121
  requirements:
139
- - - ! '>='
122
+ - - ">="
140
123
  - !ruby/object:Gem::Version
141
- version: 1.0.0
124
+ version: '0'
142
125
  - !ruby/object:Gem::Dependency
143
- version_requirements: !ruby/object:Gem::Requirement
144
- none: false
126
+ name: jeweler
127
+ requirement: !ruby/object:Gem::Requirement
145
128
  requirements:
146
- - - ~>
129
+ - - ">="
147
130
  - !ruby/object:Gem::Version
148
- version: 1.8.4
149
- name: jeweler
131
+ version: '0'
150
132
  type: :development
151
133
  prerelease: false
152
- requirement: !ruby/object:Gem::Requirement
153
- none: false
134
+ version_requirements: !ruby/object:Gem::Requirement
154
135
  requirements:
155
- - - ~>
136
+ - - ">="
156
137
  - !ruby/object:Gem::Version
157
- version: 1.8.4
138
+ version: '0'
158
139
  - !ruby/object:Gem::Dependency
159
- version_requirements: !ruby/object:Gem::Requirement
160
- none: false
140
+ name: sqlite3
141
+ requirement: !ruby/object:Gem::Requirement
161
142
  requirements:
162
- - - ! '>='
143
+ - - ">="
163
144
  - !ruby/object:Gem::Version
164
145
  version: '0'
165
- name: sqlite3
166
146
  type: :development
167
147
  prerelease: false
168
- requirement: !ruby/object:Gem::Requirement
169
- none: false
148
+ version_requirements: !ruby/object:Gem::Requirement
170
149
  requirements:
171
- - - ! '>='
150
+ - - ">="
172
151
  - !ruby/object:Gem::Version
173
152
  version: '0'
174
153
  - !ruby/object:Gem::Dependency
175
- version_requirements: !ruby/object:Gem::Requirement
176
- none: false
154
+ name: mysql2
155
+ requirement: !ruby/object:Gem::Requirement
177
156
  requirements:
178
- - - ! '>='
157
+ - - ">="
179
158
  - !ruby/object:Gem::Version
180
159
  version: '0'
181
- name: mysql2
182
160
  type: :development
183
161
  prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: activerecord
184
169
  requirement: !ruby/object:Gem::Requirement
185
- none: false
186
170
  requirements:
187
- - - ! '>='
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
188
179
  - !ruby/object:Gem::Version
189
180
  version: '0'
190
181
  description: A database abstraction layer, model framework and database framework.
@@ -193,19 +184,20 @@ executables: []
193
184
  extensions: []
194
185
  extra_rdoc_files:
195
186
  - LICENSE.txt
196
- - README.rdoc
187
+ - README.md
197
188
  files:
198
- - .document
199
- - .rspec
189
+ - ".document"
190
+ - ".rspec"
200
191
  - Gemfile
201
192
  - Gemfile.lock
202
193
  - LICENSE.txt
203
- - README.rdoc
194
+ - README.md
204
195
  - Rakefile
205
196
  - VERSION
206
197
  - baza.gemspec
207
198
  - include/db.rb
208
199
  - include/dbtime.rb
200
+ - include/driver.rb
209
201
  - include/drivers/active_record/active_record.rb
210
202
  - include/drivers/mysql/mysql.rb
211
203
  - include/drivers/mysql/mysql_columns.rb
@@ -230,38 +222,44 @@ files:
230
222
  - include/row.rb
231
223
  - include/sqlspecs.rb
232
224
  - lib/baza.rb
233
- - spec/baza_spec.rb
234
- - spec/db_spec_encoding_test_file.txt
225
+ - shippable.yml
226
+ - spec/include/drivers/active_record_spec.rb
227
+ - spec/include/drivers/mysql_spec.rb
228
+ - spec/include/drivers/sqlite3_spec.rb
229
+ - spec/info_active_record.rb
230
+ - spec/info_active_record_example.rb
231
+ - spec/info_active_record_shippable.rb
235
232
  - spec/info_mysql_example.rb
233
+ - spec/info_mysql_shippable.rb
236
234
  - spec/info_sqlite3.rb
237
235
  - spec/model_handler_spec.rb
238
236
  - spec/spec_helper.rb
237
+ - spec/support/driver_collection.rb
238
+ - spec/support/driver_columns_collection.rb
239
+ - spec/support/driver_indexes_collection.rb
240
+ - spec/support/driver_tables_collection.rb
239
241
  homepage: http://github.com/kaspernj/baza
240
242
  licenses:
241
243
  - MIT
244
+ metadata: {}
242
245
  post_install_message:
243
246
  rdoc_options: []
244
247
  require_paths:
245
248
  - lib
246
249
  required_ruby_version: !ruby/object:Gem::Requirement
247
- none: false
248
250
  requirements:
249
- - - ! '>='
251
+ - - ">="
250
252
  - !ruby/object:Gem::Version
251
- segments:
252
- - 0
253
- hash: -1432230654984551532
254
253
  version: '0'
255
254
  required_rubygems_version: !ruby/object:Gem::Requirement
256
- none: false
257
255
  requirements:
258
- - - ! '>='
256
+ - - ">="
259
257
  - !ruby/object:Gem::Version
260
258
  version: '0'
261
259
  requirements: []
262
260
  rubyforge_project:
263
- rubygems_version: 1.8.23
261
+ rubygems_version: 2.4.0
264
262
  signing_key:
265
- specification_version: 3
263
+ specification_version: 4
266
264
  summary: A database abstraction layer, model framework and database framework.
267
265
  test_files: []
data/README.rdoc DELETED
@@ -1,136 +0,0 @@
1
- = baza
2
-
3
- A database abstraction layer for Ruby.
4
-
5
- == Installation
6
-
7
- Is fairly painless.
8
- gem install baza
9
-
10
- == Connection to a database.
11
-
12
- === MySQL
13
- db = Baza::Db.new(:type => :mysql, :subtype => :mysql2, :host => "localhost", :user => "my_user", :pass => "my_password", :port => 3306, :db => "my_database")
14
-
15
- === SQLite3
16
- db = Baza::Db.new(:type => :sqlite3, :path => "/path/to/file.sqlite3")
17
-
18
- == Queries
19
-
20
- === Select
21
- db.select(:users, {:name => "Kasper"}, {:orderby => "age"}) do |row|
22
- puts "Row: #{row}"
23
- end
24
-
25
- name = "Kasper"
26
- db.q("SELECT * FROM users WHERE name = '#{db.esc(name)}' ORDER BY age") do |row|
27
- puts "Row: #{row}"
28
- end
29
-
30
- === Inserting
31
- db.insert(:users, {:name => "Kasper", :age => 27})
32
- id = db.last_id
33
-
34
- It can also return the ID at the same time
35
- id = db.insert(:users, {:name => "Kasper", :age => 27}, :return_id => true)
36
-
37
- Inserting multiple rows in one query is also fairly painless:
38
- db.insert_multi(:users, [
39
- {:name => "Kasper", :age => 27},
40
- {:name => "Christina", :age => 25},
41
- {:name => "Charlotte", :age => 23}
42
- ])
43
-
44
- === Update
45
- db.update(:users, {:name => "Kasper Johansen"}, {:name => "Kasper"})
46
-
47
- === Delete
48
- db.delete(:users, {:name => "Kasper"})
49
-
50
- === Upsert
51
- The following example handels a row that will be inserted with {:name => "Kasper", :age => 27} if it doesnt exist or rows with {:name => "Kasper"} will have their their age updated to 27.
52
- db.upsert(:users, {:name => "Kasper"}, {:age => 27})
53
-
54
- == Structure
55
-
56
- === Table creation
57
- db.tables.create(:users, {
58
- :columns => [
59
- {:name => :id, :type => :int, :autoincr => true, :primarykey => true},
60
- {:name => :name, :type => :varchar}
61
- ],
62
- :indexes => [
63
- :name
64
- ]
65
- })
66
-
67
- === Table dropping
68
- table = db.tables[:users]
69
- table.drop
70
-
71
- === Table listing
72
- array_of_tables = db.tables.list
73
-
74
- Or you can use blocks:
75
- db.tables.list do |table|
76
- puts "Table-name: #{table.name}"
77
- end
78
-
79
- === Table renaming
80
- table = db.tables[:users]
81
- table.rename(:new_table_name)
82
-
83
- === Column listing
84
- table = db.tables[:users]
85
- cols = table.columns
86
-
87
- Or a specific column:
88
- col = table.column(:id)
89
- puts "Column: #{col.name} #{col.type}(#{col.maxlength})"
90
-
91
- == Copying databases
92
- db_mysql = Baza::Db.new(:type => :mysql, :subtype => :mysql2, ...)
93
- db_sqlite = Baza::Db.new(:type => :sqlite3, :path => ...)
94
-
95
- db_mysql.copy_to(db_sqlite)
96
-
97
- == Dumping SQL to an IO
98
- db = Baza::Db.new(...)
99
- dump = Baza::Dump.new(:db => db)
100
- str_io = StringIO.new
101
- dump.dump(str_io)
102
-
103
- == Transactions
104
- db.transaction do
105
- 1000.times do
106
- db.insert(:users, {:name => "Kasper"})
107
- end
108
- end
109
-
110
- == Query Buffer
111
- In order to speed things up, but without using transactions directly, you can use a query buffer. This stores various instructions in memory and flushes them every now and then through transactions or intelligent queries (like multi-insertion). The drawback is that it will not be possible to test the queries for errors before a flush is executed and it wont be possible to read results form any of the queries. It is fairly simple do however:
112
- db.q_buffer do |buffer|
113
- 100_000.times do |count|
114
- buffer.insert(:table_name, {:name => "Kasper #{count}"})
115
-
116
- buffer.query("UPDATE table SET ...")
117
- buffer.query("DELETE FROM table WHERE ...")
118
- end
119
- end
120
-
121
-
122
- == Contributing to baza
123
-
124
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
125
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
126
- * Fork the project.
127
- * Start a feature/bugfix branch.
128
- * Commit and push until you are happy with your contribution.
129
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
130
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
131
-
132
- == Copyright
133
-
134
- Copyright (c) 2013 Kasper Johansen. See LICENSE.txt for
135
- further details.
136
-