You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue blocks the use of prepared statements with MySQL. This effectively forces users to either use query or real_query, which is bad practice.
Unlike with the bare C API, invoking stmt.bind_result_buffer() (mysql_stmt_bind_result()) does not bind the result buffer of the statement. This method requires stmt.bind_res() to be invoked beforehand. This is problematic for several reasons:
stmt.bind_res() requires the parametersdataptr and num_fields which can be obtained with the method stmt.get_field_count(). This method is private.
These parameters are obtained in the orm implementation using the result obtained with the invocation of stmt.gen_metadata() (mysql_stmt_result_metadata()). Metadata should be optional, but most importantly, a lot of unsafe work is done to obtain these parameters.
Expected Behavior
stmt.bind_result_buffer() binds the result buffer of the statement
stmt.bind_result_buffer() should not require invoking stmt.bind_res().
Otherwise, stmt.bind_res() should not require unobtainable parameters.
Otherwise, and least optimal, stmt.get_field_count() should be public. Users can do unsafe work themselves just to obtain query results. Sketchy and unfriendly.
Additional Information/Context
This has blocked me for months, nobody of the original contributors to the mysql module (particularly the parts contained in stmt.c.v) have stepped in when asked, nor do they seem active as contributors, they have likely abandoned V.
Currently active contributors to the orm module don't seem to know how the db.mysql module works.
V version
Current V version: V 0.3.3 2179db3, timestamp: 2023-04-14 14:42:11 +0300
Environment details (OS name and version, etc.)
V full version: V 0.3.3 ee4150f.2179db3
OS: linux, Linux version 5.14.0-162.23.1.el9_1.x86_64 (mockbuild@pp-el9) (gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-2), GNU ld version 2.35.2-24.el9) #1 SMP PREEMPT_DYNAMIC Wed Apr 12 16:23:09 UTC 2023
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz
getwd: /home/coachonko
vexe: /home/coachonko/.local/lib64/v/v
vexe mtime: 2023-04-14 13:20:45
vroot: OK, value: /home/coachonko/.local/lib64/v
VMODULES: OK, value: /home/coachonko/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.31.1
Git vroot status: weekly.2023.15-18-g2179db37
.git/config present: true
CC version: cc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-2)
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
The text was updated successfully, but these errors were encountered:
Describe the bug
This issue blocks the use of prepared statements with MySQL. This effectively forces users to either use
query
orreal_query
, which is bad practice.Unlike with the bare C API, invoking
stmt.bind_result_buffer()
(mysql_stmt_bind_result()
) does not bind the result buffer of the statement. This method requiresstmt.bind_res()
to be invoked beforehand. This is problematic for several reasons:stmt.bind_res()
requires the parametersdataptr
andnum_fields
which can be obtained with the methodstmt.get_field_count()
. This method is private.stmt.gen_metadata()
(mysql_stmt_result_metadata()
). Metadata should be optional, but most importantly, a lot of unsafe work is done to obtain these parameters.Expected Behavior
stmt.bind_result_buffer() binds the result buffer of the statement
Current Behavior
Runtime memory access error
Reproduction Steps
Described here
Possible Solution
I can see 3 options:
stmt.bind_result_buffer()
should not require invokingstmt.bind_res()
.stmt.bind_res()
should not require unobtainable parameters.stmt.get_field_count()
should be public. Users can do unsafe work themselves just to obtain query results. Sketchy and unfriendly.Additional Information/Context
This has blocked me for months, nobody of the original contributors to the mysql module (particularly the parts contained in
stmt.c.v
) have stepped in when asked, nor do they seem active as contributors, they have likely abandoned V.Currently active contributors to the orm module don't seem to know how the db.mysql module works.
V version
Current V version: V 0.3.3 2179db3, timestamp: 2023-04-14 14:42:11 +0300
Environment details (OS name and version, etc.)
The text was updated successfully, but these errors were encountered: