|
46 | 46 |
|
47 | 47 | db = SQLite.DB(dbfile2)
|
48 | 48 | db = DBInterface.connect(SQLite.DB, dbfile2)
|
| 49 | + |
| 50 | +# https://github.com/JuliaDatabases/SQLite.jl/issues/207 |
| 51 | +ds = DBInterface.execute(db, "SELECT RANDOM() as a FROM Track LIMIT 1") |> columntable |
| 52 | +@test ds.a[1] isa Int64 |
| 53 | + |
49 | 54 | # regular SQLite tests
|
50 | 55 |
|
51 | 56 | @test_throws SQLiteException DBInterface.execute(db, "just some syntax error")
|
@@ -151,9 +156,9 @@ r = DBInterface.execute(db, "SELECT * FROM temp WHERE Title LIKE ?", ["%time%"])
|
151 | 156 | @test r[1] == [76, 111, 187]
|
152 | 157 | DBInterface.execute(db, "INSERT INTO temp VALUES (?1, ?3, ?2)", [0,0, "Test Album"])
|
153 | 158 | r = DBInterface.execute(db, "SELECT * FROM temp WHERE AlbumId = 0") |> columntable
|
154 |
| -@test r[1][1] === 0 |
| 159 | +@test r[1][1] == 0 |
155 | 160 | @test r[2][1] == "Test Album"
|
156 |
| -@test r[3][1] === 0 |
| 161 | +@test r[3][1] == 0 |
157 | 162 | SQLite.drop!(db, "temp")
|
158 | 163 |
|
159 | 164 | DBInterface.execute(db, "CREATE TABLE temp AS SELECT * FROM Album")
|
@@ -189,10 +194,10 @@ s = DBInterface.execute(db, "SELECT AlbumId FROM Album") |> columntable
|
189 | 194 | @test r[1][1] == s[1][1] + 4
|
190 | 195 |
|
191 | 196 | SQLite.@register db mult
|
192 |
| -r = DBInterface.execute(db, "SELECT Milliseconds, Bytes FROM Track") |> columntable |
193 |
| -s = DBInterface.execute(db, "SELECT mult(Milliseconds, Bytes) FROM Track") |> columntable |
| 197 | +r = DBInterface.execute(db, "SELECT GenreId, UnitPrice FROM Track") |> columntable |
| 198 | +s = DBInterface.execute(db, "SELECT mult(GenreId, UnitPrice) FROM Track") |> columntable |
194 | 199 | @test (r[1][1] * r[2][1]) == s[1][1]
|
195 |
| -t = DBInterface.execute(db, "SELECT mult(Milliseconds, Bytes, 3, 4) FROM Track") |> columntable |
| 200 | +t = DBInterface.execute(db, "SELECT mult(GenreId, UnitPrice, 3, 4) FROM Track") |> columntable |
196 | 201 | @test (r[1][1] * r[2][1] * 3 * 4) == t[1][1]
|
197 | 202 |
|
198 | 203 | SQLite.@register db sin
|
@@ -291,16 +296,16 @@ SQLite.clear!(stmt)
|
291 | 296 | rr = (;) # just to have the var declared
|
292 | 297 | @test_logs(
|
293 | 298 | (:warn, "Unsupported SQLite declared type UNKNOWN1, falling back to String type"),
|
294 |
| - (:warn, "Unsupported SQLite declared type UNKNOWN2, falling back to $(Int) type"), |
| 299 | + (:warn, "Unsupported SQLite declared type UNKNOWN2, falling back to $(Int64) type"), |
295 | 300 | rr = DBInterface.execute(rowtable, binddb, "SELECT * FROM temp"))
|
296 | 301 | @test length(rr) == 1
|
297 | 302 | r = first(rr)
|
298 |
| - @test typeof.(Tuple(r)) == (Missing, Int, Int, |
299 |
| - Float64, Float64, Int, |
| 303 | + @test typeof.(Tuple(r)) == (Missing, Int64, Int64, |
| 304 | + Float64, Float64, Int64, |
300 | 305 | String, String, String, String,
|
301 | 306 | String, String,
|
302 | 307 | Base.CodeUnits{UInt8, String},
|
303 |
| - String, Int) |
| 308 | + String, Int64) |
304 | 309 | end
|
305 | 310 |
|
306 | 311 | ############################################
|
|
0 commit comments