Commit 76b41147 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

register more mroonga UDFs.

parent 841ae71b
...@@ -80,16 +80,19 @@ class Recipe(GenericBaseRecipe): ...@@ -80,16 +80,19 @@ class Recipe(GenericBaseRecipe):
mysql_script_list = [] mysql_script_list = []
# user defined functions # user defined functions
udf_registration = ""
mroonga = self.options.get('mroonga', 'ha_mroonga.so') mroonga = self.options.get('mroonga', 'ha_mroonga.so')
if mroonga: if mroonga:
last_insert_grn_id = "CREATE FUNCTION last_insert_grn_id RETURNS " \ udf_registration += "CREATE FUNCTION last_insert_grn_id RETURNS " \
"INTEGER SONAME '" + mroonga + "';" "INTEGER SONAME '" + mroonga + "';\n"
else: udf_registration += "CREATE FUNCTION mroonga_snippet RETURNS " \
last_insert_grn_id = "" "STRING SONAME '" + mroonga + "';\n"
udf_registration += "CREATE FUNCTION mroonga_command RETURNS " \
"STRING SONAME '" + mroonga + "';\n"
mysql_script_list.append(self.substituteTemplate( mysql_script_list.append(self.substituteTemplate(
self.getTemplateFilename('mysql-init-function.sql.in'), self.getTemplateFilename('mysql-init-function.sql.in'),
{ {
'last_insert_grn_id': last_insert_grn_id, 'udf_registration': udf_registration,
} }
)) ))
# real database # real database
......
USE mysql; USE mysql;
DROP FUNCTION IF EXISTS last_insert_grn_id; DROP FUNCTION IF EXISTS last_insert_grn_id;
%(last_insert_grn_id)s DROP FUNCTION IF EXISTS mroonga_snippet;
DROP FUNCTION IF EXISTS mroonga_command;
DROP FUNCTION IF EXISTS sphinx_snippets; DROP FUNCTION IF EXISTS sphinx_snippets;
#CREATE FUNCTION sphinx_snippets RETURNS STRING SONAME 'ha_sphinx.so'; %(udf_registration)s
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment