mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00
Fix null_bitmap size in MariaDb
This commit is contained in:
parent
6cac5383e3
commit
fdd60eb9b1
@ -115,10 +115,11 @@ impl Executor for MariaDb {
|
||||
let columns = self.result_column_defs().await?;
|
||||
let capabilities = self.capabilities;
|
||||
|
||||
let mut row: Option<_> = None;
|
||||
let mut row = None;
|
||||
|
||||
loop {
|
||||
let packet = self.receive().await?;
|
||||
|
||||
if packet[0] == 0xFE && packet.len() < 0xFF_FF_FF {
|
||||
// NOTE: It's possible for a ResultRow to start with 0xFE (which would normally signify end-of-rows)
|
||||
// but it's not possible for an Ok/Eof to be larger than 0xFF_FF_FF.
|
||||
|
@ -41,7 +41,7 @@ impl ResultRow {
|
||||
let mut values = Vec::with_capacity(columns.len());
|
||||
|
||||
for column_idx in 0..columns.len() {
|
||||
if null[column_idx / 8] & (1 << (column_idx % 8)) != 0 {
|
||||
if null[column_idx / 8] & (1 << (column_idx % 8) as u8) != 0 {
|
||||
values.push(None);
|
||||
} else {
|
||||
match columns[column_idx].field_type {
|
||||
|
@ -37,10 +37,10 @@ impl QueryParameters for MariaDbQueryParameters {
|
||||
let index = self.param_types.len();
|
||||
|
||||
self.param_types.push(metadata);
|
||||
self.null_bitmap.resize(index / 8, 0);
|
||||
self.null_bitmap.resize((index / 8) + 1, 0);
|
||||
|
||||
if let IsNull::Yes = value.encode(&mut self.params) {
|
||||
self.null_bitmap[index / 8] &= 1 << index % 8;
|
||||
self.null_bitmap[index / 8] &= (1 << index % 8) as u8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user