NULLs are not sent or received correctly with prepared stmt api
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Drizzle Client & Protocol Library |
Fix Released
|
High
|
Andrew Hutchings |
Bug Description
Setting a parameter of a prepared statement to NULL using drizzle_
Retrieving a row containing a NULL doesn't result in drizzle_
The problem is probably the null-bitmap manipulation code in statement.cc, which looks really dubious:
/* Toggle the bit for this column in the bitmap */
and
/* if this row is null in the result bitmap */
if (*stmt-
in both cases, it's using an XOR where a shift was probably meant, and also not indexing into null_bitmap properly (so it'll fail for more than 8 columns/
#define null_bitmap_
#define null_bitmap_
The nulls.c unit test in my unit-tests branch tests this code path.
Related branches
- Andrew Hutchings: Approve
-
Diff: 1326 lines (+1094/-59)11 files modifiedMakefile.am (+1/-0)
libdrizzle/statement.cc (+1/-0)
tests/unit/binlog.cc (+5/-14)
tests/unit/column.c (+11/-31)
tests/unit/common.c (+93/-0)
tests/unit/common.h (+26/-8)
tests/unit/connect_uds.c (+2/-2)
tests/unit/datetypes.c (+330/-0)
tests/unit/include.am (+21/-4)
tests/unit/nulls.c (+278/-0)
tests/unit/numbers.c (+326/-0)
- Drizzle Trunk: Pending requested
-
Diff: 355 lines (+68/-35)7 files modifiedlibdrizzle/field.cc (+13/-1)
libdrizzle/result.h (+2/-0)
libdrizzle/row.cc (+7/-1)
libdrizzle/statement.cc (+40/-26)
libdrizzle/statement_param.cc (+1/-1)
tests/unit/include.am (+0/-2)
tests/unit/nulls.c (+5/-4)
Changed in libdrizzle: | |
milestone: | none → 5.1.4 |
Changed in libdrizzle: | |
importance: | Undecided → High |
assignee: | nobody → Andrew Hutchings (linuxjedi) |
status: | New → Triaged |
Changed in libdrizzle: | |
status: | Triaged → Fix Released |
oh wow! I must have been really tired when coding that logic :(
You are completely correct, I intended them to be shifts. Now that it is multi-byte your approach seems good to me.