diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2016-11-06 14:57:27 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2016-11-06 14:57:27 +0100 |
commit | 5884aa15d40b4dcc6de5cbcf276200c5fcbac938 (patch) | |
tree | b3d35755ee6f0acf2cab877130df1a39daff0b3c /storage/connect/jsonudf.cpp | |
parent | b7aee7dbe71cf77199e28e905469f0d9fb6d4a80 (diff) | |
download | mariadb-git-5884aa15d40b4dcc6de5cbcf276200c5fcbac938.tar.gz |
- Fix MDEV-11234. Escape quoting character. Should be doubled.
Now it is also possible to escape it by a backslash.
modified: storage/connect/tabfmt.cpp
- Prepare making VEC table type support conditional.
VEC tables might be unsupported in future versions
modified: storage/connect/CMakeLists.txt
modified: storage/connect/mycat.cc
modified: storage/connect/reldef.cpp
modified: storage/connect/xindex.cpp
- MDEV-11067 suggested to add configuration support to the Apache wrapper.
Was added but commented out until prooved it is really useful.
modified: storage/connect/ApacheInterface.java
modified: storage/connect/ha_connect.cc
modified: storage/connect/jdbccat.h
modified: storage/connect/jdbconn.cpp
modified: storage/connect/jdbconn.h
modified: storage/connect/tabjdbc.cpp
modified: storage/connect/tabjdbc.h
- Remove useless members.
modified: storage/connect/jdbconn.cpp
modified: storage/connect/jdbconn.h
- New UDF countin.
modified: storage/connect/jsonudf.cpp
modified: storage/connect/jsonudf.h
Diffstat (limited to 'storage/connect/jsonudf.cpp')
-rw-r--r-- | storage/connect/jsonudf.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 8bddc68e2ae..f9034f25739 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -5264,3 +5264,50 @@ char *envar(UDF_INIT *initid, UDF_ARGS *args, char *result, return str; } // end of envar +/*********************************************************************************/ +/* Returns the distinct number of B occurences in A. */ +/*********************************************************************************/ +my_bool countin_init(UDF_INIT *initid, UDF_ARGS *args, char *message) +{ + if (args->arg_count != 2) { + strcpy(message, "This function must have 2 arguments"); + return true; + } else if (args->arg_type[0] != STRING_RESULT) { + strcpy(message, "First argument must be string"); + return true; + } else if (args->arg_type[1] != STRING_RESULT) { + strcpy(message, "Second argument is not a string"); + return true; + } // endif args + + return false; +} // end of countin_init + +long long countin(UDF_INIT *initid, UDF_ARGS *args, char *result, + unsigned long *res_length, char *is_null, char *) +{ + PSZ str1, str2; + char *s; + long long n = 0; + size_t lg; + + lg = (size_t)args->lengths[0]; + s = str1 = (PSZ)malloc(lg + 1); + memcpy(str1, args->args[0], lg); + str1[lg] = 0; + + lg = (size_t)args->lengths[1]; + str2 = (PSZ)malloc(lg + 1); + memcpy(str2, args->args[1], lg); + str2[lg] = 0; + + while (s = strstr(s, str2)) { + n++; + s += lg; + } // endwhile + + free(str1); + free(str2); + return n; +} // end of countin + |