Skip to content

Commit 8989864

Browse files
committed
Fixed some test bugs and finished a rename in SQLite.jl
1 parent e1729d0 commit 8989864

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

src/SQLite.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function query(q::String,conn::SQLiteDB=sqlitedb)
7373
r == SQLITE_DONE && return DataFrame("No Rows Returned")
7474
#get resultset metadata: column count, column types, and column names
7575
ncols = SQLite.sqlite3_column_count(stmt)
76-
colnames = Array(ASCIIString,ncols)
76+
colnames = Array(UTF8String,ncols)
7777
resultset = Array(Any,ncols)
7878
check = 0
7979
for i = 1:ncols
@@ -173,7 +173,7 @@ function df2table(df::DataFrame,conn::SQLiteDB,name::String)
173173
SQLite.sqlite3_bind_double(stmt,col,d)
174174
elseif t <: Integer
175175
WORD_SIZE == 64 ? sqlite3_bind_int64(stmt,col,d) : sqlite3_bind_int(stmt,col,d)
176-
elseif <: NAtype
176+
elseif t <: NAtype
177177
sqlite3_bind_null(stmt,col)
178178
else
179179
sqlite3_bind_text(stmt,col,string(d),length(string(d)),C_NULL)

test/test.jl

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11

22
using SQLite
3-
co = SQLite.connect(Pkg.dir() * "/SQLite/test/Chinook_SQLite.sqlite")
3+
co = connect(Pkg.dir() * "/SQLite/test/Chinook_SQLite.sqlite")
44

5-
df = SQLite.query("SELECT * FROM Employee;")
6-
SQLite.createtable(df; name="test")
7-
SQLite.query("select * from test")
8-
SQLite.query("drop table test")
5+
df = query("SELECT * FROM Employee;")
6+
createtable(df; name="test")
7+
query("select * from test")
8+
droptable("test")
99

10-
SQLite.query("SELECT * FROM sqlite_master WHERE type='table' ORDER BY name;")
11-
SQLite.query("SELECT * FROM Album;")
12-
SQLite.query("SELECT *
10+
query("SELECT * FROM sqlite_master WHERE type='table' ORDER BY name;")
11+
query("SELECT * FROM Album;")
12+
query("SELECT a.*, b.AlbumId
1313
FROM Artist a
1414
LEFT OUTER JOIN Album b ON b.ArtistId = a.ArtistId
1515
ORDER BY name;")
1616

1717
using DataFrames
1818
df2 = DataFrame(ones(1000000,5))
19-
@time SQLite.createtable(df2;name="test2")
20-
@time SQLite.query("SELECT * FROM test2;")
21-
SQLite.droptable("test2")
19+
@time createtable(df2;name="test2")
20+
@time query("SELECT * FROM test2;")
21+
droptable("test2")
2222

23-
using DataFrames
2423
df3 = DataFrame(ones(1000,5))
25-
sqldf("select * from df3")
24+
@time sqldf("select * from df3")
2625

27-
# SQLite.droptable("sales")
28-
@time SQLite.readdlmsql(Pkg.dir() * "/SQLite/test/sales.csv";sql="select * from sales",name="sales")
2926

30-
@time SQLite.query("select typeof(f_year), typeof(base_lines), typeof(dollars) from sales")
27+
@time readdlmsql(Pkg.dir() * "/SQLite/test/sales.csv";sql="select * from sales",name="sales")
28+
@time query("select typeof(f_year), typeof(base_lines), typeof(dollars) from sales")
29+
droptable("sales")

0 commit comments

Comments
 (0)