Detailed description of Mysql Proxy Lua internal struct and variables

Source: Internet
Author: User

Mysql Proxy LuaInternalStructureBody andVariableIs the content to be introduced in this article, mainly to learnMysql ProxyOfStructureBody andVariableFor more information, see this article.

Mysql ProxyOfLUAMany internal structures can be used in the configuration script. The most important one is proxy. proxy provides many other struct interfaces, such as the connection list and backend server list. Structures from customers such as incoming packet only exist in the context of script functions.

Attribute description:

 
 
  1. Connection: contains the connection proxy. connection list of all active customers ..
  2. Servers: List of backend servers proxy. backends)
  3. Queries: the query that a customer wants to send to the server
  4. PROXY_VERSION: Mysql Proxy version, in hexadecimal format.

Proxy. connection

Proxy. connection is a read-only object that provides information about the current active connection.

Proxy. connection attributes:

Thread_id: Connection threadid

Backend_ndx: ID of the backend server corresponding to the current connection

Proxy. backends

The proxy. backends part is writable and contains a list of background server and server meta information. You can specify the backend server used by the current connection.

Proxy. backends attributes:

Address: Host Name/Port Combination of the current connection

Connected_clients: number of connected customers

State: the status of the backend server.

Proxy. queries

Proxy. queries is a query queue to be sent to the server,

 
 
  1. The queue is not populated automatically, but if you do not explicitly populate the queue then queries are
  2. passed on to the backend server verbatim. Also, if you do not populate the query queue by hand,
  3. then the read_query_result() function is not triggered.
  4. The following methods are supported for populating the proxy.queries object.  

Function Description:

 
 
  1. Append (id, packet) is added to the end of the team.
  2. Prepend (id, packet) inserts the queue header.
  3. Len () returns the length of the queried queue

The following constant Mysql Proxy is used to specify the operation:

 
 
  1. PROXY_SEND_QUERY is sent to the server.
  2. PROXY_SEND_RESULT: return the client Query Result
  3. PROXY_IGNORE_RESULT discard result set

Package status constant: 

 
 
  1. MYSQLD_PACKET_OK The packet is OK.   
  2. MYSQLD_PACKET_ERR The packet contains error information.   
  3. MYSQLD_PACKET_RAW The packet contains raw data.  

Constant background status:

 
 
  1. BACKEND_STATE_UNKNOWN The current status is unknown.
  2. BACKEND_STATE_UP The backend is known to be up (available ).
  3. BACKEND_STATE_DOWN The backend is known to be down (unavailable ).
  4. BACKEND_TYPE_UNKNOWN Backend type is unknown.
  5. BACKEND_TYPE_RW Backend is available for read/write.
  6. BACKEND_TYPE_RO Backend is available only for read-only use.
  7.  
  8. Server command constant:
  9.  
  10. Constant Description
  11. COM_SLEEP Sleep
  12. COM_QUIT Quit
  13. COM_INIT_DB Initialize database
  14. COM_QUERY Query
  15. COM_FIELD_LIST Field List
  16. COM_CREATE_DB Create database
  17. COM_DROP_DB Drop database
  18. COM_REFRESH Refresh
  19. COM_SHUTDOWN Shutdown
  20. COM_STATISTICS Statistics
  21. COM_PROCESS_INFO Process List
  22. COM_CONNECT Connect
  23. COM_PROCESS_KILL Kill
  24. COM_DEBUG Debug
  25. COM_PING Ping
  26. COM_TIME Time
  27. COM_DELAYED_INSERT Delayed insert
  28. COM_CHANGE_USER Change user
  29. COM_BINLOG_DUMP Binlog dump
  30. COM_TABLE_DUMP Table dump
  31. COM_CONNECT_OUT Connect out
  32. COM_REGISTER_SLAVE Register slave
  33. COM_STMT_PREPARE Prepare server-side statement
  34. COM_STMT_EXECUTE Execute server-side statement
  35. COM_STMT_SEND_LONG_DATA Long data
  36. COM_STMT_CLOSE Close server-side statement
  37. COM_STMT_RESET Reset statement
  38. COM_SET_OPTION Set option
  39. COM_STMT_FETCH Fetch statement
  40. COM_DAEMON Daemon (MySQL 5.1 only)
  41. COM_ERROR Error

MySQL Data Type

 
 
  1. Constant Field Type   
  2. MYSQL_TYPE_DECIMAL Decimal   
  3. MYSQL_TYPE_NEWDECIMAL Decimal (MySQL 5.0 or later)   
  4. MYSQL_TYPE_TINY Tiny   
  5. MYSQL_TYPE_SHORT Short   
  6. MYSQL_TYPE_LONG Long   
  7. MYSQL_TYPE_FLOAT Float   
  8. MYSQL_TYPE_DOUBLE Double   
  9. MYSQL_TYPE_NULL Null   
  10. MYSQL_TYPE_TIMESTAMP Timestamp   
  11. MYSQL_TYPE_LONGLONG Long long   
  12. MYSQL_TYPE_INT24 Integer   
  13. MYSQL_TYPE_DATE Date   
  14. MYSQL_TYPE_TIME Time   
  15. MYSQL_TYPE_DATETIME Datetime   
  16. MYSQL_TYPE_YEAR Year   
  17. MYSQL_TYPE_NEWDATE Date (MySQL 5.0 or later)   
  18. MYSQL_TYPE_ENUM Enumeration   
  19. MYSQL_TYPE_SET Set   
  20. MYSQL_TYPE_TINY_BLOB Tiny Blob   
  21. MYSQL_TYPE_MEDIUM_BLOB Medium Blob   
  22. MYSQL_TYPE_LONG_BLOB Long Blob   
  23. MYSQL_TYPE_BLOB Blob   
  24. MYSQL_TYPE_VAR_STRING Varstring   
  25. MYSQL_TYPE_STRING String   
  26. MYSQL_TYPE_TINY Tiny (compatible with MYSQL_TYPE_CHAR)    
  27. MYSQL_TYPE_ENUM Enumeration (compatible with MYSQL_TYPE_INTERVAL)   
  28. MYSQL_TYPE_GEOMETRY Geometry   
  29. MYSQL_TYPE_BIT Bit   

Summary: DetailsMysql Proxy LuaInternalStructureBody andVariableI hope this article will help you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.