Skip to content

Commit cafecf0

Browse files
committed
Fixes for julia 0.4
1 parent c6c943f commit cafecf0

File tree

4 files changed

+41
-41
lines changed

4 files changed

+41
-41
lines changed

src/SQLite.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function SQLiteDB(file::AbstractString="";UTF16::Bool=false)
6464
file = isempty(file) ? file : expanduser(file)
6565
if @OK sqliteopen(utf(file),handle)
6666
db = SQLiteDB(utf(file),handle[1])
67-
register(db, regexp, nargs=2)
67+
register(db, regexp, nargs=2, name="regexp")
6868
finalizer(db,close)
6969
return db
7070
else # error
@@ -88,9 +88,9 @@ type SQLiteStmt{T}
8888
sql::T
8989
end
9090

91-
sqliteprepare(db,sql,stmt,null) =
91+
sqliteprepare(db,sql,stmt,null) =
9292
@CHECK db sqlite3_prepare_v2(db.handle,utf8(sql),stmt,null)
93-
sqliteprepare(db::SQLiteDB{UTF16String},sql,stmt,null) =
93+
sqliteprepare(db::SQLiteDB{UTF16String},sql,stmt,null) =
9494
@CHECK db sqlite3_prepare16_v2(db.handle,utf16(sql),stmt,null)
9595

9696
function SQLiteStmt{T}(db::SQLiteDB{T},sql::AbstractString)
@@ -136,7 +136,7 @@ function bind(stmt::SQLiteStmt,name::AbstractString,val)
136136
end
137137
return bind(stmt,i,val)
138138
end
139-
bind(stmt::SQLiteStmt,i::Int,val::FloatingPoint) = @CHECK stmt.db sqlite3_bind_double(stmt.handle,i,@compat Float64(val))
139+
bind(stmt::SQLiteStmt,i::Int,val::AbstractFloat) = @CHECK stmt.db sqlite3_bind_double(stmt.handle,i,@compat Float64(val))
140140
bind(stmt::SQLiteStmt,i::Int,val::Int32) = @CHECK stmt.db sqlite3_bind_int(stmt.handle,i,val)
141141
bind(stmt::SQLiteStmt,i::Int,val::Int64) = @CHECK stmt.db sqlite3_bind_int64(stmt.handle,i,val)
142142
bind(stmt::SQLiteStmt,i::Int,val::NullType) = @CHECK stmt.db sqlite3_bind_null(stmt.handle,i)
@@ -180,7 +180,7 @@ const SERIALIZATION = UInt8[0x11,0x01,0x02,0x0d,0x53,0x65,0x72,0x69,0x61,0x6c,0x
180180
function sqldeserialize(r)
181181
ret = ccall(:memcmp, Int32, (Ptr{UInt8},Ptr{UInt8}, UInt),
182182
SERIALIZATION, r, min(18,length(r)))
183-
183+
184184
if ret == 0
185185
v = deserialize(IOBuffer(r))
186186
return v.object
@@ -205,7 +205,7 @@ function query(db::SQLiteDB,sql::AbstractString, values=[])
205205
end
206206
while status == SQLITE_ROW
207207
for i = 1:ncols
208-
t = sqlite3_column_type(stmt.handle,i-1)
208+
t = sqlite3_column_type(stmt.handle,i-1)
209209
if t == SQLITE_INTEGER
210210
r = sqlite3_column_int64(stmt.handle,i-1)
211211
elseif t == SQLITE_FLOAT
@@ -241,7 +241,7 @@ function indices(db::SQLiteDB)
241241
query(db,"SELECT name FROM sqlite_master WHERE type='index';")
242242
end
243243

244-
columns(db::SQLiteDB,table::String) = query(db,"pragma table_info($table)")
244+
columns(db::SQLiteDB,table::AbstractString) = query(db,"pragma table_info($table)")
245245

246246
# Transaction-based commands
247247
function transaction(db, mode="DEFERRED")

src/UDF.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function sqlvalue(values, i)
1616
elseif valuetype == SQLITE_BLOB
1717
nbytes = sqlite3_value_bytes(temp_val_ptr)
1818
blob = sqlite3_value_blob(temp_val_ptr)
19-
buf = zeros(Uint8, nbytes)
20-
unsafe_copy!(pointer(buf), convert(Ptr{Uint8}, blob), nbytes)
19+
buf = zeros(UInt8, nbytes)
20+
unsafe_copy!(pointer(buf), convert(Ptr{UInt8}, blob), nbytes)
2121
return sqldeserialize(buf)
2222
else
2323
return NULL
@@ -195,14 +195,14 @@ function register(db::SQLiteDB, func::Function; nargs::Int=-1, name::AbstractStr
195195

196196
f = eval(scalarfunc(func,symbol(name)))
197197

198-
cfunc = cfunction(f, Nothing, (Ptr{Void}, Cint, Ptr{Ptr{Void}}))
198+
cfunc = cfunction(f, Void, (Ptr{Void}, Cint, Ptr{Ptr{Void}}))
199199
# TODO: allow the other encodings
200200
enc = SQLITE_UTF8
201201
enc = isdeterm ? enc | SQLITE_DETERMINISTIC : enc
202202

203203
@CHECK db sqlite3_create_function_v2(
204204
db.handle, name, nargs, enc, C_NULL, cfunc, C_NULL, C_NULL, C_NULL
205-
)
205+
)
206206
end
207207

208208
# as above but for aggregate functions
@@ -215,9 +215,9 @@ function register(
215215
@assert sizeof(name) <= 255 "size of function name must be <= 255 chars"
216216

217217
s = eval(stepfunc(init, step, Base.function_name(step)))
218-
cs = cfunction(s, Nothing, (Ptr{Void}, Cint, Ptr{Ptr{Void}}))
218+
cs = cfunction(s, Void, (Ptr{Void}, Cint, Ptr{Ptr{Void}}))
219219
f = eval(finalfunc(init, final, Base.function_name(final)))
220-
cf = cfunction(f, Nothing, (Ptr{Void}, Cint, Ptr{Ptr{Void}}))
220+
cf = cfunction(f, Void, (Ptr{Void}, Cint, Ptr{Ptr{Void}}))
221221

222222
enc = SQLITE_UTF8
223223
enc = isdeterm ? enc | SQLITE_DETERMINISTIC : enc

src/api.jl

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
function sqlite3_errmsg()
22
return ccall( (:sqlite3_errmsg, sqlite3_lib),
3-
Ptr{Uint8}, ()
3+
Ptr{UInt8}, ()
44
)
55
end
66
function sqlite3_errmsg(db::Ptr{Void})
77
@NULLCHECK db
88
return ccall( (:sqlite3_errmsg, sqlite3_lib),
9-
Ptr{Uint8}, (Ptr{Void},),
9+
Ptr{UInt8}, (Ptr{Void},),
1010
db)
1111
end
1212
function sqlite3_open(file::AbstractString,handle::Array{Ptr{Void},1})
1313
return ccall( (:sqlite3_open, sqlite3_lib),
14-
Cint, (Ptr{Uint8},Ptr{Void}),
14+
Cint, (Ptr{UInt8},Ptr{Void}),
1515
file,handle)
1616
end
1717
function sqlite3_open16(file::UTF16String,handle::Array{Ptr{Void},1})
1818
return ccall( (:sqlite3_open16, sqlite3_lib),
19-
Cint, (Ptr{Uint16},Ptr{Void}),
19+
Cint, (Ptr{UInt16},Ptr{Void}),
2020
file,handle)
2121
end
2222
function sqlite3_close(handle::Ptr{Void})
@@ -34,13 +34,13 @@ end
3434
function sqlite3_prepare_v2(handle::Ptr{Void},query::AbstractString,stmt::Array{Ptr{Void},1},unused::Array{Ptr{Void},1})
3535
@NULLCHECK handle
3636
return ccall( (:sqlite3_prepare_v2, sqlite3_lib),
37-
Cint, (Ptr{Void},Ptr{Uint8},Cint,Ptr{Void},Ptr{Void}),
37+
Cint, (Ptr{Void},Ptr{UInt8},Cint,Ptr{Void},Ptr{Void}),
3838
handle,query,sizeof(query),stmt,unused)
3939
end
4040
function sqlite3_prepare16_v2(handle::Ptr{Void},query::AbstractString,stmt::Array{Ptr{Void},1},unused::Array{Ptr{Void},1})
4141
@NULLCHECK handle
4242
return ccall( (:sqlite3_prepare16_v2, sqlite3_lib),
43-
Cint, (Ptr{Void},Ptr{Uint16},Cint,Ptr{Void},Ptr{Void}),
43+
Cint, (Ptr{Void},Ptr{UInt16},Cint,Ptr{Void},Ptr{Void}),
4444
handle,query,sizeof(query),stmt,unused)
4545
end
4646
function sqlite3_finalize(stmt::Ptr{Void})
@@ -61,14 +61,14 @@ end
6161
function sqlite3_bind_parameter_name(stmt::Ptr{Void}, col::Int)
6262
@NULLCHECK stmt
6363
return ccall( (:sqlite3_bind_parameter_name, sqlite3_lib),
64-
Ptr{Uint8}, (Ptr{Void}, Cint),
64+
Ptr{UInt8}, (Ptr{Void}, Cint),
6565
stmt, col)
6666
end
6767
# SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
6868
function sqlite3_bind_parameter_index(stmt::Ptr{Void},value::AbstractString)
6969
@NULLCHECK stmt
7070
return ccall( (:sqlite3_bind_parameter_index, sqlite3_lib),
71-
Cint, (Ptr{Void},Ptr{Uint8}),
71+
Cint, (Ptr{Void},Ptr{UInt8}),
7272
stmt,utf8(value))
7373
end
7474
# SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
@@ -103,21 +103,21 @@ end
103103
function sqlite3_bind_text(stmt::Ptr{Void},col::Int,value::AbstractString)
104104
@NULLCHECK stmt
105105
return ccall( (:sqlite3_bind_text, sqlite3_lib),
106-
Cint, (Ptr{Void},Cint,Ptr{Uint8},Cint,Ptr{Void}),
106+
Cint, (Ptr{Void},Cint,Ptr{UInt8},Cint,Ptr{Void}),
107107
stmt,col,value,sizeof(value),C_NULL)
108108
end
109109
# SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
110110
function sqlite3_bind_text16(stmt::Ptr{Void},col::Int,value::UTF16String)
111111
@NULLCHECK stmt
112112
return ccall( (:sqlite3_bind_text, sqlite3_lib),
113-
Cint, (Ptr{Void},Cint,Ptr{Uint16},Cint,Ptr{Void}),
113+
Cint, (Ptr{Void},Cint,Ptr{UInt16},Cint,Ptr{Void}),
114114
stmt,col,value,sizeof(value),C_NULL)
115115
end
116116
# SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
117117
function sqlite3_bind_blob(stmt::Ptr{Void},col::Int,value)
118118
@NULLCHECK stmt
119119
return ccall( (:sqlite3_bind_blob, sqlite3_lib),
120-
Cint, (Ptr{Void},Cint,Ptr{Uint8},Cint,Ptr{Void}),
120+
Cint, (Ptr{Void},Cint,Ptr{UInt8},Cint,Ptr{Void}),
121121
stmt,col,value,sizeof(value),SQLITE_STATIC)
122122
end
123123
# SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
@@ -182,7 +182,7 @@ end
182182
function sqlite3_column_text(stmt::Ptr{Void},col::Int)
183183
@NULLCHECK stmt
184184
return ccall( (:sqlite3_column_text, sqlite3_lib),
185-
Ptr{Uint8}, (Ptr{Void},Cint),
185+
Ptr{UInt8}, (Ptr{Void},Cint),
186186
stmt,col)
187187
end
188188
function sqlite3_column_text16(stmt::Ptr{Void},col::Int)
@@ -208,13 +208,13 @@ end
208208
function sqlite3_column_name(stmt::Ptr{Void},n::Int)
209209
@NULLCHECK stmt
210210
return ccall( (:sqlite3_column_name, sqlite3_lib),
211-
Ptr{Uint8}, (Ptr{Void},Cint),
211+
Ptr{UInt8}, (Ptr{Void},Cint),
212212
stmt,n)
213213
end
214214
function sqlite3_column_name16(stmt::Ptr{Void},n::Int)
215215
@NULLCHECK stmt
216216
return ccall( (:sqlite3_column_name16, sqlite3_lib),
217-
Ptr{Uint8}, (Ptr{Void},Cint),
217+
Ptr{UInt8}, (Ptr{Void},Cint),
218218
stmt,n)
219219
end
220220

@@ -253,13 +253,13 @@ end
253253
# SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int)
254254
function sqlite3_result_error(context::Ptr{Void},msg::AbstractString)
255255
return ccall( (:sqlite3_result_error, sqlite3_lib),
256-
Void, (Ptr{Void},Ptr{Uint8},Cint),
256+
Void, (Ptr{Void},Ptr{UInt8},Cint),
257257
context,value,sizeof(msg)+1)
258258
end
259259
# SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int)
260260
function sqlite3_result_error(context::Ptr{Void},msg::UTF16String)
261261
return ccall( (:sqlite3_result_error16, sqlite3_lib),
262-
Void, (Ptr{Void},Ptr{Uint16},Cint),
262+
Void, (Ptr{Void},Ptr{UInt16},Cint),
263263
context,value,sizeof(msg)+1)
264264
end
265265
# SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
@@ -283,19 +283,19 @@ end
283283
# SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int n, void(*)(void*));
284284
function sqlite3_result_text(context::Ptr{Void},value::AbstractString)
285285
return ccall( (:sqlite3_result_text, sqlite3_lib),
286-
Void, (Ptr{Void},Ptr{Uint8},Cint,Ptr{Void}),
286+
Void, (Ptr{Void},Ptr{UInt8},Cint,Ptr{Void}),
287287
context,value,sizeof(value)+1,SQLITE_TRANSIENT)
288288
end
289289
# SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
290290
function sqlite3_result_text16(context::Ptr{Void},value::UTF16String)
291291
return ccall( (:sqlite3_result_text, sqlite3_lib),
292-
Void, (Ptr{Void},Ptr{Uint16},Cint,Ptr{Void}),
292+
Void, (Ptr{Void},Ptr{UInt16},Cint,Ptr{Void}),
293293
context,value,sizeof(value)+1,SQLITE_TRANSIENT)
294294
end
295295
# SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int n, void(*)(void*));
296296
function sqlite3_result_blob(context::Ptr{Void},value)
297297
return ccall( (:sqlite3_result_blob, sqlite3_lib),
298-
Void, (Ptr{Void},Ptr{Uint8},Cint,Ptr{Void}),
298+
Void, (Ptr{Void},Ptr{UInt8},Cint,Ptr{Void}),
299299
context,value,sizeof(value),SQLITE_TRANSIENT)
300300
end
301301
# SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
@@ -313,7 +313,7 @@ function sqlite3_create_function_v2(db::Ptr{Void},name::AbstractString,nargs::In
313313
return ccall(
314314
(:sqlite3_create_function_v2, sqlite3_lib),
315315
Cint,
316-
(Ptr{Void}, Ptr{Uint8}, Cint, Cint, Ptr{Void},
316+
(Ptr{Void}, Ptr{UInt8}, Cint, Cint, Ptr{Void},
317317
Ptr{Void}, Ptr{Void}, Ptr{Void}, Ptr{Void}),
318318
db, name, nargs, enc, data, func, step, final, destructor)
319319
end
@@ -371,7 +371,7 @@ end
371371
# SQLITE_API const unsigned char* sqlite3_value_text(sqlite3_value*)
372372
function sqlite3_value_text(value::Ptr{Void})
373373
return ccall( (:sqlite3_value_text, sqlite3_lib),
374-
Ptr{Uint8}, (Ptr{Void},),
374+
Ptr{UInt8}, (Ptr{Void},),
375375
value)
376376
end
377377
# SQLITE_API const void* sqlite3_value_text16(sqlite3_value*)
@@ -428,7 +428,7 @@ end
428428
# SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
429429
function sqlite3_errstr(ret::Cint)
430430
return ccall( (:sqlite3_errstr, sqlite3_lib),
431-
Ptr{Uint8}, (Cint,),
431+
Ptr{UInt8}, (Cint,),
432432
ret)
433433
end
434434
# SQLITE_API const char *sqlite3_errstr(int);
@@ -456,19 +456,19 @@ end
456456
# Not directly used
457457
function sqlite3_open_v2(file::AbstractString,handle::Array{Ptr{Void},1},flags::Cint,vfs::AbstractString)
458458
return ccall( (:sqlite3_open_v2, sqlite3_lib),
459-
Cint, (Ptr{Uint8},Ptr{Void},Cint,Ptr{Uint8}),
459+
Cint, (Ptr{UInt8},Ptr{Void},Cint,Ptr{UInt8}),
460460
file,handle,flags,vfs)
461461
end
462462
function sqlite3_prepare(handle::Ptr{Void},query::AbstractString,stmt::Array{Ptr{Void},1},unused::Array{Ptr{Void},1})
463463
@NULLCHECK handle
464464
return ccall( (:sqlite3_prepare, sqlite3_lib),
465-
Cint, (Ptr{Void},Ptr{Uint8},Cint,Ptr{Void},Ptr{Void}),
465+
Cint, (Ptr{Void},Ptr{UInt8},Cint,Ptr{Void},Ptr{Void}),
466466
handle,query,sizeof(query),stmt,unused)
467467
end
468468
function sqlite3_prepare16(handle::Ptr{Void},query::AbstractString,stmt::Array{Ptr{Void},1},unused::Array{Ptr{Void},1})
469469
@NULLCHECK handle
470470
return ccall( (:sqlite3_prepare16, sqlite3_lib),
471-
Cint, (Ptr{Void},Ptr{Uint8},Cint,Ptr{Void},Ptr{Void}),
471+
Cint, (Ptr{Void},Ptr{UInt8},Cint,Ptr{Void},Ptr{Void}),
472472
handle,query,sizeof(query),stmt,unused)
473473
end
474474
function sqlite3_close_v2(handle::Ptr{Void})

src/show.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ end
3131
#' ourstrwidth("abc")
3232
#' ourstrwidth(10000)
3333
begin
34-
local io = IOBuffer(Array(Uint8, 80), true, true)
34+
local io = IOBuffer(Array(UInt8, 80), true, true)
3535
global ourstrwidth
3636
function ourstrwidth(x::Any) # -> Int
3737
truncate(io, 0)
@@ -41,7 +41,7 @@ begin
4141
ourstrwidth(x::AbstractString) = strwidth(x) + 2 # -> Int
4242
ourstrwidth(s::Symbol) = @compat Int(ccall(:u8_strwidth,
4343
Csize_t,
44-
(Ptr{Uint8}, ),
44+
(Ptr{UInt8}, ),
4545
string(s)))
4646
end
4747

@@ -359,7 +359,7 @@ function showrows(io::IO,
359359
for chunkindex in 1:nchunks
360360
leftcol = chunkbounds[chunkindex] + 1
361361
rightcol = chunkbounds[chunkindex + 1]
362-
362+
363363
# Print column names
364364
@printf io "| %s" rowlabel
365365
padding = rowmaxwidth - ourstrwidth(rowlabel)

0 commit comments

Comments
 (0)