Oracle 5.0 Reference Manual page 1436

Table of Contents

Advertisement

Constant
MYSQL_TYPE_FLOAT
MYSQL_TYPE_DOUBLE
MYSQL_TYPE_NULL
MYSQL_TYPE_TIMESTAMP
MYSQL_TYPE_LONGLONG
MYSQL_TYPE_INT24
MYSQL_TYPE_DATE
MYSQL_TYPE_TIME
MYSQL_TYPE_DATETIME
MYSQL_TYPE_YEAR
MYSQL_TYPE_NEWDATE
MYSQL_TYPE_ENUM
MYSQL_TYPE_SET
MYSQL_TYPE_TINY_BLOB
MYSQL_TYPE_MEDIUM_BLOB
MYSQL_TYPE_LONG_BLOB
MYSQL_TYPE_BLOB
MYSQL_TYPE_VAR_STRING
MYSQL_TYPE_STRING
MYSQL_TYPE_TINY
MYSQL_TYPE_ENUM
MYSQL_TYPE_GEOMETRY
MYSQL_TYPE_BIT
15.7.4.3. Capturing a Connection with
When the proxy accepts a connection from a MySQL client, the
called.
There are no arguments to the function, but you can use and if necessary manipulate the information in
the
proxy.connection
For example, if you have multiple backend servers, you can specify which server that connection
should use by setting the value of
following code chooses between two servers based on whether the current time in minutes is odd or
even:
function connect_server()
print("--> a client really wants to talk to a server")
if (tonumber(os.date("%M")) % 2 == 0) then
else
end
print("Using " .. proxy.global.backends[proxy.connection.backend_ndx].dst.name)
end
This example also displays the IP address/port combination by accessing the information from the
internal
proxy.global.backends
MySQL Proxy Scripting
Field Type
Float
Double
Null
Timestamp
Long long
Integer
Date
Time
Datetime
Year
Date (MySQL 5.0 or later)
Enumeration
Set
Tiny Blob
Medium Blob
Long Blob
Blob
Varstring
String
Tiny (compatible with
Enumeration (compatible with MYSQL_TYPE_INTERVAL)
Geometry
Bit
connect_server()
table, which is unique to each client session.
proxy.connection.backend_ndx
proxy.connection.backend_ndx = 2
print("Choosing backend 2")
proxy.connection.backend_ndx = 1
print("Choosing backend 1")
table.
MYSQL_TYPE_CHAR)
connect_server()
1416
function is
to a valid server number. The

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents