首页 > 数据库 > Mysql-Proxy的内部结构体以及变量

Mysql-Proxy的内部结构体以及变量

2009年6月14日 发表评论 阅读评论

属性描述:
connection:包含所有活动客户的连接(proxy.connection )列表. .
servers: 后台服务器的列表( proxy.backends)
queries:某一客户要发送到服务器端的查询
PROXY_VERSION :mysql-proxy版本,十六进制。
proxy.connection
proxy.connection 是只读对象,提供了当前活动连接的信息
proxy.connection 属性:
thread_id :连接的threadid
backend_ndx :当前连接所对应的后端服务器编号
proxy.backends
proxy.backends部分可写的,包含了后台服务器以及服务器meta信息的列表 ,你可以指定当前连接使用那个后台服务器。
proxy.backends 属性:
address: 当前连接的主机名/端口组合
connected_clients:目前已连接的客户数
state:后台服务器的状态
proxy.queries
proxy.queries是一个要送往服务器的查询队列, The queue is not populated automatically, but if you do not explicitly populate the queue then queries are passed on to the backend server verbatim. Also, if you do not populate the query queue by hand, then the read_query_result() function is not triggered.
The following methods are supported for populating the proxy.queries object.
函数描述:
append(id,packet) 添加到队尾。
prepend(id,packet) 插入队头。
len() 返回查询的队列长度

以下常量mysql-proxy用来客户指定操作:
PROXY_SEND_QUERY 发送查询给服务器.
PROXY_SEND_RESULT 返回客户端查询结果
PROXY_IGNORE_RESULT 丢弃结果集
包状态常量:
MYSQLD_PACKET_OK The packet is OK.
MYSQLD_PACKET_ERR The packet contains error information.
MYSQLD_PACKET_RAW The packet contains raw data.
后台状态常量:
BACKEND_STATE_UNKNOWN The current status is unknown.
BACKEND_STATE_UP The backend is known to be up (available).
BACKEND_STATE_DOWN The backend is known to be down (unavailable).
BACKEND_TYPE_UNKNOWN Backend type is unknown.
BACKEND_TYPE_RW Backend is available for read/write.
BACKEND_TYPE_RO Backend is available only for read-only use.
服务器命令常量:
Constant Description
COM_SLEEP Sleep
COM_QUIT Quit
COM_INIT_DB Initialize database
COM_QUERY Query
COM_FIELD_LIST Field List
COM_CREATE_DB Create database
COM_DROP_DB Drop database
COM_REFRESH Refresh
COM_SHUTDOWN Shutdown
COM_STATISTICS Statistics
COM_PROCESS_INFO Process List
COM_CONNECT Connect
COM_PROCESS_KILL Kill
COM_DEBUG Debug
COM_PING Ping
COM_TIME Time
COM_DELAYED_INSERT Delayed insert
COM_CHANGE_USER Change user
COM_BINLOG_DUMP Binlog dump
COM_TABLE_DUMP Table dump
COM_CONNECT_OUT Connect out
COM_REGISTER_SLAVE Register slave
COM_STMT_PREPARE Prepare server-side statement
COM_STMT_EXECUTE Execute server-side statement
COM_STMT_SEND_LONG_DATA Long data
COM_STMT_CLOSE Close server-side statement
COM_STMT_RESET Reset statement
COM_SET_OPTION Set option
COM_STMT_FETCH Fetch statement
COM_DAEMON Daemon (MySQL 5.1 only)
COM_ERROR Error
MySQL数据类型
Constant Field Type
MYSQL_TYPE_DECIMAL Decimal
MYSQL_TYPE_NEWDECIMAL Decimal (MySQL 5.0 or later)
MYSQL_TYPE_TINY Tiny
MYSQL_TYPE_SHORT Short
MYSQL_TYPE_LONG Long
MYSQL_TYPE_FLOAT Float
MYSQL_TYPE_DOUBLE Double
MYSQL_TYPE_NULL Null
MYSQL_TYPE_TIMESTAMP Timestamp
MYSQL_TYPE_LONGLONG Long long
MYSQL_TYPE_INT24 Integer
MYSQL_TYPE_DATE Date
MYSQL_TYPE_TIME Time
MYSQL_TYPE_DATETIME Datetime
MYSQL_TYPE_YEAR Year
MYSQL_TYPE_NEWDATE Date (MySQL 5.0 or later)
MYSQL_TYPE_ENUM Enumeration
MYSQL_TYPE_SET Set
MYSQL_TYPE_TINY_BLOB Tiny Blob
MYSQL_TYPE_MEDIUM_BLOB Medium Blob
MYSQL_TYPE_LONG_BLOB Long Blob
MYSQL_TYPE_BLOB Blob
MYSQL_TYPE_VAR_STRING Varstring
MYSQL_TYPE_STRING String
MYSQL_TYPE_TINY Tiny (compatible with MYSQL_TYPE_CHAR)
MYSQL_TYPE_ENUM Enumeration (compatible with MYSQL_TYPE_INTERVAL)
MYSQL_TYPE_GEOMETRY Geometry
MYSQL_TYPE_BIT Bit

分类: 数据库 标签: 3,818 次阅读
原文链接:http://www.wenhq.com/article/view_327.html
欢迎转载,请注明出处:亲亲宝宝
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.