Skip to content

Commit 6d779da

Browse files
committed
Add back support for 0.5 and changes tests to work on 0.5 or 0.6
1 parent ba06788 commit 6d779da

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ os:
88

99
julia:
1010
- 0.5
11+
- nightly
1112

1213
notifications:
1314
email: false

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
julia 0.5 0.6
1+
julia 0.5
22
BinDeps
33
@osx Homebrew
44
@windows WinRPM

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ environment:
22
matrix:
33
- JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
44
- JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
5+
- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
6+
- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"
57

68
branches:
79
only:

src/Sink.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ Load a Data.Source `source` into an SQLite table that will be named `tablename`
102102
`temp=true` will create a temporary SQLite table that will be destroyed automatically when the database is closed
103103
`ifnotexists=false` will throw an error if `tablename` already exists in `db`
104104
"""
105-
function load{T}(db, name, ::Type{T}, args...; append::Bool=false, transforms::Dict=Dict{Int,Function}(), kwargs...)
105+
function load{T}(db::SQLite.DB, name, ::Type{T}, args...; append::Bool=false, transforms::Dict=Dict{Int,Function}(), kwargs...)
106106
sink = Data.stream!(T(args...), SQLite.Sink, append, transforms, db, name; kwargs...)
107107
Data.close!(sink)
108108
return sink
109109
end
110-
function load{T}(db, name, source::T; append::Bool=false, transforms::Dict=Dict{Int,Function}(), kwargs...)
110+
function load{T}(db::SQLite.DB, name, source::T; append::Bool=false, transforms::Dict=Dict{Int,Function}(), kwargs...)
111111
sink = Data.stream!(source, SQLite.Sink, append, transforms, db, name; kwargs...)
112112
Data.close!(sink)
113113
return sink

test/datastreams.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,18 @@ function DataFrame(sink, sch::Data.Schema, ::Type{Data.Field}, append::Bool, ref
5353
end
5454

5555
# SQLite
56-
dbfile = joinpath(DSTESTDIR, "randoms.sqlite")
56+
dbfile = joinpath(dirname(@__FILE__), "randoms.sqlite")
5757
dbfile2 = joinpath(dirname(@__FILE__),"test2.sqlite")
58+
db = SQLite.DB(dbfile)
59+
SQLite.load(db, "randoms_small", DF)
5860
cp(dbfile, dbfile2; remove_destination=true)
5961
db2 = SQLite.DB(dbfile2)
6062
SQLite.createtable!(db2, "randoms2_small", Data.schema(SQLite.Source(db2, "select * from randoms_small")))
6163
sqlitesource = Tester("SQLite.Source", SQLite.query, true, SQLite.Source, (db2, "select * from randoms_small"), scalartransforms, vectortransforms, x->x, ()->nothing)
6264
sqlitesink = Tester("SQLite.Sink", SQLite.load, true, SQLite.Sink, (db2, "randoms2_small"), scalartransforms, vectortransforms, x->SQLite.query(db2, "select * from randoms2_small"), (x,y)->nothing)
6365

6466
DataStreamsIntegrationTests.teststream([dfsource, sqlitesource], [dfsink, sqlitesink]; rows=99)
67+
db = db2 = nothing;
68+
gc(); gc();
69+
rm(dbfile)
70+
rm(dbfile2)

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ SQLite.register(db, triple, nargs=1)
139139
r = SQLite.query(db, "SELECT triple(Total) FROM Invoice ORDER BY InvoiceId LIMIT 5")
140140
s = SQLite.query(db, "SELECT Total FROM Invoice ORDER BY InvoiceId LIMIT 5")
141141
for (i, j) in zip(r.columns[1], s.columns[1])
142-
@test get(i) - 3*get(j) < 0.02
142+
@test abs(get(i) - 3*get(j)) < 0.02
143143
end
144144

145145
SQLite.@register db function add4(q)
@@ -177,7 +177,7 @@ doublesum_final(persist) = 2 * persist
177177
SQLite.register(db, 0, doublesum_step, doublesum_final, name="doublesum")
178178
r = SQLite.query(db, "SELECT doublesum(UnitPrice) FROM Track")
179179
s = SQLite.query(db, "SELECT UnitPrice FROM Track")
180-
@test get(r[1,1]) - 2*sum(convert(Vector{Float64},s.columns[1])) < 0.02
180+
@test abs(get(r[1,1]) - 2*sum(convert(Vector{Float64},s.columns[1]))) < 0.02
181181

182182
mycount(p, c) = p + 1
183183
SQLite.register(db, 0, mycount)

0 commit comments

Comments
 (0)