Closed acautin closed 5 years ago
There are a couple of missing features for ref cursor support.
DPI_NATIVE_TYPE_STMT
stmt_getNumQueryColumns
To help with the testing the following snippet can be used to extract the ref cursor reference:
#{var := Var, data := [Data]} = dpi:conn_newVar(Conn, Type, 'DPI_NATIVE_TYPE_STMT', 1, 0, false, false, undefined), dpi:stmt_bindByName(Stmt, Name, Var), RefCursor = dpi:data_get(Data) case dpi:stmt_fetch(RefCursor) of #{found := true} -> NumCols = dpi:stmt_getNumQueryColumns(RefCursor), {true, get_column_values(RefCursor, 1, NumCols)}; #{found := false} -> {false, []} end
And the helper function to get the values:
get_column_values(_Stmt, ColIdx, Limit) when ColIdx > Limit -> []; get_column_values(Stmt, ColIdx, Limit) -> #{data := Data} = dpi:stmt_getQueryValue(Stmt, ColIdx), [dpi:data_get(Data) | get_column_values(Stmt, ColIdx + 1, Limit)].
There are a couple of missing features for ref cursor support.
DPI_NATIVE_TYPE_STMT
stmt_getNumQueryColumns
support.To help with the testing the following snippet can be used to extract the ref cursor reference:
And the helper function to get the values: