mwild1 / luadbi

Multi-backend SQL database library for Lua
MIT License
38 stars 14 forks source link

Cannot differentiate NULL and default value with MySQL #66

Closed ntki closed 4 months ago

ntki commented 2 years ago

When I execute:

dbi = require('DBI')
conn = assert(dbi.Connect("MySQL", "", "user", "", "127.0.0.1", 3306))
user_stmt = assert(conn:prepare("SELECT NULL UNION SELECT 111"))
user_stmt:execute()
print(user_stmt:fetch()[1])
print(user_stmt:fetch()[1])

It gives me:

0
111

Although the correct answer should be:

nil
111

Or I would like to have some way to check whether a field was NULL.

sparked435 commented 4 months ago

Thanks for the report and the fix for it; sorry for the long wait to merge. Closing this as it's now in the head branch.