-
Notifications
You must be signed in to change notification settings - Fork 7
Return ffi's NULL instead of nil from lua_mysql_pushresult() #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* @param L stack | ||
*/ | ||
static inline void | ||
luaL_pushnull(struct lua_State *L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is actually a copy-paste from tarantool/src/lua/utils.h.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
luaL_pushnull must be imported to public API, you're right
May be adding some sql meta info to returning tables (for example, field names with its native sql types) should be a better solution? |
1a19b97
to
d446fdf
Compare
More signcode fixes (windows msi)
The proposed change may be considered as backward incompatible, however I don't mind to enable this behaviour under an option like
The metadata is returned now when the {
{ -- result set
rows = {
{r1c1val, r1c2val, ...}, -- row
{r2c1val, r2c2val, ...}, -- row
...
},
metadata = {
{type = 'long', name = 'col1'}, -- column meta
{type = 'long', name = 'col2'}, -- column meta
...
},
},
...
} |
Please excuse me for the terribly slow response, I think it's time for me to tinker with some notification settings :)
Sounds great, I will update the changeset and README accordingly.
In my opinion the metadata table introduces a complication for the particular case of simply packing the response and sending it over the wire. Some effort still must be put on the receiving end to actually discover that a value is NULL. |
It looks like CI fails because Tarantool 1.6 (which this change was initally based on) had all non-static symbols visible to ffi (tarantool/tarantool#2971). As I see this, it means that the change may not be introduced without breaking compatibility with all existing tarantool versions out there, and that is quite a bummer. |
The code now uses |
@darkwrat, if you are not going to make changes, then let me know I will finish this pull request. |
Please go ahead. |
a09f0b1
to
6e2e5b5
Compare
6e2e5b5
to
a161825
Compare
86c108a
to
8e305a3
Compare
Introduce keep_null option to return ffi's NULL instead of nil in conn:execute(). Co-authored-by: Maxim Galaganov <voltage@lanport.net> We can specify how lua_mysql_push_value() works with data == NULL and use this fact to simplify the code.
8e305a3
to
e1ab62a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Before patch:
After patch: