Skip to content

Commit

Permalink
Handle NULL values correctly, smh
Browse files Browse the repository at this point in the history
  • Loading branch information
Srlion committed Oct 8, 2024
1 parent 368f415 commit 7df721e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/query/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use sqlx::{
chrono::{DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc},
Decimal,
},
Column, Row, TypeInfo,
Column, Row, TypeInfo, ValueRef as _,
};

pub fn process_info(l: lua::State, info: MySqlQueryResult) -> Result<i32> {
Expand Down Expand Up @@ -65,6 +65,12 @@ fn push_column_value_to_lua(
column_name: &str,
column_type: &str,
) -> Result<()> {
let value = row.try_get_raw(column_name)?;
if value.is_null() {
l.push_nil();
return Ok(());
}

match column_type {
"NULL" => l.push_nil(),
"BOOLEAN" => {
Expand Down

0 comments on commit 7df721e

Please sign in to comment.