summaryrefslogtreecommitdiff
path: root/mysql-client/mysql
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-client/mysql')
-rw-r--r--mysql-client/mysql/.gitattributes2
-rw-r--r--mysql-client/mysql/.gitignore1
-rw-r--r--mysql-client/mysql/buildfile92
l---------mysql-client/mysql/client/client_priv.h1
l---------mysql-client/mysql/client/completion_hash.cc1
l---------mysql-client/mysql/client/completion_hash.h1
l---------mysql-client/mysql/client/my_readline.h1
l---------mysql-client/mysql/client/mysql.cc1
l---------mysql-client/mysql/client/pattern_matcher.cc1
l---------mysql-client/mysql/client/pattern_matcher.h1
l---------mysql-client/mysql/client/readline.cc1
-rw-r--r--mysql-client/mysql/config.h11
-rw-r--r--mysql-client/mysql/downstream/mysql_version.h5
-rw-r--r--mysql-client/mysql/downstream/readline.c87
-rw-r--r--mysql-client/mysql/downstream/readline.h59
l---------mysql-client/mysql/include1
l---------mysql-client/mysql/libbinlogevents1
l---------mysql-client/mysql/my_config.h1
l---------mysql-client/mysql/mysqld_error.h1
19 files changed, 269 insertions, 0 deletions
diff --git a/mysql-client/mysql/.gitattributes b/mysql-client/mysql/.gitattributes
new file mode 100644
index 0000000..d84f83a
--- /dev/null
+++ b/mysql-client/mysql/.gitattributes
@@ -0,0 +1,2 @@
+include symlink=dir
+libbinlogevents symlink=dir
diff --git a/mysql-client/mysql/.gitignore b/mysql-client/mysql/.gitignore
new file mode 100644
index 0000000..0416ee9
--- /dev/null
+++ b/mysql-client/mysql/.gitignore
@@ -0,0 +1 @@
+/mysql
diff --git a/mysql-client/mysql/buildfile b/mysql-client/mysql/buildfile
new file mode 100644
index 0000000..654758d
--- /dev/null
+++ b/mysql-client/mysql/buildfile
@@ -0,0 +1,92 @@
+# file : mysql/buildfile
+# license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file
+
+tclass = $c.target.class
+
+windows = ($tclass == 'windows')
+
+# Note that the mysql utility source code directly refers to the
+# libmysqlclient's implementations details quite a lot. Thus, we just use the
+# libmysqlclient static library in combination with the private headers. Also
+# note that the upstream's mysql utility doesn't link the shared
+# libmysqlclient either.
+#
+import libs = libmysqlclient%liba{mysqlclient}
+
+# Note that the mysql utility doesn't use openssl directly. We however import
+# libcrypto so that the included by some common headers <openssl/opensslv.h>
+# can be found.
+#
+import libs += libcrypto%lib{crypto}
+
+if! $windows
+ import libs += libisocline%liba{isocline}
+
+# Note that some of the include/**.h files are C++ headers and some are C
+# headers. We will assume all of them as C headers, which is a bit of a hack
+# but doing it properly is too painful.
+#
+exe{mysql}: {h c }{* } \
+ client/{ hxx cxx}{* } \
+ downstream/{h c }{* -readline} \
+ include/{h }{** } \
+libbinlogevents/{h }{** }
+
+exe{mysql}: downstream/{h c}{readline}: include = (!$windows)
+
+exe{mysql}: $libs
+
+# Build options.
+#
+# We have dropped the macro definitions that are not used in the package code:
+#
+# -DRAPIDJSON_NO_SIZETYPEDEFINE
+# -DUNISTR_FROM_CHAR_EXPLICIT=explicit
+# -DUNISTR_FROM_STRING_EXPLICIT=explicit
+# -DHAVE_LIBEVENT2
+# -DNO_FSEEKO
+#
+cc.poptions += -DHAVE_CONFIG_H \
+ -DHAVE_OPENSSL \
+ -D__STDC_LIMIT_MACROS \
+ -D__STDC_FORMAT_MACROS \
+ -D_USE_MATH_DEFINES \
+ -DDBUG_OFF
+
+switch $tclass
+{
+ case 'windows'
+ cc.poptions += -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -DNOGDI \
+ -DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_MBCS
+
+ case 'linux'
+ cc.poptions += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+
+ default
+ cc.poptions += -D_FILE_OFFSET_BITS=64
+}
+
+# Note that we add "-I$src_root" for the headers auto-generating machinery to
+# work properly.
+#
+cc.poptions =+ "-I$out_root" "-I$src_root" \
+ "-I$src_base/downstream" \
+ "-I$src_base/include" \
+ "-I$src_base/libbinlogevents/export" \
+ "-I$src_base"
+
+switch $c.class
+{
+ case 'gcc'
+ {
+ cc.coptions += -ffunction-sections -fdata-sections -fno-omit-frame-pointer
+ }
+ case 'msvc'
+ {
+ cc.coptions += /GS /fp:precise /Zc:wchar_t /Zc:forScope
+
+ # Disable warnings that pop up with /W3.
+ #
+ cc.coptions += /wd4996
+ }
+}
diff --git a/mysql-client/mysql/client/client_priv.h b/mysql-client/mysql/client/client_priv.h
new file mode 120000
index 0000000..3fbd2c6
--- /dev/null
+++ b/mysql-client/mysql/client/client_priv.h
@@ -0,0 +1 @@
+../../../upstream/client/client_priv.h \ No newline at end of file
diff --git a/mysql-client/mysql/client/completion_hash.cc b/mysql-client/mysql/client/completion_hash.cc
new file mode 120000
index 0000000..908a80f
--- /dev/null
+++ b/mysql-client/mysql/client/completion_hash.cc
@@ -0,0 +1 @@
+../../../upstream/client/completion_hash.cc \ No newline at end of file
diff --git a/mysql-client/mysql/client/completion_hash.h b/mysql-client/mysql/client/completion_hash.h
new file mode 120000
index 0000000..bb56925
--- /dev/null
+++ b/mysql-client/mysql/client/completion_hash.h
@@ -0,0 +1 @@
+../../../upstream/client/completion_hash.h \ No newline at end of file
diff --git a/mysql-client/mysql/client/my_readline.h b/mysql-client/mysql/client/my_readline.h
new file mode 120000
index 0000000..7056e16
--- /dev/null
+++ b/mysql-client/mysql/client/my_readline.h
@@ -0,0 +1 @@
+../../../upstream/client/my_readline.h \ No newline at end of file
diff --git a/mysql-client/mysql/client/mysql.cc b/mysql-client/mysql/client/mysql.cc
new file mode 120000
index 0000000..89983e9
--- /dev/null
+++ b/mysql-client/mysql/client/mysql.cc
@@ -0,0 +1 @@
+../../../upstream/client/mysql.cc \ No newline at end of file
diff --git a/mysql-client/mysql/client/pattern_matcher.cc b/mysql-client/mysql/client/pattern_matcher.cc
new file mode 120000
index 0000000..1b84867
--- /dev/null
+++ b/mysql-client/mysql/client/pattern_matcher.cc
@@ -0,0 +1 @@
+../../../upstream/client/pattern_matcher.cc \ No newline at end of file
diff --git a/mysql-client/mysql/client/pattern_matcher.h b/mysql-client/mysql/client/pattern_matcher.h
new file mode 120000
index 0000000..770da27
--- /dev/null
+++ b/mysql-client/mysql/client/pattern_matcher.h
@@ -0,0 +1 @@
+../../../upstream/client/pattern_matcher.h \ No newline at end of file
diff --git a/mysql-client/mysql/client/readline.cc b/mysql-client/mysql/client/readline.cc
new file mode 120000
index 0000000..d41de28
--- /dev/null
+++ b/mysql-client/mysql/client/readline.cc
@@ -0,0 +1 @@
+../../../upstream/client/readline.cc \ No newline at end of file
diff --git a/mysql-client/mysql/config.h b/mysql-client/mysql/config.h
new file mode 100644
index 0000000..0e71bcf
--- /dev/null
+++ b/mysql-client/mysql/config.h
@@ -0,0 +1,11 @@
+/*
+ * file : mysql/config.h
+ * license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file
+ */
+
+/* This file is included by my_config.h, which is symlinked from the
+ * libmysqlclient's source tree. In contrast to libmysqlclient, which
+ * generates this file based on the upstream's template, we can keep it empty
+ * since the mysql utility's source code don't use any configuration macros
+ * besides those defined in my_config.h.
+ */
diff --git a/mysql-client/mysql/downstream/mysql_version.h b/mysql-client/mysql/downstream/mysql_version.h
new file mode 100644
index 0000000..fd4471b
--- /dev/null
+++ b/mysql-client/mysql/downstream/mysql_version.h
@@ -0,0 +1,5 @@
+/* file : mysql/downstream/mysql_version.h
+ * license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file
+ */
+
+#include <mysql/mysql_version.h>
diff --git a/mysql-client/mysql/downstream/readline.c b/mysql-client/mysql/downstream/readline.c
new file mode 100644
index 0000000..7522be5
--- /dev/null
+++ b/mysql-client/mysql/downstream/readline.c
@@ -0,0 +1,87 @@
+/* file : mysql/downstream/readline.h
+ * license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file
+ */
+
+#include <downstream/readline.h>
+
+#include <isocline.h>
+
+char* rl_readline_name = NULL;
+rl_completion_func_t* rl_attempted_completion_function = NULL;
+rl_compentry_func_t* rl_completion_entry_function = NULL;
+
+int history_length = 0;
+
+/* Perform some basic libisocline initialization on the first readline() call.
+ */
+static int init = 1;
+
+#define UNUSED(x) (void)(x)
+
+char*
+readline (const char* prompt)
+{
+ if (init)
+ {
+ init = 0;
+
+ ic_set_prompt_marker("" /* prompt_marker */,
+ NULL /* continuation_prompt_marker */);
+
+ }
+
+ return ic_readline (prompt);
+}
+
+int
+add_history (const char* command)
+{
+ UNUSED (command);
+ return 1; /* Unsupported */
+}
+
+int
+read_history (const char* file)
+{
+ UNUSED (file);
+ return 1; /* Unsupported */
+}
+
+int
+write_history (const char* command)
+{
+ UNUSED (command);
+ return 1; /* Unsupported */
+}
+
+HIST_ENTRY*
+history_get (int offset)
+{
+ UNUSED (offset);
+ return NULL;
+}
+
+int
+rl_insert (int count, int chr)
+{
+ UNUSED (count);
+ UNUSED (chr);
+ return 1; /* Unsupported */
+}
+
+int
+rl_add_defun (const char* name, rl_command_func_t* f, int chr)
+{
+ UNUSED (name);
+ UNUSED (f);
+ UNUSED (chr);
+ return 1; /* Unsupported */
+}
+
+char**
+rl_completion_matches (const char* str, rl_compentry_func_t* f)
+{
+ UNUSED (str);
+ UNUSED (f);
+ return NULL;
+}
diff --git a/mysql-client/mysql/downstream/readline.h b/mysql-client/mysql/downstream/readline.h
new file mode 100644
index 0000000..1540200
--- /dev/null
+++ b/mysql-client/mysql/downstream/readline.h
@@ -0,0 +1,59 @@
+/* file : mysql/downstream/readline.h
+ * license : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file
+ */
+
+#ifndef MYSQL_DOWNSTREAM_READLINE_H
+#define MYSQL_DOWNSTREAM_READLINE_H
+
+/*
+ * Reduced implementation of the libedit library based on libisocline.
+ *
+ * Specially, only the basic line editing functionality is supported (no
+ * completion, history, etc).
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Thin wrapper around libisocline's ic_readline().
+ */
+char*
+readline (const char* prompt);
+
+/*
+ * Reading function stubs.
+ */
+typedef char** rl_completion_func_t (const char*, int, int);
+typedef char* rl_compentry_func_t (const char*, int);
+typedef int rl_command_func_t (int, int);
+typedef char* rl_compentry_func_t (const char*, int);
+
+int rl_insert (int, int);
+int rl_add_defun (const char*, rl_command_func_t*, int);
+char** rl_completion_matches (const char*, rl_compentry_func_t*);
+
+extern char* rl_readline_name;
+extern rl_completion_func_t* rl_attempted_completion_function;
+extern rl_compentry_func_t* rl_completion_entry_function;
+
+/*
+ * Hstory function stubs.
+ */
+typedef struct _hist_entry {
+ const char *line;
+ const char *data;
+} HIST_ENTRY;
+
+int add_history (const char*);
+int read_history (const char*);
+int write_history (const char*);
+HIST_ENTRY* history_get (int);
+
+extern int history_length;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MYSQL_DOWNSTREAM_READLINE_H */
diff --git a/mysql-client/mysql/include b/mysql-client/mysql/include
new file mode 120000
index 0000000..01fbb48
--- /dev/null
+++ b/mysql-client/mysql/include
@@ -0,0 +1 @@
+../../upstream/include \ No newline at end of file
diff --git a/mysql-client/mysql/libbinlogevents b/mysql-client/mysql/libbinlogevents
new file mode 120000
index 0000000..2a2879b
--- /dev/null
+++ b/mysql-client/mysql/libbinlogevents
@@ -0,0 +1 @@
+../../upstream/libbinlogevents \ No newline at end of file
diff --git a/mysql-client/mysql/my_config.h b/mysql-client/mysql/my_config.h
new file mode 120000
index 0000000..168261b
--- /dev/null
+++ b/mysql-client/mysql/my_config.h
@@ -0,0 +1 @@
+../../libmysqlclient/mysql/my_config.h \ No newline at end of file
diff --git a/mysql-client/mysql/mysqld_error.h b/mysql-client/mysql/mysqld_error.h
new file mode 120000
index 0000000..74d62ad
--- /dev/null
+++ b/mysql-client/mysql/mysqld_error.h
@@ -0,0 +1 @@
+../../libmysqlclient/mysql/mysqld_error.h \ No newline at end of file