-
Notifications
You must be signed in to change notification settings - Fork 89
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
Handle text protocol COM_QUERY response #138
Handle text protocol COM_QUERY response #138
Conversation
Hm. Not sure why my changes messed with the existing unit tests. I'll fix them and update. |
0a56b59
to
b325c05
Compare
39887ff
to
ba54e00
Compare
ba54e00
to
94e95d5
Compare
31c9ff4
to
9b17906
Compare
Adding tests and more data types
* Fix tablename overlap between 'test' and 'test'
* Also, slight refactoring of decode function dispatch Elixir 1.1 does not support guards in else
9b17906
to
04cacbd
Compare
1 similar comment
Sorry about the coveralls/travis noise - I was having issues getting the Elixir 1.1 build to work. Tests pass everywhere now :) |
Ping @liveforeverx - tests pass, so the question is, is this functionality something we want to have around? |
Pong, sorry for late answer. |
What use case, do you need it for? |
Is there some query or database, which didn't support prepared statements? |
Yes, as far as I can tell the Sphinx search MySQL protocol does not support prepared statements. |
I guess an alternative could be that we can add optional client side preparation of statements :\ |
@liveforeverx I forgot about this PR for a couple weeks. Revisiting this - what do you think of adding this functionality? |
I would like to implement cursor support so results of queries can be streamed with memory efficiency inside a transaction but this is prohibitively difficult if the text protocol is supported. Is it possible to drop text query support? I realise this is the opposite of the request in this PR. |
@fishcakez Hi there, I'm a coworker of @jdangerx, and I think dropping text protocol support is infeasible given the large number of mysql commands that are unable to be executed through the prepared statement/binary protocol. Currently, this is impacting us when we attempt to connect to Sphinx, which doesn't seem to have support for the binary protocol. |
@shantiii thanks for letting me. In that case I won't implement cursors but just do a standard query. I'll let someone else pick it up if they need it. |
@fishcakez : Is it possible to support cursor only for prepared queries? |
@liveforeverx yeah I managed it here: #145. |
That's great news! We don't need it to work with elixir < 1.2. Are you planning on doing the rebasing or should I? |
@jdangerx Thanks for the work! Merged now. If you have further enhancements for text protocol, welcome. |
Thanks @liveforeverx! There are likely a few more enhancements in the pipeline, courtesy of @shantiii. |
The MySQL text protocol COM_QUERY response is not supported. I needed to communicated with a MySQL-like implementation that only supported the text protocol, so I was running into #132.
This is my implementation of the text query response protocol. The difference between the binary and text protocols is that the text protocol converts all the row data to length encoded strings. I've made
Query.decode
dispatch on the query type, added more function clauses tohandle_text_query
, and added a bunch of string parsing for thedecode_text_rows
function.I also have a few questions/concerns about my code:
handle_text_query
function should be able to have more overlap with thehandle_binary_query
functions, but I'm not sure how that would work. It sure would be nice to DRY it up a bit.Mariaex.query
- does that seem like something that we could or should insert into the API?