Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couple of fixes noticed while testing athena #276

Merged
merged 1 commit into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ end

function freestmt(stmt)
if stmt.ptr != C_NULL
@checksuccess stmt SQLFreeStmt(getptr(stmt), SQL_CLOSE)
SQLFreeStmt(getptr(stmt), SQL_CLOSE)
end
end

Expand Down
5 changes: 4 additions & 1 deletion src/dbinterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function Cursor(stmt; iterate_rows::Bool=false, ignore_driver_row_count::Bool=fa
# we need bindings regardless of row vs. column fetching
bindings = getbindings(stmt, columnar, ctypes, sqltypes, columnsizes, nullables, longtexts, rowset)
if columnar && cols > 0
# will be populated by call to SQLFetchScroll
# will be populated by call to SQLFetchScroll
rowsfetchedref = API.setrowsfetched(stmt)
API.fetch(stmt)
rowsfetched = rowsfetchedref[]
Expand Down Expand Up @@ -319,6 +319,9 @@ Base.eltype(x::Cursor{false, knownlength}) where {knownlength} = Row

function Base.iterate(x::Cursor{false}, st=1)
status = API.SQLFetchScroll(API.getptr(x.stmt), API.SQL_FETCH_NEXT, 0)
while status == API.SQL_STILL_EXECUTING
status = API.SQLFetchScroll(API.getptr(x.stmt), API.SQL_FETCH_NEXT, 0)
end
status == API.SQL_SUCCESS || status == API.SQL_SUCCESS_WITH_INFO || return nothing
x.current_rownumber = st
for (i, binding) in enumerate(x.bindings)
Expand Down