├── .bzrignore ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── COPYING.rtf ├── ChangeLog ├── Doxyfile ├── INSTALL ├── Makefile.am ├── NEWS ├── README ├── README.TESTS ├── README.rtf ├── THANKS ├── autogen.sh ├── cmake ├── ChassisInstall.cmake ├── ChassisPlugin.cmake ├── Makefile.am └── Tar.cmake ├── config.h.cmake ├── configure.ac ├── deps ├── CMakeLists.txt ├── libevent.CMakeLists.txt ├── libevent.cmake ├── libevent.config.h.cmake ├── libevent.def ├── libevent.event-config.h.cmake ├── libevent.event.h.cmake └── libevent.evutil.h.cmake ├── doc ├── Makefile.am ├── architecture-overview.dot ├── architecture.dot ├── architecture.txt ├── book.txt ├── chapter │ ├── Makefile.am │ ├── protocol.txt │ └── scripting.txt ├── chassis.txt ├── core.txt ├── lifecycle.msc ├── lua-classes.dot ├── plugins.txt ├── protocol.txt ├── scripting.txt ├── tests.txt └── testsuite.txt ├── doxygen-scripts ├── doxygen_version.sh ├── footer.html └── project_number_bzr.sh ├── examples ├── CMakeLists.txt ├── Makefile.am ├── tutorial-basic.lua ├── tutorial-constants.lua ├── tutorial-inject.lua ├── tutorial-keepalive.lua ├── tutorial-monitor.lua ├── tutorial-packets.lua ├── tutorial-prep-stmts.lua ├── tutorial-query-time.lua ├── tutorial-resultset.lua ├── tutorial-rewrite.lua ├── tutorial-routing.lua ├── tutorial-scramble.lua ├── tutorial-states.lua ├── tutorial-tokenize.lua ├── tutorial-union.lua └── tutorial-warnings.lua ├── internal └── filesgpl2 ├── lib ├── CMakeLists.txt ├── Makefile.am ├── active-queries.lua ├── active-transactions.lua ├── admin-sql.lua ├── admin.lua ├── analyze-query.lua ├── auditing.lua ├── chassis.c ├── chassis.def ├── commit-obfuscator.lua ├── commit-obfuscator.msc ├── glib2.c ├── glib2.def ├── histogram.lua ├── lfs.c ├── lfs.def ├── load-multi.lua ├── lpeg.c ├── lpeg.def ├── mysql-password.c ├── mysql-proto.c ├── mysql.def ├── posix.c ├── posix.def ├── proxy │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── auto-config.lua │ ├── balance.lua │ ├── commands.lua │ ├── parser.lua │ ├── test.lua │ └── tokenizer.lua ├── ro-balance.lua ├── ro-pooling.lua ├── rw-splitting.lua ├── sql-tokenizer-gen.c ├── sql-tokenizer-keywords.h ├── sql-tokenizer-lua.c ├── sql-tokenizer-tokens.c ├── sql-tokenizer.h ├── sql-tokenizer.l └── xtab.lua ├── m4 ├── Makefile.am └── sed.m4 ├── mysql-chassis.pc.cmake ├── mysql-chassis.pc.in ├── mysql-proxy.pc.cmake ├── mysql-proxy.pc.in ├── mysql-proxy.spec.in ├── plugins ├── CMakeLists.txt ├── Makefile.am ├── admin │ ├── CMakeLists.txt │ ├── Makefile.am │ └── admin-plugin.c ├── cli │ ├── CMakeLists.txt │ ├── Makefile.am │ └── cli-plugin.c ├── debug │ ├── CMakeLists.txt │ ├── Makefile.am │ └── debug-plugin.c ├── proxy │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── proxy-plugin.c │ └── proxy-plugin.h └── replicant │ ├── CMakeLists.txt │ ├── Makefile.am │ └── replicant-plugin.c ├── scripts ├── Makefile.am └── mysql-proxy-binwrapper.in ├── src ├── CMakeLists.txt ├── Makefile.am ├── chassis-event-thread.c ├── chassis-event-thread.h ├── chassis-exports.h ├── chassis-filemode.c ├── chassis-filemode.h ├── chassis-frontend.c ├── chassis-frontend.h ├── chassis-gtimeval.c ├── chassis-gtimeval.h ├── chassis-keyfile.c ├── chassis-keyfile.h ├── chassis-limits.c ├── chassis-limits.h ├── chassis-log.c ├── chassis-log.h ├── chassis-mainloop.c ├── chassis-mainloop.h ├── chassis-options.c ├── chassis-options.h ├── chassis-path.c ├── chassis-path.h ├── chassis-plugin.c ├── chassis-plugin.h ├── chassis-shutdown-hooks.c ├── chassis-shutdown-hooks.h ├── chassis-stats.c ├── chassis-stats.h ├── chassis-timings.c ├── chassis-timings.h ├── chassis-unix-daemon.c ├── chassis-unix-daemon.h ├── chassis-win32-service.c ├── chassis-win32-service.h ├── disable-dtrace.h ├── glib-ext-ref.c ├── glib-ext-ref.h ├── glib-ext.c ├── glib-ext.h ├── lua-env.c ├── lua-env.h ├── lua-load-factory.c ├── lua-load-factory.h ├── lua-registry-keys.h ├── lua-scope.c ├── lua-scope.h ├── my_rdtsc.c ├── my_rdtsc.h ├── my_timer_cycles.il ├── mysql-binlog-dump.c ├── mysql-myisam-dump.c ├── mysql-proxy-cli.c ├── mysql-proxy.mc ├── network-address-lua.c ├── network-address-lua.h ├── network-address.c ├── network-address.h ├── network-asn1.c ├── network-asn1.h ├── network-backend-lua.c ├── network-backend-lua.h ├── network-backend.c ├── network-backend.h ├── network-conn-pool-lua.c ├── network-conn-pool-lua.h ├── network-conn-pool.c ├── network-conn-pool.h ├── network-debug.h ├── network-exports.h ├── network-injection-lua.c ├── network-injection-lua.h ├── network-injection.c ├── network-injection.h ├── network-mysqld-binlog.c ├── network-mysqld-binlog.h ├── network-mysqld-lua.c ├── network-mysqld-lua.h ├── network-mysqld-masterinfo.c ├── network-mysqld-masterinfo.h ├── network-mysqld-packet.c ├── network-mysqld-packet.h ├── network-mysqld-proto.c ├── network-mysqld-proto.h ├── network-mysqld-table.c ├── network-mysqld.c ├── network-mysqld.h ├── network-packet.c ├── network-packet.h ├── network-queue.c ├── network-queue.h ├── network-socket-lua.c ├── network-socket-lua.h ├── network-socket.c ├── network-socket.h ├── network-spnego.c ├── network-spnego.h ├── network_mysqld_proto_binary.c ├── network_mysqld_proto_binary.h ├── network_mysqld_type.c ├── network_mysqld_type.h ├── proxy-dtrace-provider.d ├── string-len.h ├── sys-pedantic.h └── test-latency.c ├── tests ├── CMakeLists.txt ├── Makefile.am ├── c-api-burst.c ├── gtester-to-junit.xslt ├── suite │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── base │ │ ├── Makefile.am │ │ ├── r │ │ │ ├── Makefile.am │ │ │ ├── bug_30867.result │ │ │ ├── bug_35669.result │ │ │ ├── bug_35729.result │ │ │ ├── bug_41991.result │ │ │ ├── bug_43078.result │ │ │ ├── bug_45167.result │ │ │ ├── bug_46141.result │ │ │ ├── bug_49248.result │ │ │ ├── bug_55459.result │ │ │ ├── bug_61998.result │ │ │ ├── chain1.result │ │ │ ├── change_user.result │ │ │ ├── client_address.result │ │ │ ├── client_address_socket.result │ │ │ ├── constants.result │ │ │ ├── error_struct.result │ │ │ ├── failover.result │ │ │ ├── ignore-resultset.result │ │ │ ├── invalid_response_packets.result │ │ │ ├── lineno.result │ │ │ ├── load-data-infile.result │ │ │ ├── load_multi.result │ │ │ ├── mysql-40.result │ │ │ ├── no_backend.result │ │ │ ├── overlong.result │ │ │ ├── pooling.result │ │ │ ├── raw_packets.result │ │ │ ├── resultset.result │ │ │ ├── select_affected_rows.result │ │ │ ├── select_null.result │ │ │ ├── tokens-normalize.result │ │ │ ├── tokens1.result │ │ │ ├── tokens2.result │ │ │ ├── xtab1.result │ │ │ └── xtab2.result │ │ ├── t │ │ │ ├── Makefile.am │ │ │ ├── bug_30867.lua │ │ │ ├── bug_30867.options │ │ │ ├── bug_30867.test │ │ │ ├── bug_35669-mock.lua │ │ │ ├── bug_35669-test.lua │ │ │ ├── bug_35669.options │ │ │ ├── bug_35669.test │ │ │ ├── bug_35729-mock.lua │ │ │ ├── bug_35729-test.lua │ │ │ ├── bug_35729.options │ │ │ ├── bug_35729.test │ │ │ ├── bug_41991-mock.lua │ │ │ ├── bug_41991-test.lua │ │ │ ├── bug_41991.options │ │ │ ├── bug_41991.test │ │ │ ├── bug_43078-mock.lua │ │ │ ├── bug_43078-test.lua │ │ │ ├── bug_43078.options │ │ │ ├── bug_43078.test │ │ │ ├── bug_45167-mock.lua │ │ │ ├── bug_45167-test.lua │ │ │ ├── bug_45167.options │ │ │ ├── bug_45167.test │ │ │ ├── bug_46141-mock.lua │ │ │ ├── bug_46141-test.lua │ │ │ ├── bug_46141.options │ │ │ ├── bug_46141.test │ │ │ ├── bug_49248-mock.lua │ │ │ ├── bug_49248-test.lua │ │ │ ├── bug_49248.options │ │ │ ├── bug_49248.test │ │ │ ├── bug_55459-mock.lua │ │ │ ├── bug_55459-test.lua │ │ │ ├── bug_55459.options │ │ │ ├── bug_55459.test │ │ │ ├── bug_61998.lua │ │ │ ├── bug_61998.test │ │ │ ├── chain1.options │ │ │ ├── chain1.test │ │ │ ├── chain1a.lua │ │ │ ├── chain1b.lua │ │ │ ├── change_user.lua │ │ │ ├── change_user.options │ │ │ ├── change_user.test │ │ │ ├── client_address-mock.lua │ │ │ ├── client_address-test.lua │ │ │ ├── client_address.options │ │ │ ├── client_address.test │ │ │ ├── client_address_socket.lua │ │ │ ├── client_address_socket.options │ │ │ ├── client_address_socket.test │ │ │ ├── constants-mock.lua │ │ │ ├── constants-test.lua │ │ │ ├── constants.options │ │ │ ├── constants.test │ │ │ ├── default.options │ │ │ ├── error_struct.lua │ │ │ ├── error_struct.test │ │ │ ├── failover-mock.lua │ │ │ ├── failover-test.lua │ │ │ ├── failover.options │ │ │ ├── failover.test │ │ │ ├── ignore-resultset-mock.lua │ │ │ ├── ignore-resultset-test.lua │ │ │ ├── ignore-resultset.options │ │ │ ├── ignore-resultset.test │ │ │ ├── invalid_response_packets-mock.lua │ │ │ ├── invalid_response_packets-test.lua │ │ │ ├── invalid_response_packets.options │ │ │ ├── invalid_response_packets.test │ │ │ ├── lineno.lua │ │ │ ├── lineno.test │ │ │ ├── lm1.lua │ │ │ ├── lm2.lua │ │ │ ├── lm3.lua │ │ │ ├── load-data-infile-mock.lua │ │ │ ├── load-data-infile-test.lua │ │ │ ├── load-data-infile.options │ │ │ ├── load-data-infile.test │ │ │ ├── load_multi-mock.lua │ │ │ ├── load_multi-test.lua │ │ │ ├── load_multi.options │ │ │ ├── load_multi.test │ │ │ ├── mysql-40.lua │ │ │ ├── mysql-40.test │ │ │ ├── no_backend.lua │ │ │ ├── no_backend.test │ │ │ ├── overlong-mock.lua │ │ │ ├── overlong-test.lua │ │ │ ├── overlong.options │ │ │ ├── overlong.test │ │ │ ├── pooling-mock.lua │ │ │ ├── pooling-test.lua │ │ │ ├── pooling.options │ │ │ ├── pooling.test │ │ │ ├── raw_packets.lua │ │ │ ├── raw_packets.test │ │ │ ├── resultset-mock.lua │ │ │ ├── resultset-test.lua │ │ │ ├── resultset.options │ │ │ ├── resultset.test │ │ │ ├── select_affected_rows.lua │ │ │ ├── select_affected_rows.test │ │ │ ├── select_null.lua │ │ │ ├── select_null.test │ │ │ ├── tokens-normalize.lua │ │ │ ├── tokens-normalize.test │ │ │ ├── tokens1.lua │ │ │ ├── tokens1.test │ │ │ ├── tokens2.lua │ │ │ ├── tokens2.test │ │ │ ├── xtab1-mock.lua │ │ │ ├── xtab1-test.lua │ │ │ ├── xtab1.options │ │ │ ├── xtab1.test │ │ │ ├── xtab2.lua │ │ │ └── xtab2.test │ │ └── tests_to_skip.lua │ ├── bugs │ │ ├── Makefile.am │ │ ├── r │ │ │ ├── Makefile.am │ │ │ └── bug_29494.result │ │ └── t │ │ │ ├── Makefile.am │ │ │ ├── bug_29494.lua │ │ │ ├── bug_29494.test │ │ │ ├── bug_select_local.lua │ │ │ └── bug_select_local.test │ ├── lua-tests-wrapper.sh.in │ ├── lua_runner.c │ └── run-tests.lua └── unit │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── check_chassis_filemode.c │ ├── check_chassis_log.c │ ├── check_chassis_path.c │ ├── check_loadscript.c │ ├── check_mysqld_proto.c │ ├── check_plugin.c │ ├── check_sql_tokenizer.c │ ├── lua │ ├── CMakeLists.txt │ ├── Makefile.am │ ├── active-queries.lua │ ├── chassis.lua │ ├── lua-tests-wrapper.sh.in │ ├── lua_runner.c │ ├── mysql-proto.lua │ ├── proxy-auto-config.lua │ ├── proxy-commands.lua │ ├── proxy-parser.lua │ ├── proxy-test.lua │ └── proxy-tokenizer.lua │ ├── t_chassis_frontend.c │ ├── t_chassis_keyfile.c │ ├── t_chassis_shutdown_hooks.c │ ├── t_chassis_timings.c │ ├── t_network_address.c │ ├── t_network_asn1.c │ ├── t_network_backend.c │ ├── t_network_injection.c │ ├── t_network_mysqld_masterinfo.c │ ├── t_network_mysqld_packet.c │ ├── t_network_mysqld_type.c │ ├── t_network_queue.c │ ├── t_network_socket.c │ └── t_network_spnego.c └── winbuild.bat /.bzrignore: -------------------------------------------------------------------------------- 1 | *.lo 2 | Makefile 3 | Makefile.in 4 | .deps 5 | .libs 6 | *.la 7 | trunk/src/sql-tokenizer.c 8 | trunk/tests/unit/sql-tokenizer.c 9 | ./.cproject 10 | ./.project 11 | ./.settings 12 | ./build 13 | ./aclocal.m4 14 | ./autom4te.cache 15 | ./configure 16 | ./install-sh 17 | ./ylwrap 18 | ./ltmain.sh 19 | ./depcomp 20 | ./config.sub 21 | ./config.guess 22 | ./config.h.in 23 | ./compile 24 | ./missing 25 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | If you have questions about 2 | 3 | jan 4 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /cmake/ChassisPlugin.cmake: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | 21 | MACRO(CHASSIS_PLUGIN_INSTALL _plugin_name) 22 | IF(NOT WIN32) 23 | INSTALL(TARGETS ${_plugin_name} 24 | DESTINATION lib/mysql-proxy/plugins) 25 | ELSE(NOT WIN32) 26 | ## on win32 the chassis plugins gets prefixed with plugin- and end up in bin/ 27 | GET_TARGET_PROPERTY(built_location ${_plugin_name} LOCATION) 28 | STRING(REPLACE "$(OutDir)" "${CMAKE_BUILD_TYPE}" built_location ${built_location}) 29 | INSTALL(FILES ${built_location} 30 | DESTINATION bin/ 31 | RENAME plugin-${_plugin_name}${CMAKE_SHARED_LIBRARY_SUFFIX} 32 | ) 33 | ## install the .pdb too 34 | IF(CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") 35 | STRING(REPLACE ${CMAKE_SHARED_LIBRARY_SUFFIX} ".pdb" pdb_location ${built_location}) 36 | INSTALL(FILES 37 | ${pdb_location} 38 | DESTINATION bin 39 | ) 40 | ENDIF() 41 | ENDIF(NOT WIN32) 42 | ENDMACRO(CHASSIS_PLUGIN_INSTALL _plugin_name) 43 | 44 | -------------------------------------------------------------------------------- /cmake/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST=\ 2 | Tar.cmake \ 3 | ChassisPlugin.cmake \ 4 | ChassisInstall.cmake 5 | -------------------------------------------------------------------------------- /config.h.cmake: -------------------------------------------------------------------------------- 1 | #cmakedefine HAVE_EVENT_BASE_FREE 2 | #cmakedefine HAVE_EVENT_H 3 | #cmakedefine HAVE_INTTYPES_H 4 | #cmakedefine HAVE_LUA_H 5 | #cmakedefine HAVE_MGMAPI_H 6 | #cmakedefine HAVE_NETINET_IN_H 7 | #cmakedefine HAVE_NET_IF_H 8 | #cmakedefine HAVE_NET_IF_DL_H 9 | #cmakedefine HAVE_PWD_H 10 | #cmakedefine HAVE_SIGNAL_H 11 | #cmakedefine HAVE_STDDEF_H 12 | #cmakedefine HAVE_STDINT_H 13 | #cmakedefine HAVE_STDLIB_H 14 | #cmakedefine HAVE_SYSLOG_H 15 | #cmakedefine HAVE_SYS_IOCTL_H 16 | #cmakedefine HAVE_SYS_FILIO_H 17 | #cmakedefine HAVE_SYS_PARAM_H 18 | #cmakedefine HAVE_SYS_RESOURCE_H 19 | #cmakedefine HAVE_SYS_SOCKET_H 20 | #cmakedefine HAVE_SYS_SOCKIO_H 21 | #cmakedefine HAVE_SYS_TIME_H 22 | #cmakedefine HAVE_SYS_TYPES_H 23 | #cmakedefine HAVE_SYS_UIO_H 24 | #cmakedefine HAVE_SYS_UN_H 25 | #cmakedefine HAVE_TIME_H 26 | #cmakedefine HAVE_UNISTD_H 27 | #cmakedefine HAVE_SYSLOG_H 28 | 29 | #cmakedefine HAVE_INET_NTOP 30 | #cmakedefine HAVE_GETCWD 31 | #cmakedefine HAVE_SIGNAL 32 | #cmakedefine HAVE_SRANDOM 33 | #cmakedefine HAVE_STRERROR 34 | #cmakedefine HAVE_WRITEV 35 | 36 | #cmakedefine HAVE_SOCKLEN_T 37 | #cmakedefine HAVE_ULONG 38 | 39 | #cmakedefine HAVE_GTHREAD 40 | #cmakedefine HAVE_GTHREAD_H 41 | #define SIZEOF_RLIM_T @SIZEOF_RLIM_T@ 42 | -------------------------------------------------------------------------------- /deps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # INCLUDE(deps/libevent.cmake) 2 | -------------------------------------------------------------------------------- /deps/libevent.cmake: -------------------------------------------------------------------------------- 1 | IF(WIN32) 2 | SET(LIBEVENT_SOURCE_DIR "${CMAKE_SOURCE_DIR}/deps/libevent-1.4.11-stable") 3 | IF(EXISTS ${LIBEVENT_SOURCE_DIR}) 4 | ## write CMake file for libevent 5 | 6 | CONFIGURE_FILE(deps/libevent.config.h.cmake ${LIBEVENT_SOURCE_DIR}/config.h.cmake COPYONLY) 7 | CONFIGURE_FILE(deps/libevent.event-config.h.cmake ${LIBEVENT_SOURCE_DIR}/event-config.h.cmake COPYONLY) 8 | CONFIGURE_FILE(deps/libevent.CMakeLists.txt ${LIBEVENT_SOURCE_DIR}/CMakeLists.txt COPYONLY) 9 | CONFIGURE_FILE(deps/libevent.def ${LIBEVENT_SOURCE_DIR}/libevent.def COPYONLY) 10 | ## CONFIGURE_FILE(deps/libevent.event.h.cmake ${LIBEVENT_SOURCE_DIR}/event.h COPYONLY) 11 | ## CONFIGURE_FILE(deps/libevent.evutil.h.cmake ${LIBEVENT_SOURCE_DIR}/evutil.h COPYONLY) 12 | 13 | ADD_SUBDIRECTORY(${LIBEVENT_SOURCE_DIR} build-libevent) 14 | 15 | SET(EVENT_INCLUDE_DIRS ${LIBEVENT_SOURCE_DIR} CACHE INTERNAL "") 16 | IF(EXISTS ${CMAKE_BINARY_DIR}/build-libevent/${CMAKE_BUILD_TYPE}/) 17 | SET(EVENT_LIBRARY_DIRS ${CMAKE_BINARY_DIR}/build-libevent/${CMAKE_BUILD_TYPE} CACHE INTERNAL "") 18 | ELSE(EXISTS ${CMAKE_BINARY_DIR}/build-libevent/${CMAKE_BUILD_TYPE}/) 19 | SET(EVENT_LIBRARY_DIRS ${CMAKE_BINARY_DIR}/build-libevent CACHE INTERNAL "") 20 | ENDIF(EXISTS ${CMAKE_BINARY_DIR}/build-libevent/${CMAKE_BUILD_TYPE}/) 21 | SET(EVENT_LIBRARIES event CACHE INTERNAL "") 22 | ELSE(EXISTS ${LIBEVENT_SOURCE_DIR}) 23 | MESSAGE(FATAL_ERROR "Could not find dependency libevent-1.4.11-stable in ${LIBEVENT_SOURCE_DIR}") 24 | ENDIF(EXISTS ${LIBEVENT_SOURCE_DIR}) 25 | ENDIF(WIN32) 26 | -------------------------------------------------------------------------------- /deps/libevent.config.h.cmake: -------------------------------------------------------------------------------- 1 | #cmakedefine HAVE_STDINT_H 2 | #cmakedefine HAVE_SYS_TIME_H 3 | #cmakedefine HAVE_SYS_TREE_H 4 | #cmakedefine HAVE_FCNTL_H 5 | #cmakedefine HAVE_STDARG_H 6 | #cmakedefine HAVE_INTTYPES_H 7 | #cmakedefine HAVE_STDLIB_H 8 | #cmakedefine HAVE_POLL_H 9 | #cmakedefine HAVE_SIGNAL_H 10 | #cmakedefine HAVE_UNISTD_H 11 | #cmakedefine HAVE_SYS_DEVPOLL_H 12 | #cmakedefine HAVE_PORT_H 13 | #cmakedefine HAVE_KQUEUE_H 14 | 15 | #cmakedefine HAVE_POLL 16 | #cmakedefine HAVE_SELECT 17 | #cmakedefine HAVE_GETTIMEOFDAY 18 | #cmakedefine HAVE_VASPRINTF 19 | #cmakedefine HAVE_FCNTL 20 | #cmakedefine HAVE_CLOCK_GETTIME 21 | #cmakedefine HAVE_STRTOK_R 22 | #cmakedefine HAVE_STRSEP 23 | #cmakedefine HAVE_GETADDRINFO 24 | #cmakedefine HAVE_GETNAMEINFO 25 | #cmakedefine HAVE_STRLCPY 26 | #cmakedefine HAVE_INET_NTOP 27 | #cmakedefine HAVE_SIGTIMEDWAIT 28 | #cmakedefine HAVE_EPOLL 29 | #cmakedefine HAVE_KQUEUE 30 | #cmakedefine HAVE_TIMERADD 31 | #cmakedefine HAVE_TIMERSUB 32 | #cmakedefine HAVE_TIMERISSET 33 | #cmakedefine HAVE_TIMERCLEAR 34 | 35 | #define VERSION "libevent-1.4.11-stable" 36 | -------------------------------------------------------------------------------- /deps/libevent.def: -------------------------------------------------------------------------------- 1 | LIBRARY event.dll 2 | EXPORTS 3 | event_base_new 4 | event_init 5 | event_reinit 6 | event_dispatch 7 | event_base_dispatch 8 | event_base_get_method 9 | event_base_free 10 | event_set_log_callback 11 | event_base_set 12 | event_loop 13 | event_base_loop 14 | event_loopexit 15 | event_base_loopexit 16 | event_loopbreak 17 | event_base_loopbreak 18 | event_set 19 | event_once 20 | event_base_once 21 | event_add 22 | event_del 23 | event_active 24 | event_pending 25 | event_get_version 26 | event_get_method 27 | bufferevent_new 28 | bufferevent_base_set 29 | bufferevent_priority_set 30 | bufferevent_free 31 | bufferevent_setcb 32 | bufferevent_setfd 33 | bufferevent_write 34 | bufferevent_write_buffer 35 | bufferevent_read 36 | bufferevent_enable 37 | bufferevent_disable 38 | bufferevent_settimeout 39 | bufferevent_setwatermark 40 | evbuffer_new 41 | evbuffer_free 42 | evbuffer_expand 43 | evbuffer_add 44 | evbuffer_remove 45 | evbuffer_readline 46 | evbuffer_add_buffer 47 | evbuffer_add_printf 48 | evbuffer_add_vprintf 49 | evbuffer_drain 50 | evbuffer_write 51 | evbuffer_read 52 | evbuffer_find 53 | evbuffer_setcb 54 | evtag_init 55 | evtag_marshal 56 | encode_int 57 | evtag_marshal_int 58 | evtag_marshal_string 59 | evtag_marshal_timeval 60 | evtag_unmarshal 61 | evtag_peek 62 | evtag_peek_length 63 | evtag_payload_length 64 | evtag_consume 65 | evtag_unmarshal_int 66 | evtag_unmarshal_fixed 67 | evtag_unmarshal_string 68 | evtag_unmarshal_timeval 69 | evutil_socketpair 70 | evutil_make_socket_nonblocking 71 | -------------------------------------------------------------------------------- /deps/libevent.event-config.h.cmake: -------------------------------------------------------------------------------- 1 | #cmakedefine _EVENT_HAVE_STDINT_H 2 | #cmakedefine _EVENT_HAVE_SYS_TIME_H 3 | #cmakedefine _EVENT_HAVE_SYS_TREE_H 4 | #cmakedefine _EVENT_HAVE_FCNTL_H 5 | #cmakedefine _EVENT_HAVE_STDARG_H 6 | #cmakedefine _EVENT_HAVE_INTTYPES_H 7 | #cmakedefine _EVENT_HAVE_STDLIB_H 8 | #cmakedefine _EVENT_HAVE_POLL_H 9 | #cmakedefine _EVENT_HAVE_SIGNAL_H 10 | #cmakedefine _EVENT_HAVE_UNISTD_H 11 | #cmakedefine _EVENT_HAVE_SYS_DEVPOLL_H 12 | #cmakedefine _EVENT_HAVE_PORT_H 13 | #cmakedefine _EVENT_HAVE_KQUEUE_H 14 | 15 | #cmakedefine _EVENT_HAVE_POLL 16 | #cmakedefine _EVENT_HAVE_SELECT 17 | #cmakedefine _EVENT_HAVE_GETTIMEOFDAY 18 | #cmakedefine _EVENT_HAVE_VASPRINTF 19 | #cmakedefine _EVENT_HAVE_FCNTL 20 | #cmakedefine _EVENT_HAVE_CLOCK_GETTIME 21 | #cmakedefine _EVENT_HAVE_STRTOK_R 22 | #cmakedefine _EVENT_HAVE_STRSEP 23 | #cmakedefine _EVENT_HAVE_GETADDRINFO 24 | #cmakedefine _EVENT_HAVE_GETNAMEINFO 25 | #cmakedefine _EVENT_HAVE_STRLCPY 26 | #cmakedefine _EVENT_HAVE_INET_NTOP 27 | #cmakedefine _EVENT_HAVE_SIGTIMEDWAIT 28 | #cmakedefine _EVENT_HAVE_EPOLL 29 | #cmakedefine _EVENT_HAVE_KQUEUE 30 | #cmakedefine _EVENT_HAVE_TIMERADD 31 | #cmakedefine _EVENT_HAVE_TIMERSUB 32 | #cmakedefine _EVENT_HAVE_TIMERISSET 33 | #cmakedefine _EVENT_HAVE_TIMERCLEAR 34 | 35 | #define _EVENT_VERSION "libevent-1.4.11-stable" 36 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS=chapter 2 | 3 | EXTRA_DIST = \ 4 | lua-classes.dot \ 5 | architecture.dot \ 6 | architecture-overview.dot \ 7 | architecture.txt \ 8 | core.txt \ 9 | chassis.txt \ 10 | plugins.txt \ 11 | protocol.txt \ 12 | tests.txt \ 13 | scripting.txt \ 14 | lifecycle.msc 15 | 16 | clean-local: 17 | rm -f *.html 18 | 19 | html-local: book.html protocol.html scripting.html 20 | 21 | ## we use http://docutils.sourceforge.net/rst.html to generate the docs 22 | book.html: book.txt chapter/scripting.txt chapter/protocol.txt 23 | ${RST2HTML} $< $@ 24 | 25 | protocol.html: protocol.txt chapter/protocol.txt 26 | ${RST2HTML} $< $@ 27 | 28 | scripting.html: scripting.txt chapter/scripting.txt 29 | ${RST2HTML} $< $@ 30 | 31 | -------------------------------------------------------------------------------- /doc/book.txt: -------------------------------------------------------------------------------- 1 | *********** 2 | MySQL Proxy 3 | *********** 4 | 5 | .. contents:: 6 | 7 | ============== 8 | MySQL Protocol 9 | ============== 10 | 11 | .. include:: chapter/protocol.txt 12 | 13 | ========================== 14 | Scripting the proxy plugin 15 | ========================== 16 | 17 | .. include:: chapter/scripting.txt 18 | -------------------------------------------------------------------------------- /doc/chapter/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST=\ 2 | protocol.txt \ 3 | scripting.txt 4 | 5 | -------------------------------------------------------------------------------- /doc/plugins.txt: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @page page-plugins Plugin and Scripting Layer 4 | 5 | What is usually being referred to as MySQL Proxy is in fact the @link page-plugin-proxy Proxy plugin@endlink. 6 | 7 | While the @ref page-chassis and @ref page-core make up an important part, it is really the plugins that make MySQL Proxy so flexible. 8 | 9 | One can describe the currently available plugins as connection lifecycle interceptors which can register callbacks for 10 | all states in the @ref protocol. 11 | 12 | Currently available plugins in the main distribution include: 13 | - @subpage page-plugin-proxy 14 | - @subpage page-plugin-admin 15 | - Replicator plugin 16 | - Debug plugin 17 | - CLI (command line) plugin 18 | 19 | @note The latter three are not documented in-depth, mainly because they are Proof Of Concept implementations that are not targeted 20 | for the MySQL Proxy 1.0 GA release. 21 | 22 | */ 23 | -------------------------------------------------------------------------------- /doc/protocol.txt: -------------------------------------------------------------------------------- 1 | ============== 2 | MySQL Protocol 3 | ============== 4 | 5 | .. contents:: 6 | 7 | .. include:: chapter/protocol.txt 8 | 9 | -------------------------------------------------------------------------------- /doc/scripting.txt: -------------------------------------------------------------------------------- 1 | ========================== 2 | Scripting the proxy plugin 3 | ========================== 4 | 5 | .. contents:: 6 | 7 | .. include:: chapter/scripting.txt 8 | 9 | -------------------------------------------------------------------------------- /doc/testsuite.txt: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @page test Testcase List 4 | 5 | This is an automatically generated list of all the test cases found. 6 | 7 | Currently we have no system for measuring code coverage, but we plan to use a combination of 8 | gcov and lcov 9 | in the future. 10 | 11 | In order to generate meaningful coverage numbers, especially given that what a system test suite, it is best to generate both 12 | individual coverage reports for each unit test case and combining all coverage reports into a single, global view. 13 | 14 | If all the reports are combined into a single report, it is impossible to discern which tests cover which part of the codebase and 15 | thus it becomes hard to identify the areas that need testing. System tests are likely to exercise huge parts of the code and are 16 | not useful when looking at code coverage. 17 | 18 | Due to this complexity we haven't put an automated system in place yet. 19 | 20 | @see unittests A more detailed description of the individual tests, although only manually tagged tests will show up in that list. 21 | 22 | */ -------------------------------------------------------------------------------- /doxygen-scripts/doxygen_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # $%BEGINLICENSE%$ 4 | # Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; version 2 of the 9 | # License. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19 | # 02110-1301 USA 20 | # 21 | # $%ENDLICENSE%$ 22 | 23 | bzr log --limit 1 --line $1 | sed -n 's/^\([0-9]*\):.*$/\1/p' 24 | -------------------------------------------------------------------------------- /doxygen-scripts/footer.html: -------------------------------------------------------------------------------- 1 |
2 | Generated on $datetime for $projectname version $projectnumber.
3 | 4 | 5 | -------------------------------------------------------------------------------- /doxygen-scripts/project_number_bzr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # $%BEGINLICENSE%$ 4 | # Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; version 2 of the 9 | # License. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19 | # 02110-1301 USA 20 | # 21 | # $%ENDLICENSE%$ 22 | 23 | VERSION_INFO=`bzr version-info --custom --template="{branch_nick} Revision {revno} from {date}"` 24 | echo "\"$1 - $VERSION_INFO\"" 25 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | ## automake uses 21 | ## 22 | ## docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} 23 | ## 24 | ## so do we 25 | INSTALL(FILES 26 | tutorial-basic.lua 27 | tutorial-constants.lua 28 | tutorial-inject.lua 29 | tutorial-keepalive.lua 30 | tutorial-monitor.lua 31 | tutorial-packets.lua 32 | tutorial-query-time.lua 33 | tutorial-prep-stmts.lua 34 | tutorial-resultset.lua 35 | tutorial-rewrite.lua 36 | tutorial-routing.lua 37 | tutorial-scramble.lua 38 | tutorial-states.lua 39 | tutorial-tokenize.lua 40 | tutorial-union.lua 41 | tutorial-warnings.lua 42 | 43 | DESTINATION share/doc/mysql-proxy/ 44 | ) 45 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | EXTRA_DIST= 21 | 22 | example_scripts = \ 23 | tutorial-basic.lua \ 24 | tutorial-constants.lua \ 25 | tutorial-inject.lua \ 26 | tutorial-keepalive.lua \ 27 | tutorial-monitor.lua \ 28 | tutorial-packets.lua \ 29 | tutorial-query-time.lua \ 30 | tutorial-prep-stmts.lua \ 31 | tutorial-resultset.lua \ 32 | tutorial-rewrite.lua \ 33 | tutorial-routing.lua \ 34 | tutorial-scramble.lua \ 35 | tutorial-states.lua \ 36 | tutorial-tokenize.lua \ 37 | tutorial-union.lua \ 38 | tutorial-warnings.lua 39 | 40 | if USE_WRAPPER_SCRIPT 41 | dist_doc_DATA = ${example_scripts} 42 | else 43 | EXTRA_DIST += ${example_scripts} 44 | endif 45 | 46 | EXTRA_DIST+=CMakeLists.txt 47 | -------------------------------------------------------------------------------- /examples/tutorial-basic.lua: -------------------------------------------------------------------------------- 1 | --[[ $%BEGINLICENSE%$ 2 | Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ --]] 20 | --[[ 21 | 22 | 23 | 24 | --]] 25 | 26 | --- 27 | -- read_query() gets the client query before it reaches the server 28 | -- 29 | -- @param packet the mysql-packet sent by client 30 | -- 31 | -- the packet contains a command-packet: 32 | -- * the first byte the type (e.g. proxy.COM_QUERY) 33 | -- * the argument of the command 34 | -- 35 | -- http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Command_Packet 36 | -- 37 | -- for a COM_QUERY it is the query itself in plain-text 38 | -- 39 | function read_query( packet ) 40 | if string.byte(packet) == proxy.COM_QUERY then 41 | print("we got a normal query: " .. string.sub(packet, 2)) 42 | end 43 | end 44 | 45 | -------------------------------------------------------------------------------- /examples/tutorial-constants.lua: -------------------------------------------------------------------------------- 1 | --[[ $%BEGINLICENSE%$ 2 | Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ --]] 20 | --[[ 21 | 22 | 23 | 24 | --]] 25 | 26 | -- we need at least 0.5.1 27 | assert(proxy.PROXY_VERSION >= 0x00501, "you need at least mysql-proxy 0.5.1 to run this module") 28 | 29 | --- 30 | -- read_query() gets the client query before it reaches the server 31 | -- 32 | -- @param packet the mysql-packet sent by client 33 | -- 34 | -- we have several constants defined, e.g.: 35 | -- * _VERSION 36 | -- 37 | -- * proxy.PROXY_VERSION 38 | -- * proxy.COM_* 39 | -- * proxy.MYSQL_FIELD_* 40 | -- 41 | function read_query( packet ) 42 | if packet:byte() == proxy.COM_QUERY then 43 | print("get got a Query: " .. packet:sub(2)) 44 | 45 | -- proxy.PROXY_VERSION is the proxy version as HEX number 46 | -- 0x00501 is 0.5.1 47 | print("we are: " .. string.format("%05x", proxy.PROXY_VERSION)) 48 | print("lua is: " .. _VERSION) 49 | end 50 | end 51 | 52 | -------------------------------------------------------------------------------- /examples/tutorial-tokenize.lua: -------------------------------------------------------------------------------- 1 | --[[ $%BEGINLICENSE%$ 2 | Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ --]] 20 | --[[ 21 | 22 | 23 | 24 | --]] 25 | 26 | local tokenizer = require("proxy.tokenizer") 27 | 28 | function read_query(packet) 29 | if packet:byte() == proxy.COM_QUERY then 30 | local tokens = tokenizer.tokenize(packet:sub(2)) 31 | 32 | -- just for debug 33 | for i = 1, #tokens do 34 | -- print the token and what we know about it 35 | local token = tokens[i] 36 | local txt = token["text"] 37 | if token["token_name"] == 'TK_STRING' then 38 | txt = string.format("%q", txt) 39 | end 40 | -- print(i .. ": " .. " { " .. token["token_name"] .. ", " .. token["text"] .. " }" ) 41 | print(i .. ": " .. " { " .. token["token_name"] .. ", " .. txt .. " }" ) 42 | 43 | 44 | end 45 | 46 | print("normalized query: " .. tokenizer.normalize(tokens)) 47 | print("") 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/chassis.def: -------------------------------------------------------------------------------- 1 | LIBRARY chassis.dll 2 | EXPORTS 3 | luaopen_chassis 4 | -------------------------------------------------------------------------------- /lib/commit-obfuscator.msc: -------------------------------------------------------------------------------- 1 | msc { 2 | client, proxy, server; 3 | 4 | client->proxy [ label = "COMMIT" ]; 5 | proxy->server [ label = "ROLLBACK" ]; 6 | server->proxy [ label = "OK" ]; 7 | proxy->client [ label = "ERR: deadlock" ]; 8 | } 9 | -------------------------------------------------------------------------------- /lib/glib2.def: -------------------------------------------------------------------------------- 1 | LIBRARY glib2.dll 2 | EXPORTS 3 | luaopen_glib2 4 | -------------------------------------------------------------------------------- /lib/lfs.def: -------------------------------------------------------------------------------- 1 | LIBRARY lfs.dll 2 | EXPORTS 3 | luaopen_lfs 4 | -------------------------------------------------------------------------------- /lib/lpeg.def: -------------------------------------------------------------------------------- 1 | LIBRARY lpeg.dll 2 | EXPORTS 3 | luaopen_lpeg 4 | -------------------------------------------------------------------------------- /lib/mysql.def: -------------------------------------------------------------------------------- 1 | LIBRARY mysql.dll 2 | EXPORTS 3 | luaopen_mysql_proto 4 | -------------------------------------------------------------------------------- /lib/posix.def: -------------------------------------------------------------------------------- 1 | LIBRARY posix.dll 2 | EXPORTS 3 | luaopen_posix 4 | -------------------------------------------------------------------------------- /lib/proxy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | INSTALL(FILES 21 | auto-config.lua 22 | balance.lua 23 | commands.lua 24 | parser.lua 25 | tokenizer.lua 26 | test.lua 27 | 28 | DESTINATION lib/mysql-proxy/lua/proxy/ 29 | ) 30 | -------------------------------------------------------------------------------- /lib/proxy/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | luaextdir = ${pkglibdir}/lua/ 21 | 22 | pkglib_proxydir = $(luaextdir)/proxy 23 | dist_pkglib_proxy_DATA = \ 24 | auto-config.lua \ 25 | balance.lua \ 26 | commands.lua \ 27 | parser.lua \ 28 | tokenizer.lua \ 29 | test.lua 30 | 31 | EXTRA_DIST=CMakeLists.txt 32 | -------------------------------------------------------------------------------- /lib/sql-tokenizer-keywords.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef __SQL_TOKENIZER_KEYWORDS_H__ 21 | #define __SQL_TOKENIZER_KEYWORDS_H__ 22 | 23 | int *sql_keywords_get(void); 24 | int sql_keywords_get_count(void); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /m4/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST=sed.m4 2 | -------------------------------------------------------------------------------- /mysql-chassis.pc.cmake: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | libdir=@CMAKE_INSTALL_PREFIX@/lib 4 | includedir=@CMAKE_INSTALL_PREFIX@/include 5 | 6 | Name: mysql-chassis 7 | Version: @PACKAGE_VERSION_STRING@ 8 | Description: the Chassis of the MySQL Proxy 9 | URL: http://forge.mysql.com/wiki/MySQL_Proxy 10 | Requires: glib-2.0 >= 2.16 11 | Libs: -L${libdir} -lmysql-chassis -lmysql-chassis-timing -lmysql-chassis-glibext 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /mysql-chassis.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: mysql-chassis 7 | Version: @VERSION@ 8 | Description: the Chassis of the MySQL Proxy 9 | URL: http://forge.mysql.com/wiki/MySQL_Proxy 10 | Requires: glib-2.0 >= 2.16, gthread-2.0 >= 2.16 11 | Libs: -L${libdir} -lmysql-chassis -lmysql-chassis-glibext 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /mysql-proxy.pc.cmake: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | libdir=@CMAKE_INSTALL_PREFIX@/lib 4 | pkglibdir=${libdir}/mysql-proxy 5 | lualibdir=${pkglibdir}/lua 6 | plugindir=${pkglibdir}/plugins 7 | 8 | Name: MySQL Proxy 9 | Version: @PACKAGE_VERSION_STRING@ 10 | Description: MySQL Proxy 11 | URL: http://forge.mysql.com/wiki/MySQL_Proxy 12 | Requires: glib-2.0 >= 2.16, mysql-chassis >= @PACKAGE_VERSION_STRING@ 13 | Libs: -L${libdir} -lmysql-chassis-proxy 14 | -------------------------------------------------------------------------------- /mysql-proxy.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | pkglibdir=@libdir@/mysql-proxy 5 | lualibdir=${pkglibdir}/lua 6 | plugindir=${pkglibdir}/plugins 7 | 8 | Name: MySQL Proxy 9 | Version: @VERSION@ 10 | Description: MySQL Proxy 11 | URL: http://forge.mysql.com/wiki/MySQL_Proxy 12 | Requires: glib-2.0 >= 2.16, mysql-chassis >= @VERSION@ 13 | Libs: -L${libdir} -lmysql-proxy 14 | -------------------------------------------------------------------------------- /mysql-proxy.spec.in: -------------------------------------------------------------------------------- 1 | # 2 | # Simple RPM spec file for mysql-proxy 3 | # written by Lenz Grimmer 4 | # 5 | %define prefix /usr 6 | 7 | Summary: A Proxy for the MySQL Client/Server protocol 8 | Name: mysql-proxy 9 | Version: @VERSION@ 10 | Release: 0 11 | License: GPL 12 | Group: Applications/Networking 13 | Source: %{name}-%{version}.tar.gz 14 | URL: http://forge.mysql.com/wiki/MySQL_Proxy 15 | Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root 16 | BuildRequires: mysql-devel glib2-devel libevent 17 | %if 0%{?suse_version} > 1010 18 | %define with_lua 1 19 | %endif 20 | %if 0%{?with_lua} 21 | BuildRequires: lua-devel >= 5.1 22 | %endif 23 | 24 | %description 25 | MySQL Proxy is a simple program that sits between your client and MySQL 26 | server(s) that can monitor, analyze or transform their communication. Its 27 | flexibility allows for unlimited uses; common ones include: load balancing; 28 | failover; query analysis; query filtering and modification; and many more. 29 | 30 | %prep 31 | %setup 32 | 33 | %build 34 | %configure \ 35 | %if 0%{?with_lua} 36 | --with-lua 37 | %else 38 | --without-lua 39 | %endif 40 | %{__make} 41 | 42 | %install 43 | %makeinstall 44 | # we package them later in the documentation. no reason to have them here 45 | %{__rm} -v %{buildroot}%{_datadir}/*.lua 46 | # we dont need to package the Makefile stuff 47 | %{__rm} -v examples/Makefile* 48 | 49 | %clean 50 | %{__rm} -rfv %{buildroot} 51 | 52 | %files 53 | %defattr(-,root,root) 54 | %doc AUTHORS COPYING INSTALL NEWS README README.TESTS 55 | %doc examples/ 56 | %{_bindir}/%{name} 57 | %{_datadir}/%{name}/ 58 | -------------------------------------------------------------------------------- /plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | IF(WIN32) 21 | ## make sure we only use the smallest set of 22 | ## headers on win32. Otherwise we get clashes 23 | ## between winsock2.h and winsock.h 24 | ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN) 25 | ENDIF(WIN32) 26 | ADD_SUBDIRECTORY(debug) 27 | ADD_SUBDIRECTORY(proxy) 28 | ADD_SUBDIRECTORY(admin) 29 | ADD_SUBDIRECTORY(replicant) 30 | ## needs readline 31 | # ADD_SUBDIRECTORY(cli) 32 | -------------------------------------------------------------------------------- /plugins/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | SUBDIRS=\ 21 | admin \ 22 | proxy \ 23 | replicant \ 24 | debug 25 | # the cli plugin needs readline and we don't have it on all platforms 26 | # cli 27 | 28 | EXTRA_DIST=CMakeLists.txt 29 | 30 | check-local: 31 | mkdir -p $(top_builddir)/plugins/; 32 | for plugin in $(SUBDIRS); do \ 33 | for i in `cat $(top_builddir)/plugins/$$plugin/.libs/lib$$plugin.la | grep '^dlname' | sed "s/.*=//;s/'//g"`; do \ 34 | echo $$i; \ 35 | ln -fs $(top_builddir)/plugins/$$plugin/.libs/$$i $(top_builddir)/plugins/$$i; \ 36 | done; \ 37 | done; 38 | 39 | clean-local: 40 | ## remove left-overs from the check-local hack in the plugings 41 | -------------------------------------------------------------------------------- /plugins/admin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/) 21 | INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # for config.h 22 | 23 | INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIRS}) 24 | INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIRS}) 25 | INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIRS}) 26 | INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIRS}) 27 | 28 | LINK_DIRECTORIES(${LUA_LIBRARY_DIRS}) 29 | LINK_DIRECTORIES(${GLIB_LIBRARY_DIRS}) 30 | LINK_DIRECTORIES(${LIBINTL_LIBRARY_DIRS}) 31 | 32 | SET(_plugin_name admin) 33 | ADD_LIBRARY(${_plugin_name} SHARED "${_plugin_name}-plugin.c") 34 | TARGET_LINK_LIBRARIES(${_plugin_name} mysql-chassis-proxy) 35 | CHASSIS_PLUGIN_INSTALL(${_plugin_name}) 36 | 37 | -------------------------------------------------------------------------------- /plugins/admin/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | plugindir = ${pkglibdir}/plugins 21 | 22 | plugin_LTLIBRARIES = libadmin.la 23 | libadmin_la_LDFLAGS = -export-dynamic -no-undefined -avoid-version -dynamic 24 | libadmin_la_SOURCES = admin-plugin.c 25 | libadmin_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) $(top_builddir)/src/libmysql-proxy.la 26 | libadmin_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) -I$(top_srcdir)/src/ 27 | 28 | EXTRA_DIST=CMakeLists.txt 29 | 30 | -------------------------------------------------------------------------------- /plugins/cli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/) 21 | INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # for config.h 22 | 23 | INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIRS}) 24 | INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIRS}) 25 | INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIRS}) 26 | INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIRS}) 27 | 28 | LINK_DIRECTORIES(${LUA_LIBRARY_DIRS}) 29 | LINK_DIRECTORIES(${GLIB_LIBRARY_DIRS}) 30 | 31 | SET(_plugin_name cli) 32 | ADD_LIBRARY(${_plugin_name} SHARED "${_plugin_name}-plugin.c") 33 | TARGET_LINK_LIBRARIES(${_plugin_name} mysql-chassis-proxy) 34 | CHASSIS_PLUGIN_INSTALL(${_plugin_name}) 35 | 36 | -------------------------------------------------------------------------------- /plugins/cli/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | plugindir = ${pkglibdir}/plugins 21 | 22 | plugin_LTLIBRARIES = libcli.la 23 | libcli_la_LDFLAGS = -export-dynamic -no-undefined -avoid-version -dynamic 24 | libcli_la_SOURCES = cli-plugin.c 25 | libcli_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) $(top_builddir)/src/libmysql-proxy.la -lreadline 26 | libcli_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) -I$(top_srcdir)/src/ 27 | 28 | EXTRA_DIST=CMakeLists.txt 29 | 30 | -------------------------------------------------------------------------------- /plugins/debug/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/) 21 | INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # for config.h 22 | 23 | INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIRS}) 24 | INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIRS}) 25 | INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIRS}) 26 | INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIRS}) 27 | 28 | LINK_DIRECTORIES(${LUA_LIBRARY_DIRS}) 29 | LINK_DIRECTORIES(${GLIB_LIBRARY_DIRS}) 30 | LINK_DIRECTORIES(${LIBINTL_LIBRARY_DIRS}) 31 | 32 | SET(_plugin_name debug) 33 | ADD_LIBRARY(${_plugin_name} SHARED "${_plugin_name}-plugin.c") 34 | TARGET_LINK_LIBRARIES(${_plugin_name} mysql-chassis-proxy) 35 | CHASSIS_PLUGIN_INSTALL(${_plugin_name}) 36 | 37 | -------------------------------------------------------------------------------- /plugins/debug/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | plugindir = ${pkglibdir}/plugins 21 | 22 | plugin_LTLIBRARIES = libdebug.la 23 | libdebug_la_LDFLAGS = -export-dynamic -no-undefined -avoid-version -dynamic 24 | libdebug_la_SOURCES = debug-plugin.c 25 | libdebug_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) $(top_builddir)/src/libmysql-proxy.la 26 | libdebug_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) -I$(top_srcdir)/src/ 27 | 28 | EXTRA_DIST=CMakeLists.txt 29 | 30 | -------------------------------------------------------------------------------- /plugins/proxy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/) 21 | INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # for config.h 22 | 23 | INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIRS}) 24 | INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIRS}) 25 | INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIRS}) 26 | INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIRS}) 27 | 28 | LINK_DIRECTORIES(${LUA_LIBRARY_DIRS}) 29 | LINK_DIRECTORIES(${GLIB_LIBRARY_DIRS}) 30 | LINK_DIRECTORIES(${LIBINTL_LIBRARY_DIRS}) 31 | 32 | SET(_plugin_name proxy) 33 | ADD_LIBRARY(${_plugin_name} SHARED "${_plugin_name}-plugin.c") 34 | TARGET_LINK_LIBRARIES(${_plugin_name} mysql-chassis-proxy) 35 | CHASSIS_PLUGIN_INSTALL(${_plugin_name}) 36 | 37 | -------------------------------------------------------------------------------- /plugins/proxy/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | plugindir = ${pkglibdir}/plugins 21 | 22 | plugin_LTLIBRARIES = libproxy.la 23 | libproxy_la_LDFLAGS = -export-dynamic -no-undefined -avoid-version -dynamic 24 | libproxy_la_SOURCES = proxy-plugin.c 25 | libproxy_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) $(top_builddir)/src/libmysql-proxy.la 26 | libproxy_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) -I$(top_srcdir)/src/ 27 | noinst_HEADERS = proxy-plugin.h 28 | 29 | EXTRA_DIST=CMakeLists.txt 30 | 31 | -------------------------------------------------------------------------------- /plugins/proxy/proxy-plugin.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _PROXY_PLUGIN_H 23 | #define _PROXY_PLUGIN_H 24 | 25 | 26 | #endif /* _PROXY_PLUGIN_H */ 27 | 28 | -------------------------------------------------------------------------------- /plugins/replicant/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/) 21 | INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # for config.h 22 | 23 | INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIRS}) 24 | INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIRS}) 25 | INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIRS}) 26 | INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIRS}) 27 | 28 | LINK_DIRECTORIES(${LUA_LIBRARY_DIRS}) 29 | LINK_DIRECTORIES(${GLIB_LIBRARY_DIRS}) 30 | LINK_DIRECTORIES(${LIBINTL_LIBRARY_DIRS}) 31 | 32 | SET(_plugin_name replicant) 33 | ADD_LIBRARY(${_plugin_name} SHARED "${_plugin_name}-plugin.c") 34 | TARGET_LINK_LIBRARIES(${_plugin_name} mysql-chassis-proxy) 35 | CHASSIS_PLUGIN_INSTALL(${_plugin_name}) 36 | 37 | -------------------------------------------------------------------------------- /plugins/replicant/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | plugindir = ${pkglibdir}/plugins 21 | 22 | plugin_LTLIBRARIES = libreplicant.la 23 | libreplicant_la_LDFLAGS = -export-dynamic -no-undefined -avoid-version -dynamic 24 | libreplicant_la_SOURCES = replicant-plugin.c 25 | libreplicant_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) $(top_builddir)/src/libmysql-proxy.la 26 | libreplicant_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) -I$(top_srcdir)/src/ 27 | 28 | EXTRA_DIST=CMakeLists.txt 29 | 30 | -------------------------------------------------------------------------------- /scripts/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | if USE_WRAPPER_SCRIPT 21 | ## create wrappers for all the binaries defined in src/Makefile 22 | bin_SCRIPTS = mysql-binlog-dump mysql-myisam-dump mysql-proxy 23 | 24 | CLEANFILES = $(bin_SCRIPTS) 25 | endif 26 | -------------------------------------------------------------------------------- /src/chassis-exports.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef _CHASSIS_EXPORTS_ 21 | #define _CHASSIS_EXPORTS_ 22 | 23 | #if defined(_WIN32) 24 | 25 | #if defined(mysql_chassis_EXPORTS) 26 | #define CHASSIS_API __declspec(dllexport) 27 | #elif defined(mysql_chassis_STATIC) 28 | #define CHASSIS_API 29 | #else 30 | #define CHASSIS_API extern __declspec(dllimport) 31 | #endif 32 | 33 | #else 34 | 35 | #define CHASSIS_API extern 36 | 37 | #endif 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /src/chassis-filemode.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _CHASSIS_PERM_H_ 23 | #define _CHASSIS_PERM_H_ 24 | 25 | #include 26 | #include "chassis-exports.h" 27 | 28 | #ifdef G_OS_WIN32 29 | /* not used on win32 */ 30 | #define CHASSIS_FILEMODE_SECURE_MASK (0) 31 | #else 32 | #include 33 | #define CHASSIS_FILEMODE_SECURE_MASK (S_IROTH|S_IWOTH|S_IXOTH) 34 | #endif 35 | CHASSIS_API int chassis_filemode_check(const gchar *filename) G_GNUC_DEPRECATED; /* use chassis_filemode_check_full instead */ 36 | CHASSIS_API int chassis_filemode_check_full(const gchar *filename, int required_filemask, GError **gerr); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/chassis-gtimeval.c: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | #include 22 | 23 | #include "chassis-gtimeval.h" 24 | 25 | void chassis_gtime_testset_now(GTimeVal *gt, gint64 *delay) 26 | { 27 | GTimeVal now; 28 | gint64 tdiff; 29 | 30 | if (gt == NULL) 31 | return; 32 | 33 | g_get_current_time(&now); 34 | ge_gtimeval_diff(gt, &now, &tdiff); 35 | 36 | if (tdiff < 0) { 37 | g_critical("%s: time went backwards (%"G_GINT64_FORMAT" usec)!", 38 | G_STRLOC, tdiff); 39 | gt->tv_usec = gt->tv_sec = 0; 40 | goto out; 41 | } 42 | 43 | *gt = now; 44 | out: 45 | if (delay != NULL) 46 | *delay = tdiff; 47 | return; 48 | } 49 | -------------------------------------------------------------------------------- /src/chassis-gtimeval.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | #ifndef __CHASSIS_GTIMEVAL_H__ 22 | #define __CHASSIS_GTIMEVAL_H__ 23 | 24 | #include 25 | #include "glib-ext.h" 26 | 27 | /** 28 | * stores the current time in the location passed as argument 29 | * if time is seen to move backwards, output an error message and 30 | * set the time to "0". 31 | * @param pointer to a GTimeVal struct 32 | * @param pointer to a return value, containing difference in usec 33 | * between provided timestamp and "now" 34 | */ 35 | 36 | CHASSIS_API void chassis_gtime_testset_now(GTimeVal *gt, gint64 *delay); 37 | #endif 38 | -------------------------------------------------------------------------------- /src/chassis-keyfile.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _CHASSIS_KEYFILE_H_ 23 | #define _CHASSIS_KEYFILE_H_ 24 | 25 | #include 26 | 27 | #include "chassis-exports.h" 28 | 29 | /** @addtogroup chassis */ 30 | /*@{*/ 31 | /** 32 | * parse the configfile options into option entries 33 | * 34 | */ 35 | CHASSIS_API gboolean chassis_keyfile_to_options_with_error(GKeyFile *keyfile, const gchar *groupname, GOptionEntry *config_entries, GError **gerr); 36 | CHASSIS_API int chassis_keyfile_to_options(GKeyFile *keyfile, const gchar *groupname, GOptionEntry *config_entries) G_GNUC_DEPRECATED; 37 | CHASSIS_API int chassis_keyfile_resolve_path(const char *base_dir, GOptionEntry *config_entries); 38 | 39 | /*@}*/ 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /src/chassis-limits.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _CHASSIS_LIMITS_H_ 23 | #define _CHASSIS_LIMITS_H_ 24 | 25 | #include /* GPtrArray */ 26 | 27 | #ifdef HAVE_CONFIG_H 28 | #include "config.h" 29 | #endif 30 | 31 | #include "chassis-exports.h" 32 | 33 | CHASSIS_API int chassis_set_fdlimit(int max_files_number) G_GNUC_DEPRECATED; /* use chassis_fdlimit_set() instead */ 34 | 35 | CHASSIS_API int chassis_fdlimit_set(gint64 max_files_number); 36 | CHASSIS_API gint64 chassis_fdlimit_get(void); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/chassis-path.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | #ifndef __CHASSIS_PATH_H__ 22 | #define __CHASSIS_PATH_H__ 23 | 24 | #include 25 | 26 | #include "chassis-exports.h" 27 | 28 | CHASSIS_API gboolean chassis_resolve_path(const char *base_dir, gchar **filename); 29 | CHASSIS_API gchar *chassis_get_basedir(const gchar *prgname); 30 | CHASSIS_API gboolean chassis_path_string_is_parent_of(const char *parent, gsize parent_len, const char *child, gsize child_len); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /src/chassis-unix-daemon.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | #ifndef __CHASSIS_UNIX_DAEMON_H__ 22 | #define __CHASSIS_UNIX_DAEMON_H__ 23 | 24 | int chassis_unix_proc_keepalive(int *child_exit_status); 25 | void chassis_unix_daemonize(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/glib-ext-ref.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _GLIB_EXT_REF_H_ 23 | #define _GLIB_EXT_REF_H_ 24 | 25 | #include 26 | 27 | #include "chassis-exports.h" 28 | 29 | /** 30 | * a ref-counted c-structure 31 | * 32 | */ 33 | typedef struct { 34 | gpointer udata; 35 | GDestroyNotify udata_free; 36 | 37 | gint ref_count; 38 | } GRef; 39 | 40 | CHASSIS_API GRef *g_ref_new(void); 41 | CHASSIS_API void g_ref_set(GRef *ref, gpointer udata, GDestroyNotify udata_free); 42 | CHASSIS_API void g_ref_ref(GRef *ref); 43 | CHASSIS_API void g_ref_unref(GRef *ref); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/lua-env.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef __LUA_ENV_H__ 21 | #define __LUA_ENV_H__ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "network-exports.h" 30 | 31 | NETWORK_API void lua_getfield_literal (lua_State *L, int idx, const char *k, size_t k_len); 32 | NETWORK_API void *luaL_checkself (lua_State *L); 33 | NETWORK_API int proxy_getmetatable(lua_State *L, const luaL_reg *methods); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/lua-load-factory.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _LUA_LOAD_FACTORY_ 23 | #define _LUA_LOAD_FACTORY_ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #include "config.h" 27 | #endif 28 | 29 | #ifdef HAVE_LUA_H 30 | #include 31 | 32 | int luaL_loadstring_factory(lua_State *L, const char *s); 33 | int luaL_loadfile_factory(lua_State *L, const char *filename); 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/lua-registry-keys.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _CHASSIS_LUA_REGISTRY_KEYS_H_ 23 | #define _CHASSIS_LUA_REGISTRY_KEYS_H_ 24 | 25 | #define CHASSIS_LUA_REGISTRY_KEY "chassis" 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/my_timer_cycles.il: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008 Sun Microsystems, Inc 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 15 | 16 | /* Sun Studio SPARC inline templates for cycle timer */ 17 | /* Sun Studio i386 and x86_64 inline templates for cycle timer */ 18 | /* I didn't say ".volatile" or ".nonvolatile". */ 19 | 20 | .inline my_timer_cycles_il_sparc64,0 21 | rd %tick,%o0 22 | .end 23 | 24 | .inline my_timer_cycles_il_sparc32,0 25 | rd %tick,%o2 26 | srlx %o2,32,%o0 27 | sra %o2,0,%o1 28 | .end 29 | 30 | .inline my_timer_cycles_il_i386,0 31 | rdtsc 32 | .end 33 | 34 | .inline my_timer_cycles_il_x86_64,0 35 | rdtsc 36 | shlq $32,%rdx 37 | orq %rdx,%rax 38 | .end 39 | -------------------------------------------------------------------------------- /src/mysql-proxy.mc: -------------------------------------------------------------------------------- 1 | ; // The Windows message text file for supporting ReportEvent 2 | 3 | ; // For now, we only have english messages 4 | 5 | LanguageNames=(English=0x409:MSG00409) 6 | 7 | ; // Since the mapping from our log levels to those supported by Windows is incomplete, 8 | ; // we define one message for each of the three relevant Windows levels and indicate 9 | ; // our log level in the message 10 | ; // see log_lvl_map in chassis-log.c for the mapping 11 | 12 | ; // We currently spam the Application log, as we don't set the necessary registry keys yet. 13 | 14 | MessageId=0x1 15 | Severity=Error 16 | Facility=Application 17 | Language=English 18 | %1 19 | 20 | MessageId=0x2 21 | Severity=Warning 22 | Facility=Application 23 | Language=English 24 | %1 25 | 26 | MessageId=0x4 27 | Severity=Informational 28 | Facility=Application 29 | Language=English 30 | %1 31 | -------------------------------------------------------------------------------- /src/network-address-lua.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef __NETWORK_ADDRESS_LUA_H__ 21 | #define __NETWORK_ADDRESS_LUA_H__ 22 | 23 | #include 24 | 25 | #include "network-exports.h" 26 | 27 | NETWORK_API int network_address_lua_getmetatable(lua_State *L); 28 | NETWORK_API int network_address_lua_push(lua_State *L, network_address *addr); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/network-backend-lua.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef __NETWORK_BACKEND_LUA_H__ 21 | #define __NETWORK_BACKEND_LUA_H__ 22 | 23 | #include 24 | 25 | #include "network-exports.h" 26 | 27 | NETWORK_API int network_backend_lua_getmetatable(lua_State *L); 28 | NETWORK_API int network_backends_lua_getmetatable(lua_State *L); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/network-conn-pool-lua.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef __NETWORK_CONN_POOL_LUA_H__ 21 | #define __NETWORK_CONN_POOL_LUA_H__ 22 | 23 | #include 24 | 25 | #include "network-socket.h" 26 | #include "network-mysqld.h" 27 | 28 | #include "network-exports.h" 29 | 30 | NETWORK_API int network_connection_pool_getmetatable(lua_State *L); 31 | 32 | NETWORK_API int network_connection_pool_lua_add_connection(network_mysqld_con *con); 33 | NETWORK_API network_socket *network_connection_pool_lua_swap(network_mysqld_con *con, int backend_ndx); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/network-debug.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef __NETWORK_DEBUG_H__ 21 | #define __NETWORK_DEBUG_H__ 22 | 23 | /** 24 | * if NETWORK_DEBUG_TRACE_IO is defined, the network layer will log the 25 | * raw MySQL packets as log-level "debug" 26 | * 27 | * #define NETWORK_DEBUG_TRACE_IO 1 28 | */ 29 | 30 | /** 31 | * if NETWORK_DEBUG_TRACE_STATE_CHANGES is defined the state engine for 32 | * the mysql protocol will log all state changes 33 | * 34 | * #define NETWORK_DEBUG_TRACE_STATE_CHANGES 1 35 | */ 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/network-exports.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef _NETWORK_EXPORTS_H_ 21 | #define _NETWORK_EXPORTS_H_ 22 | 23 | #if defined(_WIN32) 24 | 25 | #if defined(mysql_chassis_proxy_EXPORTS) 26 | #define NETWORK_API __declspec(dllexport) 27 | #elif defined(mysql_chassis_proxy_STATIC) /* In test cases, define this to prevent linker warnings on Win32 */ 28 | #define NETWORK_API 29 | #else 30 | #define NETWORK_API extern __declspec(dllimport) 31 | #endif 32 | 33 | #else 34 | 35 | #define NETWORK_API extern 36 | 37 | #endif 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /src/network-injection-lua.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _QUERY_HANDLING_LUA_H_ 23 | #define _QUERY_HANDLING_LUA_H_ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #include "config.h" 27 | #endif 28 | 29 | /** 30 | * embedded lua support 31 | */ 32 | #include 33 | #include 34 | #include 35 | 36 | #include "network-exports.h" 37 | #include "network-injection.h" 38 | 39 | NETWORK_API void proxy_getqueuemetatable(lua_State *L); 40 | NETWORK_API void proxy_getinjectionmetatable(lua_State *L); 41 | 42 | #endif /* _QUERY_HANDLING_H_ */ 43 | -------------------------------------------------------------------------------- /src/network-mysqld-table.c: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #include 23 | 24 | #include "network-mysqld.h" 25 | 26 | network_mysqld_table *network_mysqld_table_init(void) { 27 | network_mysqld_table *t; 28 | 29 | t = g_new0(network_mysqld_table, 1); 30 | 31 | return t; 32 | } 33 | 34 | void network_mysqld_table_free(network_mysqld_table *t) { 35 | if (!t) return; 36 | 37 | g_free(t); 38 | } 39 | -------------------------------------------------------------------------------- /src/network-packet.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef __NETWORK_PACKET_H__ 21 | #define __NETWORK_PACKET_H__ 22 | 23 | #include "network-exports.h" 24 | 25 | typedef struct { 26 | GString *data; 27 | 28 | guint offset; 29 | } network_packet; 30 | 31 | /** 32 | * create a new network packet 33 | */ 34 | NETWORK_API network_packet * 35 | network_packet_new(void); 36 | 37 | NETWORK_API void 38 | network_packet_free(network_packet *packet); 39 | 40 | NETWORK_API gboolean 41 | network_packet_has_more_data(network_packet *packet, gsize len); 42 | 43 | NETWORK_API gboolean 44 | network_packet_skip(network_packet *packet, gsize len); 45 | 46 | NETWORK_API gboolean 47 | network_packet_peek_data(network_packet *packet, gpointer dst, gsize len); 48 | 49 | NETWORK_API gboolean 50 | network_packet_get_data(network_packet *packet, gpointer dst, gsize len); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/network-queue.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _NETWORK_QUEUE_H_ 23 | #define _NETWORK_QUEUE_H_ 24 | 25 | #include "network-exports.h" 26 | 27 | #include 28 | 29 | /* a input or output stream */ 30 | typedef struct { 31 | GQueue *chunks; 32 | 33 | size_t len; /* len in all chunks (w/o the offset) */ 34 | size_t offset; /* offset in the first chunk */ 35 | } network_queue; 36 | 37 | NETWORK_API network_queue *network_queue_init(void) G_GNUC_DEPRECATED; 38 | NETWORK_API network_queue *network_queue_new(void); 39 | NETWORK_API void network_queue_free(network_queue *queue); 40 | NETWORK_API int network_queue_append(network_queue *queue, GString *chunk); 41 | NETWORK_API GString *network_queue_pop_string(network_queue *queue, gsize steal_len, GString *dest); 42 | NETWORK_API GString *network_queue_peek_string(network_queue *queue, gsize peek_len, GString *dest); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/network-socket-lua.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef __NETWORK_SOCKET_LUA_H__ 21 | #define __NETWORK_SOCKET_LUA_H__ 22 | 23 | #include 24 | 25 | #include "network-exports.h" 26 | 27 | NETWORK_API int network_socket_lua_getmetatable(lua_State *L); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/network_mysqld_proto_binary.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | #ifndef __NETWORK_MYSQLD_PROTO_BINARY_H__ 21 | #define __NETWORK_MYSQLD_PROTO_BINARY_H__ 22 | 23 | #include 24 | 25 | #include "network-socket.h" 26 | #include "network_mysqld_type.h" 27 | 28 | #include "network-exports.h" 29 | 30 | NETWORK_API int network_mysqld_proto_binary_get_type(network_packet *packet, network_mysqld_type_t *type); 31 | NETWORK_API int network_mysqld_proto_binary_append_type(GString *packet, network_mysqld_type_t *type); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/proxy-dtrace-provider.d: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | provider mysqlproxy { 22 | /** 23 | * fires when the internal chassis state machine arrives at a new state. 24 | * @param event_fd File descriptor this event fired on 25 | * @param events Flags which events happened (from libevent) 26 | * @param state Connection state, enum state from network-mysqld.h 27 | */ 28 | probe state__change(int, short, int); 29 | }; 30 | -------------------------------------------------------------------------------- /src/string-len.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _GLIB_EXT_STRING_LEN_H_ 23 | #define _GLIB_EXT_STRING_LEN_H_ 24 | 25 | /** 26 | * simple macros to get the data and length of a "string" 27 | * 28 | * C() is for constant strings like "foo" 29 | * S() is for GString's 30 | */ 31 | #define C(x) x, x ? sizeof(x) - 1 : 0 32 | #define S(x) (x) ? (x)->str : NULL, (x) ? (x)->len : 0 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/sys-pedantic.h: -------------------------------------------------------------------------------- 1 | /* $%BEGINLICENSE%$ 2 | Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; version 2 of the 7 | License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | 02110-1301 USA 18 | 19 | $%ENDLICENSE%$ */ 20 | 21 | 22 | #ifndef _SYS_PEDANTIC_H_ 23 | #define _SYS_PEDANTIC_H_ 24 | 25 | /** @file 26 | * a set of macros to make programming C easier 27 | */ 28 | 29 | #ifdef UNUSED_PARAM 30 | #elif defined(__GNUC__) 31 | # define UNUSED_PARAM(x) UNUSED_ ## x __attribute__((unused)) 32 | #elif defined(__LCLINT__) 33 | # define UNUSED_PARAM(x) /*@unused@*/ x 34 | #else 35 | # define UNUSED_PARAM(x) x 36 | #endif 37 | 38 | #define F_SIZE_T "%"G_GSIZE_FORMAT 39 | #define F_U64 "%"G_GUINT64_FORMAT 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | ADD_SUBDIRECTORY(unit) 21 | ADD_SUBDIRECTORY(suite) 22 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | SUBDIRS = unit suite 21 | 22 | EXTRA_DIST = CMakeLists.txt gtester-to-junit.xslt 23 | 24 | noinst_PROGRAMS = c-api-burst 25 | 26 | c_api_burst_SOURCES = c-api-burst.c 27 | c_api_burst_LDFLAGS = ${MYSQL_LIBS} ${GTHREAD_LIBS} 28 | c_api_burst_CPPFLAGS = ${MYSQL_CFLAGS} ${GTHREAD_CFLAGS} 29 | -------------------------------------------------------------------------------- /tests/suite/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | ## only run the tests if we have lua somewhere 21 | # 22 | # for now this is unix specific as we use env-vars and shell-scripts 23 | IF(LUA_EXECUTABLE AND UNIX ) 24 | CONFIGURE_FILE( 25 | ${CMAKE_CURRENT_SOURCE_DIR}/lua-tests-wrapper.sh.in 26 | ${CMAKE_CURRENT_BINARY_DIR}/lua-tests-wrapper.sh 27 | @ONLY) 28 | ADD_TEST(lua-tests/base 29 | sh -x ${CMAKE_CURRENT_BINARY_DIR}/lua-tests-wrapper.sh 30 | ${LUA_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/run-tests.lua ${CMAKE_CURRENT_SOURCE_DIR}/base) 31 | ENDIF(LUA_EXECUTABLE AND UNIX ) 32 | -------------------------------------------------------------------------------- /tests/suite/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | SUBDIRS=base bugs 21 | 22 | TESTS_ENVIRONMENT = \ 23 | MYSQL_TEST_BIN="${MYSQL_TEST_BIN}" \ 24 | LUA_USER_PATH="${top_srcdir}/lib/?.lua" \ 25 | LUA_CPATH=".libs/?.@DYNLIB_LUA_SUFFIX@;${top_builddir}/lib/.libs/?.@DYNLIB_LUA_SUFFIX@" \ 26 | @DYNLIB_PATH_VAR@="${top_builddir}/src/.libs/:${@DYNLIB_PATH_VAR@}" \ 27 | MYSQL_PROXY_VERSION="${PACKAGE_VERSION}" \ 28 | top_builddir=${top_builddir} \ 29 | builddir=${builddir} \ 30 | srcdir=${srcdir}/ \ 31 | BUILD_OS=${build} \ 32 | ${builddir}/lua-runner ${srcdir}/run-tests.lua 33 | 34 | TESTS=base 35 | 36 | check_PROGRAMS=lua-runner 37 | 38 | lua_runner_SOURCES=lua_runner.c 39 | lua_runner_LDFLAGS=${LUA_LDFLAGS} 40 | lua_runner_LDADD=${LUA_LIBS} 41 | lua_runner_CFLAGS=${LUA_CFLAGS} 42 | 43 | 44 | EXTRA_DIST=\ 45 | run-tests.lua \ 46 | lua-tests-wrapper.sh.in \ 47 | CMakeLists.txt 48 | 49 | clean-local: 50 | -rm `find . -type f -name "*.log"` 51 | -------------------------------------------------------------------------------- /tests/suite/base/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | SUBDIRS=t r 21 | EXTRA_DIST = \ 22 | tests_to_skip.lua 23 | -------------------------------------------------------------------------------- /tests/suite/base/r/Makefile.am: -------------------------------------------------------------------------------- 1 | # $%BEGINLICENSE%$ 2 | # Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; version 2 of the 7 | # License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 17 | # 02110-1301 USA 18 | # 19 | # $%ENDLICENSE%$ 20 | EXTRA_DIST = \ 21 | bug_30867.result \ 22 | bug_35669.result \ 23 | bug_35729.result \ 24 | bug_45167.result \ 25 | bug_41991.result \ 26 | bug_46141.result \ 27 | bug_43078.result \ 28 | bug_49248.result \ 29 | bug_55459.result \ 30 | bug_61998.result \ 31 | change_user.result \ 32 | client_address.result \ 33 | chain1.result \ 34 | constants.result \ 35 | error_struct.result \ 36 | failover.result \ 37 | lineno.result \ 38 | ignore-resultset.result \ 39 | load_multi.result \ 40 | load-data-infile.result \ 41 | mysql-40.result \ 42 | no_backend.result \ 43 | overlong.result \ 44 | pooling.result \ 45 | raw_packets.result \ 46 | resultset.result \ 47 | select_affected_rows.result \ 48 | select_null.result \ 49 | tokens1.result \ 50 | tokens2.result \ 51 | tokens-normalize.result \ 52 | xtab1.result \ 53 | xtab2.result 54 | 55 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_30867.result: -------------------------------------------------------------------------------- 1 | select count(*) from test.t1; 2 | count(*) 3 | 0 4 | insert into test.t1 values (1); 5 | drop table test.t1; 6 | drop user user1@localhost; 7 | drop user user2@localhost; 8 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_35669.result: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | ERROR 07000: (bug_35669-mock) >SELECT 1< 3 | ERROR HY000: #07000MySQL Proxy Lua script failed to load. Check the error log. 4 | ERROR HY000: #07000MySQL Proxy Lua script failed to load. Check the error log. 5 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_35729.result: -------------------------------------------------------------------------------- 1 | SELECT key, value; 2 | Name Value 3 | 1 1 4 | 2 2 5 | 3 3 6 | 4 4 7 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_41991.result: -------------------------------------------------------------------------------- 1 | REFRESH; 2 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_43078.result: -------------------------------------------------------------------------------- 1 | SELECT 249 fields; 2 | fields 3 | 249 4 | SELECT 250 fields; 5 | fields 6 | 250 7 | SELECT 251 fields; 8 | fields 9 | 251 10 | SELECT 252 fields; 11 | fields 12 | 252 13 | SELECT 253 fields; 14 | fields 15 | 253 16 | SELECT 254 fields; 17 | fields 18 | 254 19 | SELECT 255 fields; 20 | fields 21 | 255 22 | SELECT 256 fields; 23 | fields 24 | 256 25 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_45167.result: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | Name Value 3 | 1 1 4 | 2 2 5 | 3 3 6 | 4 4 7 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_46141.result: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | 1 3 | 2 4 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_49248.result: -------------------------------------------------------------------------------- 1 | trigger_bug; 2 | ERROR 42S22: Unknown column 'x' in 'field list' 3 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_55459.result: -------------------------------------------------------------------------------- 1 | SELECT x; 2 | ERROR 42S22: Unknown column 'x' in 'field list' 3 | -------------------------------------------------------------------------------- /tests/suite/base/r/bug_61998.result: -------------------------------------------------------------------------------- 1 | USE test; 2 | DROP PROCEDURE IF EXISTS myproc_no_res; 3 | CREATE PROCEDURE myproc_no_res() 4 | BEGIN 5 | END// 6 | CALL myproc_no_res(); 7 | SELECT "myproc_no_res done" AS status; 8 | status 9 | myproc_no_res done 10 | DROP PROCEDURE IF EXISTS myproc_res; 11 | CREATE PROCEDURE myproc_res() 12 | BEGIN 13 | SELECT 1; 14 | END// 15 | CALL myproc_res(); 16 | 1 17 | 1 18 | SELECT "myproc_res done" AS status; 19 | status 20 | myproc_res done 21 | DROP PROCEDURE IF EXISTS myproc_sp; 22 | CREATE PROCEDURE myproc_sp(OUT v INT) 23 | BEGIN 24 | DECLARE cur CURSOR FOR SELECT 1; 25 | OPEN cur; 26 | FETCH cur INTO v; 27 | CLOSE cur; 28 | END// 29 | CALL myproc_sp(@v); 30 | SELECT @v; 31 | @v 32 | 1 33 | SELECT "myproc_sp done" AS status; 34 | status 35 | myproc_sp done 36 | DROP PROCEDURE IF EXISTS myproc_res_sp; 37 | CREATE PROCEDURE myproc_res_sp() 38 | BEGIN 39 | DECLARE cur CURSOR FOR SELECT 1; 40 | OPEN cur; 41 | SELECT 1; 42 | END// 43 | CALL myproc_res_sp(); 44 | 1 45 | 1 46 | SELECT "myproc_res_sp done" AS status; 47 | status 48 | myproc_res_sp done 49 | -------------------------------------------------------------------------------- /tests/suite/base/r/chain1.result: -------------------------------------------------------------------------------- 1 | # this should return "1 ADDITION SECOND ADDITION" 2 | SELECT 1; 3 | 1 ADDITION SECOND ADDITION 4 | 1 ADDITION SECOND ADDITION 5 | -------------------------------------------------------------------------------- /tests/suite/base/r/change_user.result: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | user 3 | _mysql 4 | -------------------------------------------------------------------------------- /tests/suite/base/r/client_address.result: -------------------------------------------------------------------------------- 1 | value 2 | NULL 3 | value 4 | NULL 5 | value 6 | NULL 7 | value 8 | NULL 9 | value 10 | NULL 11 | value 12 | NULL 13 | value 14 | NULL 15 | value 16 | NULL 17 | value 18 | NULL 19 | value 20 | NULL 21 | value 22 | NULL 23 | value 24 | NULL 25 | value 26 | NULL 27 | value 28 | NULL 29 | value 30 | NULL 31 | value 32 | NULL 33 | -------------------------------------------------------------------------------- /tests/suite/base/r/client_address_socket.result: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | client 3 | not-nil 4 | -------------------------------------------------------------------------------- /tests/suite/base/r/constants.result: -------------------------------------------------------------------------------- 1 | do constants work ?; 2 | Result 3 | passed 4 | -------------------------------------------------------------------------------- /tests/suite/base/r/error_struct.result: -------------------------------------------------------------------------------- 1 | select error 3306 xyz12 "My first fake error message"; 2 | ERROR xyz12: my first fake error message 3 | select error 2222 123ab "My second fake error message"; 4 | ERROR 123ab: my second fake error message 5 | select error 0000 xxxxx ""; 6 | ERROR xxxxx: 7 | select error 1111 54321 "fake message with numeric SQL state"; 8 | ERROR 54321: fake message with numeric sql state 9 | -------------------------------------------------------------------------------- /tests/suite/base/r/failover.result: -------------------------------------------------------------------------------- 1 | SET ID 1; 2 | id 3 | 1 4 | GET ID; 5 | id 6 | 1 7 | SET ID 2; 8 | id 9 | 2 10 | GET ID; 11 | id 12 | 2 13 | GET ID; 14 | id 15 | 1 16 | KILL BACKEND; 17 | ERROR HY000: Lost connection to MySQL server during query 18 | GET ID; 19 | ERROR HY000: MySQL server has gone away 20 | GET ID; 21 | id 22 | 2 23 | GET ID; 24 | id 25 | 2 26 | -------------------------------------------------------------------------------- /tests/suite/base/r/ignore-resultset.result: -------------------------------------------------------------------------------- 1 | ignore_and_default; 2 | 1 3 | 1 4 | ignore_and_replace; 5 | 1 6 | 2 7 | -------------------------------------------------------------------------------- /tests/suite/base/r/invalid_response_packets.result: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysql/mysql-proxy/ca6ad61af9088147a568a079c44d0d322f5bee59/tests/suite/base/r/invalid_response_packets.result -------------------------------------------------------------------------------- /tests/suite/base/r/lineno.result: -------------------------------------------------------------------------------- 1 | SELECT backtrace; 2 | backtrace 3 | stack traceback: 4 | [string "/tmp/dummy.lua"]:48: in function <[string "/tmp/dummy.lua"]:32> 5 | -------------------------------------------------------------------------------- /tests/suite/base/r/load-data-infile.result: -------------------------------------------------------------------------------- 1 | load data local infile 'testfile' into table foo.bar; 2 | load data local infile 'testfile' into table foo.bar; 3 | SELECT 1; 4 | 1 5 | 1 6 | -------------------------------------------------------------------------------- /tests/suite/base/r/load_multi.result: -------------------------------------------------------------------------------- 1 | info 2 | module "/base/t/lm2.lua" loaded 3 | select pload status; 4 | function hits 5 | read_query2 1 6 | info 7 | module "/base/t/lm1.lua" loaded 8 | select 'first' as info; 9 | info 10 | first 11 | select pload status; 12 | function hits 13 | read_query2 3 14 | select 'second' as info; 15 | info 16 | second 17 | select pload status; 18 | function hits 19 | read_auth1 1 20 | read_auth_result1 1 21 | read_handshake1 1 22 | read_query2 5 23 | connect_server1 1 24 | select sleep(0.2); 25 | sleep(0.2) 26 | 0 27 | select 'third' as info; 28 | info 29 | third 30 | select pload status; 31 | function hits 32 | disconnect_client1 1 33 | read_auth1 2 34 | read_auth_result1 2 35 | read_handshake1 2 36 | read_query2 8 37 | connect_server1 2 38 | info 39 | module "/base/t/lm3.lua" loaded 40 | select 1000; 41 | result 42 | one thousand 43 | /base/t/lm3.lua 44 | unloaded 45 | select 1000; 46 | 1000 47 | 1000 48 | -------------------------------------------------------------------------------- /tests/suite/base/r/mysql-40.result: -------------------------------------------------------------------------------- 1 | SELECT thread_id(); 2 | thread_id 3 | 0 4 | Got one of the listed errors 5 | -------------------------------------------------------------------------------- /tests/suite/base/r/no_backend.result: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | 1 3 | 1 4 | -------------------------------------------------------------------------------- /tests/suite/base/r/overlong.result: -------------------------------------------------------------------------------- 1 | SELECT 16777233; 2 | length 3 | 16777233 4 | SELECT 21; 5 | length 6 | 21 7 | SELECT 16777233; 8 | length 9 | 16777233 10 | SELECT 16777233; 11 | length 12 | 16777233 13 | SELECT PASSED; 14 | length 15 | PASSED 16 | SELECT PASSED; 17 | length 18 | PASSED 19 | -------------------------------------------------------------------------------- /tests/suite/base/r/pooling.result: -------------------------------------------------------------------------------- 1 | SELECT counter; 2 | conn_id stmt_id 3 | 2 1 4 | SELECT counter; 5 | conn_id stmt_id 6 | 1 1 7 | SELECT counter; 8 | conn_id stmt_id 9 | 1 2 10 | SELECT counter; 11 | conn_id stmt_id 12 | 2 2 13 | SELECT counter; 14 | conn_id stmt_id 15 | 5 1 16 | -------------------------------------------------------------------------------- /tests/suite/base/r/raw_packets.result: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | 1 3 | 1 4 | SELECT errmsg empty; 5 | ERROR 07000: (lua) proxy.response.errmsg is nil 6 | SELECT invalid type; 7 | ERROR 07000: (lua) handling proxy.response failed, check error-log 8 | SELECT errmsg; 9 | ERROR 07000: I'm a error 10 | SELECT errcode; 11 | ERROR 07000: I'm a error 12 | -------------------------------------------------------------------------------- /tests/suite/base/r/resultset.result: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | 1 3 | 1 4 | SELECT ; 5 | ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 6 | test_res_blob; 7 | 300x 8 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 9 | INSERT INTO test.t1 VALUES ( 1 ); 10 | affected_rows insert_id 11 | 2 10 12 | SELECT error_msg(); 13 | errcode errmsg sqlstate 14 | 1064 returning SQL-state 42000 and error-code 1064 42000 15 | SELECT row_count(1), bytes(); 16 | row_count bytes 17 | 2 16 18 | SELECT 5.0; 19 | row_count bytes 20 | 1 6 21 | SELECT 4.1; 22 | row_count bytes 23 | 1 6 24 | SELECT "1", NULL, "1"; 25 | test_result 26 | 1,nil,1 27 | SELECT NULL; 28 | row_count bytes 29 | 1 5 30 | -------------------------------------------------------------------------------- /tests/suite/base/r/select_affected_rows.result: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | 1 3 | 1 4 | SELECT affected_rows; 5 | rows 6 | NULL 7 | SET @a = 1; 8 | SELECT affected_rows; 9 | rows 10 | 0 11 | -------------------------------------------------------------------------------- /tests/suite/base/r/select_null.result: -------------------------------------------------------------------------------- 1 | SELECT NULL; 2 | NULL 3 | NULL 4 | -------------------------------------------------------------------------------- /tests/suite/base/r/tokens-normalize.result: -------------------------------------------------------------------------------- 1 | select 1; 2 | text 3 | 7 | create table t1 (id int) engine = myisam; 8 | text 9 | 10 | /* comment */select /*! 1 */; 11 | text 12 | 16 | SELECT @i := 1; 17 | text 18 |