aboutsummaryrefslogtreecommitdiff
path: root/databases/mysql-proxy
diff options
context:
space:
mode:
authorCheng-Lung Sung <clsung@FreeBSD.org>2009-12-03 09:22:27 +0000
committerCheng-Lung Sung <clsung@FreeBSD.org>2009-12-03 09:22:27 +0000
commitb3c440aee0c01dde930756cae726d6bc79b42210 (patch)
tree7edd76d4fd55c78289f1de25a3cec21192d45e8e /databases/mysql-proxy
parent1c5926f8150d2e5e862d2837f5be5337776dee68 (diff)
downloadports-b3c440aee0c01dde930756cae726d6bc79b42210.tar.gz
ports-b3c440aee0c01dde930756cae726d6bc79b42210.zip
- fix rw-splitting.
- See full description at http://bugs.mysql.com/bug.php?id=46141 - bump PORTREVISION PR: ports/140695 Submitted by: Vladimir Korkodinov <viper_AT_perm dot raid dot ru>
Notes
Notes: svn path=/head/; revision=245153
Diffstat (limited to 'databases/mysql-proxy')
-rw-r--r--databases/mysql-proxy/Makefile2
-rw-r--r--databases/mysql-proxy/files/patch-src-network-injection-lua.c93
2 files changed, 94 insertions, 1 deletions
diff --git a/databases/mysql-proxy/Makefile b/databases/mysql-proxy/Makefile
index f9b513f5361f..1b47e3352f9e 100644
--- a/databases/mysql-proxy/Makefile
+++ b/databases/mysql-proxy/Makefile
@@ -7,7 +7,7 @@
PORTNAME= mysql-proxy
PORTVERSION= 0.7.2
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= databases
MASTER_SITES= ${MASTER_SITE_MYSQL}
MASTER_SITE_SUBDIR= MySQL-Proxy
diff --git a/databases/mysql-proxy/files/patch-src-network-injection-lua.c b/databases/mysql-proxy/files/patch-src-network-injection-lua.c
new file mode 100644
index 000000000000..f876f7a8585c
--- /dev/null
+++ b/databases/mysql-proxy/files/patch-src-network-injection-lua.c
@@ -0,0 +1,93 @@
+--- src/network-injection-lua.c.orig 2009-06-30 22:47:39.000000000 +0600
++++ src/network-injection-lua.c 2009-11-17 09:39:32.000000000 +0500
+@@ -33,17 +33,18 @@
+ #define TIME_DIFF_US(t2, t1) \
+ ((t2.tv_sec - t1.tv_sec) * 1000000.0 + (t2.tv_usec - t1.tv_usec))
+
++typedef enum {
++ PROXY_QUEUE_ADD_PREPEND,
++ PROXY_QUEUE_ADD_APPEND
++} proxy_queue_add_t;
+
+ /**
+- * proxy.queries:append(id, packet[, { options }])
++ * handle _append() and _prepend()
+ *
+- * id: opaque numeric id (numeric)
+- * packet: mysql packet to append (string) FIXME: support table for multiple packets
+- * options: table of options (table)
+- * backend_ndx: backend_ndx to send it to (numeric)
+- * resultset_is_needed: expose the result-set into lua (bool)
++ * _append() and _prepend() have the same behaviour, parameters, ...
++ * just different in position
+ */
+-static int proxy_queue_append(lua_State *L) {
++static int proxy_queue_add(lua_State *L, proxy_queue_add_t type) {
+ GQueue *q = *(GQueue **)luaL_checkself(L);
+ int resp_type = luaL_checkinteger(L, 2);
+ size_t str_len;
+@@ -68,7 +69,12 @@
+ } else if (lua_isboolean(L, -1)) {
+ inj->resultset_is_needed = lua_toboolean(L, -1);
+ } else {
+- luaL_argerror(L, 4, ":append(..., { resultset_is_needed = boolean } ), is %s");
++ switch (type) {
++ case PROXY_QUEUE_ADD_APPEND:
++ return luaL_argerror(L, 4, ":append(..., { resultset_is_needed = boolean } ), is %s");
++ case PROXY_QUEUE_ADD_PREPEND:
++ return luaL_argerror(L, 4, ":prepend(..., { resultset_is_needed = boolean } ), is %s");
++ }
+ }
+
+ lua_pop(L, 1);
+@@ -78,25 +84,34 @@
+ luaL_typerror(L, 4, "table");
+ break;
+ }
+-
+- network_injection_queue_append(q, inj);
+-
+- return 0;
++
++ switch (type) {
++ case PROXY_QUEUE_ADD_APPEND:
++ network_injection_queue_append(q, inj);
++ return 0;
++ case PROXY_QUEUE_ADD_PREPEND:
++ network_injection_queue_prepend(q, inj);
++ return 0;
++ }
++
++ g_assert_not_reached();
++}
++
++/**
++ * proxy.queries:append(id, packet[, { options }])
++ *
++ * id: opaque numeric id (numeric)
++ * packet: mysql packet to append (string) FIXME: support table for multiple packets
++ * options: table of options (table)
++ * backend_ndx: backend_ndx to send it to (numeric)
++ * resultset_is_needed: expose the result-set into lua (bool)
++ */
++static int proxy_queue_append(lua_State *L) {
++ return proxy_queue_add(L, PROXY_QUEUE_ADD_APPEND);
+ }
+
+ static int proxy_queue_prepend(lua_State *L) {
+- /* we expect 2 parameters */
+- GQueue *q = *(GQueue **)luaL_checkself(L);
+- int resp_type = luaL_checkinteger(L, 2);
+- size_t str_len;
+- const char *str = luaL_checklstring(L, 3, &str_len);
+-
+- GString *query = g_string_sized_new(str_len);
+- g_string_append_len(query, str, str_len);
+-
+- network_injection_queue_prepend(q, injection_new(resp_type, query));
+-
+- return 0;
++ return proxy_queue_add(L, PROXY_QUEUE_ADD_PREPEND);
+ }
+
+ static int proxy_queue_reset(lua_State *L) {