@@ -24,11 +24,12 @@ DB: $(hndl.db)
24
24
end
25
25
26
26
struct MySQLInternalError <: MySQLError
27
- ptr:: Ptr{Cvoid}
28
- MySQLInternalError (con:: Connection ) = new (con. ptr)
29
- MySQLInternalError (ptr) = new (ptr)
27
+ errno:: Cuint
28
+ msg:: String
29
+ MySQLInternalError (con:: Connection ) = new (API. mysql_errno (con. ptr), unsafe_string (API. mysql_error (con. ptr)))
30
+ MySQLInternalError (ptr) = new (API. mysql_errno (ptr), unsafe_string (API. mysql_error (ptr)))
30
31
end
31
- Base. showerror (io:: IO , e:: MySQLInternalError ) = print (io, unsafe_string (API . mysql_error (e. ptr)) )
32
+ Base. showerror (io:: IO , e:: MySQLInternalError ) = print (io, " ( $ (e. errno) ): $(e . msg) " )
32
33
33
34
mutable struct Result
34
35
ptr
@@ -54,9 +55,10 @@ mutable struct Query{hasresult, names, T}
54
55
nrows:: Int
55
56
end
56
57
57
- function julia_type (field_type, nullable)
58
+ function julia_type (field_type, nullable, isunsigned )
58
59
T = API. julia_type (field_type)
59
- return nullable ? Union{Missing, T} : T
60
+ T2 = isunsigned ? unsigned (T) : T
61
+ return nullable ? Union{Missing, T2} : T2
60
62
end
61
63
62
64
function MySQLRowIterator (args... )
@@ -76,7 +78,7 @@ function Query(conn::Connection, sql::String; kwargs...)
76
78
nrows = MySQL. API. mysql_num_rows (result. ptr)
77
79
fields = MySQL. metadata (result. ptr)
78
80
names = Tuple (ccall (:jl_symbol_n , Ref{Symbol}, (Ptr{UInt8}, Csize_t), x. name, x. name_length) for x in fields)
79
- T = Tuple{(julia_type (x. field_type, API. nullable (x)) for x in fields). .. }
81
+ T = Tuple{(julia_type (x. field_type, API. nullable (x), API . isunsigned (x) ) for x in fields). .. }
80
82
hasresult = true
81
83
ncols = length (fields)
82
84
ptr = MySQL. API. mysql_fetch_row (result. ptr)
0 commit comments