amalgalite 0.7.3-x86-mswin32-60 → 0.7.4-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +7 -0
- data/lib/amalgalite/database.rb +3 -3
- data/lib/amalgalite/version.rb +1 -1
- data/lib/amalgalite3.so +0 -0
- data/spec/database_spec.rb +16 -0
- data/tasks/config.rb +1 -1
- data/tasks/documentation.rake +2 -3
- metadata +3 -1
data/HISTORY
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
= Amalgalite Changelog
|
2
|
+
== Version 0.7.4 - 2009-02-08
|
3
|
+
|
4
|
+
=== Bug Fixes
|
5
|
+
|
6
|
+
* fix Database#first_row_from not behaving the same as Database#execute() when
|
7
|
+
there are no results. [reported by James Edward Gray II]
|
8
|
+
|
2
9
|
== Version 0.7.3 - 2009-02-08
|
3
10
|
|
4
11
|
=== Enhancements
|
data/lib/amalgalite/database.rb
CHANGED
@@ -334,21 +334,21 @@ module Amalgalite
|
|
334
334
|
##
|
335
335
|
# Execute a sql statment, and only return the first row of results. This
|
336
336
|
# is a shorthand method when you only want a single row of results from a
|
337
|
-
# query.
|
337
|
+
# query. If there is no result, then return an empty array
|
338
338
|
#
|
339
339
|
# It is in all other was, exactly like #execute()
|
340
340
|
#
|
341
341
|
def first_row_from( sql, *bind_params )
|
342
342
|
stmt = prepare( sql )
|
343
343
|
stmt.bind( *bind_params)
|
344
|
-
row = stmt.next_row
|
344
|
+
row = stmt.next_row || []
|
345
345
|
stmt.close
|
346
346
|
return row
|
347
347
|
end
|
348
348
|
|
349
349
|
##
|
350
350
|
# Execute an sql statement, and return only the first column of the first
|
351
|
-
# row.
|
351
|
+
# row. If there is no result, return nil.
|
352
352
|
#
|
353
353
|
# It is in all other ways, exactly like #first_row_from()
|
354
354
|
#
|
data/lib/amalgalite/version.rb
CHANGED
data/lib/amalgalite3.so
CHANGED
Binary file
|
data/spec/database_spec.rb
CHANGED
@@ -122,6 +122,11 @@ describe Amalgalite::Database do
|
|
122
122
|
db.execute_batch( @schema ).should == 5
|
123
123
|
end
|
124
124
|
|
125
|
+
it "returns an empty array when there are no results" do
|
126
|
+
row = @iso_db.execute("SELECT * from subcountry where country = 'Antarctica'")
|
127
|
+
row.should be_empty
|
128
|
+
end
|
129
|
+
|
125
130
|
it "traces the execution of code" do
|
126
131
|
db = Amalgalite::Database.new( SpecInfo.test_db )
|
127
132
|
sql = "CREATE TABLE trace_test( x, y, z)"
|
@@ -360,6 +365,7 @@ describe Amalgalite::Database do
|
|
360
365
|
all_sub.should == ( us_sub + other_sub )
|
361
366
|
|
362
367
|
end
|
368
|
+
|
363
369
|
it "rolls back a savepoint" do
|
364
370
|
all_sub = @iso_db.execute("SELECT count(*) as cnt from subcountry").first['cnt']
|
365
371
|
lambda {
|
@@ -413,6 +419,16 @@ describe Amalgalite::Database do
|
|
413
419
|
row['count'].should == 232
|
414
420
|
end
|
415
421
|
|
422
|
+
it "returns and empty row if there are no results for the first row" do
|
423
|
+
row = @iso_db.first_row_from("SELECT * from subcountry where country = 'Antarctica'")
|
424
|
+
row.should be_empty
|
425
|
+
end
|
426
|
+
|
427
|
+
it "returns nil if there is no value in the first value" do
|
428
|
+
val = @iso_db.first_value_from("select * from subcountry where country = 'Antarctica'" )
|
429
|
+
val.should == nil
|
430
|
+
end
|
431
|
+
|
416
432
|
it "returns the first value of results as a conveinience" do
|
417
433
|
val = @iso_db.first_value_from("SELECT count(*) from subcountry ")
|
418
434
|
val.should == 3995
|
data/tasks/config.rb
CHANGED
@@ -85,7 +85,7 @@ Configuration.for('rdoc') {
|
|
85
85
|
files Configuration.for('packaging').files.rdoc
|
86
86
|
main_page files.first
|
87
87
|
title Configuration.for('project').name
|
88
|
-
options %w[ --line-numbers --inline-source
|
88
|
+
options %w[ --line-numbers --inline-source -T darkfish ]
|
89
89
|
output_dir "doc"
|
90
90
|
}
|
91
91
|
|
data/tasks/documentation.rake
CHANGED
@@ -8,9 +8,8 @@ if rdoc_config = Configuration.for_if_exist?('rdoc') then
|
|
8
8
|
|
9
9
|
namespace :doc do
|
10
10
|
|
11
|
+
require 'rdoc'
|
11
12
|
require 'rake/rdoctask'
|
12
|
-
#gem 'darkfish-rdoc'
|
13
|
-
#require 'darkfish-rdoc'
|
14
13
|
|
15
14
|
# generating documentation locally
|
16
15
|
Rake::RDocTask.new do |rdoc|
|
@@ -19,7 +18,7 @@ if rdoc_config = Configuration.for_if_exist?('rdoc') then
|
|
19
18
|
rdoc.rdoc_files = rdoc_config.files
|
20
19
|
rdoc.title = rdoc_config.title
|
21
20
|
rdoc.main = rdoc_config.main_page
|
22
|
-
end
|
21
|
+
end
|
23
22
|
|
24
23
|
if rubyforge_config = Configuration.for_if_exist?('rubyforge') then
|
25
24
|
desc "Deploy the RDoc documentation to #{rubyforge_config.rdoc_location}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amalgalite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: x86-mswin32-60
|
6
6
|
authors:
|
7
7
|
- Jeremy Hinegardner
|
@@ -187,6 +187,8 @@ post_install_message:
|
|
187
187
|
rdoc_options:
|
188
188
|
- --line-numbers
|
189
189
|
- --inline-source
|
190
|
+
- -T
|
191
|
+
- darkfish
|
190
192
|
- --main
|
191
193
|
- README
|
192
194
|
require_paths:
|