Skip to content

Commit 09cf06d

Browse files
authored
Attempt to fix segfault in #156 (#157)
1 parent ac83f3f commit 09cf06d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/MySQL.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function clear!(conn)
4646
end
4747

4848
function clear!(conn, result::API.MYSQL_RES)
49-
if result.ptr != C_NULL
49+
if conn.mysql.ptr != C_NULL && result.ptr != C_NULL
5050
while true
5151
if API.fetchrow(conn.mysql, result) == C_NULL
5252
if API.moreresults(conn.mysql)

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,8 @@ ret = columntable(res)
268268

269269
# multiple-queries not supported by mysql w/ prepared statements
270270
@test_throws MySQL.API.StmtError DBInterface.prepare(conn, "select * from Employee; select DeptNo, OfficeNo from Employee where OfficeNo IS NOT NULL")
271+
272+
# 156
273+
res = DBInterface.execute(conn, "select * from Employee")
274+
DBInterface.close!(conn)
275+
ret = columntable(res)

0 commit comments

Comments
 (0)