Skip to content

Commit 40a282c

Browse files
committed
Initial work towards 0.6 compat
1 parent 2610faa commit 40a282c

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/Source.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ function Source(db::DB, sql::AbstractString, values=[]; rows::Int=-1, stricttype
1414
bind!(stmt, values)
1515
status = SQLite.execute!(stmt)
1616
cols = SQLite.sqlite3_column_count(stmt.handle)
17-
header = Array(String, cols)
18-
types = Array(DataType, cols)
17+
header = Vector{String}(cols)
18+
types = Vector{DataType}(cols)
1919
for i = 1:cols
2020
header[i] = unsafe_string(SQLite.sqlite3_column_name(stmt.handle, i))
2121
# do better column type inference; query what the column was created for?

src/consts.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ include("../deps/deps.jl")
22

33
#Macros
44
macro OK(func)
5-
:($func == SQLITE_OK)
5+
:($(esc(func)) == SQLITE_OK)
66
end
77

88
macro CHECK(db,ex)
9-
quote
9+
esc(quote
1010
if !(@OK $ex)
1111
sqliteerror($db)
1212
end
1313
SQLITE_OK
14-
end
14+
end)
1515
end
1616

1717
const SQLNullPtrError = SQLiteException("Cannot operate on null pointer")
1818
macro NULLCHECK(ptr)
19-
quote
19+
esc(quote
2020
if $ptr == C_NULL
2121
throw(SQLNullPtrError)
2222
end
23-
end
23+
end)
2424
end
2525

2626
#Return codes
@@ -135,7 +135,7 @@ const SQLITE_CONFIG_HEAP = 8 # /* void*, int nByte, int min */
135135
const SQLITE_CONFIG_MEMSTATUS = 9 # /* boolean */
136136
const SQLITE_CONFIG_MUTEX = 10 # /* sqlite3_mutex_methods* */
137137
const SQLITE_CONFIG_GETMUTEX = 11 # /* sqlite3_mutex_methods* */
138-
#/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
138+
#/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
139139
const SQLITE_CONFIG_LOOKASIDE = 13 # /* int int */
140140
const SQLITE_CONFIG_PCACHE = 14 # /* no-op */
141141
const SQLITE_CONFIG_GETPCACHE = 15 # /* no-op */

test/runtests.jl

Lines changed: 3 additions & 3 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_approx_eq get(i) 3*get(j)
142+
@test 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_approx_eq get(r[1,1]) 2*sum(convert(Vector{Float64},s.columns[1]))
180+
@test 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)
@@ -225,7 +225,7 @@ finalize(db); db = nothing; gc(); gc();
225225

226226
#Make sure we handle undefined values
227227
db = SQLite.DB() #In case the order of tests is changed
228-
arr = Array(String,2)
228+
arr = Vector{String}(2)
229229
arr[1] = "1" #Now an array with the second value undefined
230230
dt = DataFrame(Any[NullableArrays.NullableArray(arr, [false, true])])
231231
SQLite.drop!(db, "temp", ifexists=true)

0 commit comments

Comments
 (0)