Git Product home page Git Product logo

Comments (8)

agentzh avatar agentzh commented on July 25, 2024

@ppolv Yes, prepared stmt support is a high priority item on my TODO list. And I appreciate your comments here.

You are right that the statement handle need a way to attach to the underlying connection in ngx_lua's cosocket API. Maybe we can add something like a binddata() method and a getbounddata() to the cosocket object? We can limit the value type to an integer in our first implementation and extend that if future requirements arise. What do you think? Will you contribute a patch to ngx_lua? Thanks!

from lua-resty-mysql.

ppolv avatar ppolv commented on July 25, 2024

Thanks, will check the ngx_lua code, I don't really know about the lua<>c interface, so will need to learn that first. Probably will find time to work on this on next week, will keep you posted if I make progress

from lua-resty-mysql.

agentzh avatar agentzh commented on July 25, 2024

@ppolv Very much appreciated :)

from lua-resty-mysql.

ppolv avatar ppolv commented on July 25, 2024

I started with the binddata() and getbounddata(), on ppolv/lua-nginx-module@3d0bbed

Not really sure if I'm writing the tests correctly, specially to check if I'm freeing the data correctly when the sockets are closed.

I went to use a full lua table (if needed) to store the bind data, as thought that allowing only integers values was going to be too limiting and make developers tasks more complex. Do you think is ok?

from lua-resty-mysql.

agentzh avatar agentzh commented on July 25, 2024

@ppolv Hmm, I don't like the extra complexity involved with supporting arbitrary Lua values here. I'd rather make binddata support numbers only at least for now.

The user can always map her values to a Lua number via something like this in her own Lua code anyway: https://github.com/openresty/lua-resty-lock/blob/master/lib/resty/lock.lua#L27

from lua-resty-mysql.

ppolv avatar ppolv commented on July 25, 2024

ok, not sure how to do that actually :) like with a c-side tree | linked list?. Will not touch that for now, will try to continue work on mysql side.

With only integers I was worried there won't be a way to "free" the user-mapped value to it when the socket is closed by nginx (idle timeout, request crash before returning it to pool, whatever). But probably there is and I'm not thinking on it right. Or might be one doesn't really need that, don't know.

again, thanks for your time!

from lua-resty-mysql.

agentzh avatar agentzh commented on July 25, 2024

@ppolv Yes, you're right about the cleanup part. I missed that.

Okay, I've given it a second thought. It does not look too bad for supporting arbitrary Lua values out of the box. Maybe you can relax the check for the value type? Right now it allows Lua strings only, it seems?

Also, will you create a pull request for it? In case you're not familiar with the process, please check out this document: https://help.github.com/articles/creating-a-pull-request/ Thanks!

from lua-resty-mysql.

ppolv avatar ppolv commented on July 25, 2024

Yes, was forcing only string keys, but indeed that was just arbitrary. Will remove it and create the pull request this week, thanks!.

from lua-resty-mysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.