Skip to content

WIP: Support binding multiple rows - #222

Open
krlmlr wants to merge 2 commits into
mainfrom
f-multi-row-bind
Open

krlmlr wants to merge 2 commits into
mainfrom
f-multi-row-bind

Conversation

@krlmlr

@krlmlr krlmlr commented Sep 5, 2021

Copy link
Copy Markdown
Member

Requires MariaDB connector and server. Needs much more work.

krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

Merged main into this branch (c3b4ff7). The only conflict was in bind_next_row() in src/MariaBinding.cpp, where main had moved to cpp11: the WIP's delta / STMT_ATTR_ARRAY_SIZE / i += delta change and the 4 * n_rows / 8 * n_rows buffer sizes are kept, and the LOG_DEBUG line is dropped because main no longer has the logging macros. R CMD INSTALL . succeeds; no tests were run against a server.

A clean review of the result found that the merge carries the WIP faithfully, and it flagged gaps in the WIP itself. These are not new with the merge, and they need fixing before this can leave WIP:

  • High: with STMT_ATTR_ARRAY_SIZE above 1, the server reads delta elements per column, but is_null and the string, raw, date, datetime, time, int64 and logical buffers still hold one element, so the server reads past the end of the buffer. Either give every type array buffers (with length[] for strings and raw), or fall back to delta = 1 unless all columns are fixed-width integer or double.
  • Medium: the NA check only looks at the first row, so NAs in later rows go out as INT_MIN or NaN.
  • Medium: step() also calls bind_next_row() for statements that return results, but array binding only applies to INSERT, UPDATE and DELETE, so it should use delta = 1 when there is a result.
  • Low: &delta is an R_xlen_t* where an unsigned int* is expected, the length of every parameter column apart from the first goes unchecked, the attribute is set after mysql_stmt_bind_param() rather than before, and the return codes go unchecked.

Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants