From e7d776b53533401ea94bd20a29b43299c4050fe9 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Tue, 8 Nov 2011 13:56:45 +0100 Subject: [PATCH] initialise user-defined functions in mysql_update. --- slapos/recipe/erp5/__init__.py | 4 +++- .../{initmysql.sql.in => mysql-init-database.sql.in} | 0 slapos/recipe/erp5/template/mysql-init-function.sql.in | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) rename slapos/recipe/erp5/template/{initmysql.sql.in => mysql-init-database.sql.in} (100%) create mode 100644 slapos/recipe/erp5/template/mysql-init-function.sql.in diff --git a/slapos/recipe/erp5/__init__.py b/slapos/recipe/erp5/__init__.py index 4a63a2980..672bf9792 100644 --- a/slapos/recipe/erp5/__init__.py +++ b/slapos/recipe/erp5/__init__.py @@ -1198,6 +1198,8 @@ SSLCARevocationPath %(ca_crl)s""" mysql_conf)) mysql_script_list = [] + mysql_script_list.append(pkg_resources.resource_string(__name__, + 'template/mysql-init-function.sql.in')) for x_database, x_user, x_password in \ [(mysql_conf['mysql_database'], mysql_conf['mysql_user'], @@ -1207,7 +1209,7 @@ SSLCARevocationPath %(ca_crl)s""" mysql_conf['mysql_test_password']), ] + mysql_conf['mysql_parallel_test_dict']: mysql_script_list.append(pkg_resources.resource_string(__name__, - 'template/initmysql.sql.in') % { + 'template/mysql-init-database.sql.in') % { 'mysql_database': x_database, 'mysql_user': x_user, 'mysql_password': x_password}) diff --git a/slapos/recipe/erp5/template/initmysql.sql.in b/slapos/recipe/erp5/template/mysql-init-database.sql.in similarity index 100% rename from slapos/recipe/erp5/template/initmysql.sql.in rename to slapos/recipe/erp5/template/mysql-init-database.sql.in diff --git a/slapos/recipe/erp5/template/mysql-init-function.sql.in b/slapos/recipe/erp5/template/mysql-init-function.sql.in new file mode 100644 index 000000000..c4d0cbde4 --- /dev/null +++ b/slapos/recipe/erp5/template/mysql-init-function.sql.in @@ -0,0 +1,5 @@ +USE mysql; +DROP FUNCTION IF EXISTS last_insert_grn_id; +CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME 'ha_groonga.so'; +DROP FUNCTION IF EXISTS sphinx_snippets; +CREATE FUNCTION sphinx_snippets RETURNS STRING SONAME 'sphinx.so'; -- 2.30.9