MySQL Proxy Tutorial - Return a simple dataset

Developed In: Lua — Contributed by: Giuseppe Maxia

this function returns a simple dataset with one column and one row. It is useful for passing back messages to the client.


Giuseppe Maxia
Lua
  1. function simple_dataset (header, message)
  2. proxy.response.type = proxy.MYSQLD_PACKET_OK
  3. proxy.response.resultset = {
  4. fields = {
  5. {type = proxy.MYSQL_TYPE_STRING, name = header}
  6. },
  7. rows = {
  8. { message}
  9. }
  10. }
  11. return proxy.PROXY_SEND_RESULT
  12. end
  13.  
  14. -- usage:
  15. return simple_dataset('from user', 'this message')

Current Tags

You must be logged in to tag this tool

No Comments yet

Votes

  • Rated 5.00 out of 5
Rated 5.00 out of 5 with 2 votes cast.
You must be logged in to vote.

Watches

1 members are watching this tool
You must be logged in to track this tool.

Provide Feedback

Please note:
HTML will be purified, but we allow for a number of HTML tags so that you have the flexibility to decorate your comment text to some extent. The comments allow the following HTML tags:

strong, b, em, blockquote, a, code, pre

To put code into your comment, simply encapsulate your code with
[code language="XXX"][/code], where XXX is any common language, for instance "PHP", "SQL", "C", etc.



You must be logged in to comment