summarylogtreecommitdiffstats
path: root/bootstrap.patch
diff options
context:
space:
mode:
authorDevin J. Pohly2016-04-12 13:51:49 -0400
committerDevin J. Pohly2016-04-12 13:51:49 -0400
commitd87a73e2bc6d1f4c66a49cc93535f8c936a4d991 (patch)
tree0ca179a5107dc79f4bd2012acb4fa7f8a5d13c58 /bootstrap.patch
parent3a6a73a9b77436852e1c2047717ed16ff980d010 (diff)
downloadaur-udf-infusion-git.tar.gz
register/unregister functions with install script
Diffstat (limited to 'bootstrap.patch')
-rw-r--r--bootstrap.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/bootstrap.patch b/bootstrap.patch
new file mode 100644
index 000000000000..a3b573f17c96
--- /dev/null
+++ b/bootstrap.patch
@@ -0,0 +1,82 @@
+diff --git a/load.sql.sh b/load.sql.sh
+index add962a..3ec6c12 100644
+--- a/load.sql.sh
++++ b/load.sql.sh
+@@ -10,11 +10,21 @@ if_enable() {
+ }
+
+ create_agg_function() {
+- echo "CREATE AGGREGATE FUNCTION $1 RETURNS $2 SONAME 'udf_infusion.so';"
++ case $2 in
++ string) ret=0;;
++ real) ret=1;;
++ integer) ret=2;;
++ esac
++ echo "INSERT INTO mysql.func (name, ret, dl, type) VALUES ('$1', $ret, 'udf_infusion.so', 'aggregate');"
+ }
+
+ create_function() {
+- echo "CREATE FUNCTION $1 RETURNS $2 SONAME 'udf_infusion.so';"
++ case $2 in
++ string) ret=0;;
++ real) ret=1;;
++ integer) ret=2;;
++ esac
++ echo "INSERT INTO mysql.func (name, ret, dl, type) VALUES ('$1', $ret, 'udf_infusion.so', 'function');"
+ }
+
+ sh unload.sql.sh
+diff --git a/unload.sql.sh b/unload.sql.sh
+index 25fd264..9d5cfd5 100644
+--- a/unload.sql.sh
++++ b/unload.sql.sh
+@@ -1,48 +1,3 @@
+-[ $# -eq 0 ] && enable_all=1
+-enable_functions="$@"
+-
+-if_enable() {
+- [ "$enable_all" = 1 ] && return 0
+- for func in $enable_functions; do
+- [ "$func" = "$1" ] && return 0
+- done
+- return 1
+-}
+-
+-drop_function() {
+- echo "DROP FUNCTION IF EXISTS $1;"
+-}
+-
+-if_enable "bound" && drop_function "bound"
+-if_enable "bround" && drop_function "bround"
+-if_enable "corr" && drop_function "corr"
+-if_enable "covariance" && drop_function "covariance"
+-if_enable "cut" && drop_function "cut"
+-if_enable "fnv" && drop_function "fnv"
+-if_enable "getint" && drop_function "getint"
+-if_enable "group_first" && drop_function "group_first"
+-if_enable "group_last" && drop_function "group_last"
+-if_enable "invbit" && drop_function "invbit"
+-if_enable "isbit" && drop_function "isbit"
+-if_enable "kurtosis" && drop_function "kurtosis"
+-if_enable "lessavg" && drop_function "lessavg"
+-if_enable "lesspartpct" && drop_function "lesspartpct"
+-if_enable "lesspart" && drop_function "lesspart"
+-if_enable "median" && drop_function "median"
+-if_enable "stats_mode" && drop_function "stats_mode"
+-if_enable "ngram" && drop_function "ngram"
+-if_enable "noverk" && drop_function "noverk"
+-if_enable "percentile_cont" && drop_function "percentile_cont"
+-if_enable "percentile_disc" && drop_function "percentile_disc"
+-if_enable "rotbit" && drop_function "rotbit"
+-if_enable "rotint" && drop_function "rotint"
+-if_enable "row_number" && drop_function "row_number"
+-if_enable "rsumd" && drop_function "rsumd"
+-if_enable "rsumi" && drop_function "rsumi"
+-if_enable "setbit" && drop_function "setbit"
+-if_enable "setint" && drop_function "setint"
+-if_enable "skewness" && drop_function "skewness"
+-if_enable "slug" && drop_function "slug"
+-if_enable "xround" && drop_function "xround"
++echo "DELETE FROM mysql.func WHERE dl = 'udf_infusion.so';"
+
+ true