Skip to content

Fix SQL_IsNull() returning 0 for NULL columns in threaded queries - #1166

Merged
psychonic merged 1 commit into
alliedmodders:masterfrom
JohanCorn:fix-threaded-sql-isnull
Sep 20, 2026
Merged

psychonic merged 1 commit into
alliedmodders:masterfrom
JohanCorn:fix-threaded-sql-isnull

Conversation

@JohanCorn

@JohanCorn JohanCorn commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1165.

Threaded query results are copied into an AtomicResult in CopyFrom(), which turned NULL cells into empty strings, so IsNull() could never return true. This stores NULL cells as empty slots instead, and GetString() returns NULL for them. Same change in mysqlx and sqlite.

Tested with the released 1.10.0.5481 modules as baseline vs. a build with this change, on both MySQL and SQLite, using the sqlx and dbi natives with regular and threaded queries. The only difference is the threaded NULL cells now reporting IsNull() == 1. All other output and the error logs are identical.

Threaded query results are copied into an AtomicResult, which stored NULL cells as empty strings, so IsNull() could never report NULL. Store NULL cells as empty slots and make GetString() return NULL for them.

Fixes alliedmodders#1165
@psychonic
psychonic merged commit 4f3a32f into alliedmodders:master Sep 20, 2026
3 checks passed
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.

SQL_IsNull() always returns 0 in SQL_ThreadQuery callbacks, even for NULL columns

2 participants