Commit 665ea779 authored by Alexander Barkov's avatar Alexander Barkov

Merge 10.0-mroonga -> 10.0

parents 44428d39 8dbe3d81

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -1188,6 +1188,17 @@ storage/tokudb/ft-index/tools/tdb-recover
storage/tokudb/ft-index/tools/tdb_logprint
storage/tokudb/ft-index/tools/tokudb_dump
storage/tokudb/ft-index/tools/tokuftdump
storage/mroonga/config.sh
storage/mroonga/mrn_version.h
storage/mroonga/data/install.sql
storage/mroonga/vendor/groonga/config.sh
storage/mroonga/vendor/groonga/groonga.pc
storage/mroonga/vendor/groonga/version.sh
storage/mroonga/vendor/groonga/src/grnslap
storage/mroonga/vendor/groonga/src/groonga
storage/mroonga/vendor/groonga/src/groonga-benchmark
storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset
storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/groonga-normalizer-mysql.pc
libmysql/libmysql_versions.ld
scripts/mysql_config.pl
pcre/pcre_chartables.c
......
......@@ -1269,3 +1269,16 @@
fun:__tls_get_addr
}
{
Mroonga: dlopen leaves some "still reachable"
Memcheck:Leak
fun:malloc
...
fun:dl_open_worker
fun:_dl_catch_error
fun:_dl_open
fun:dlopen_doit
fun:_dl_catch_error
fun:_dlerror_run
fun:dlopen@@GLIBC_2.2.5
}
Active developers:
* Kentoku SHIBA
* Kouhei Sutou
Inactive developers:
* Tetsuro IKEDA: The original author: Active
* Yoshinori Matsunobu: The original author of information schema
This diff is collapsed.
2009-01-27 Tetsuro IKEDA <ikdttr at gmail.com>
* initial import for development
AUTOMAKE_OPTIONS = 1.9.7
LOCALES = ja
AM_CPPFLAGS = $(MYSQL_INCLUDES) $(GROONGA_CFLAGS) -I$(top_srcdir)/lib
ACLOCAL_AMFLAGS = $$ACLOCAL_ARGS
include sources.am
libraries = \
$(top_builddir)/udf/libmrn_udf.la \
$(top_builddir)/lib/libmrn_no_mysql.la \
$(top_builddir)/lib/libmrn_need_mysql.la
if WITH_LIBMYSQLSERVICES_COMPAT
libraries += $(top_builddir)/lib/libmysqlservices.la
endif
dynamic_plugin_ldflags = -module $(GROONGA_LIBS) $(MYSQL_LIBS)
dynamic_plugin_cxxflags = $(AM_CXXFLAGS) $(MYSQL_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
dynamic_plugin_cflags = $(AM_CFLAGS) $(MYSQL_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
plugin_LTLIBRARIES = ha_mroonga.la
ha_mroonga_la_LDFLAGS = $(dynamic_plugin_ldflags)
ha_mroonga_la_CXXFLAGS = $(dynamic_plugin_cxxflags)
ha_mroonga_la_CFLAGS = $(dynamic_plugin_cflags)
ha_mroonga_la_SOURCES = $(sources)
ha_mroonga_la_LIBADD = $(libraries)
SUBDIRS = \
build \
lib \
udf \
test \
mysql-test \
doc \
tools \
packages \
data
EXTRA_DIST = \
AUTHORS \
gpg_uid \
plug.in \
CMakeLists.txt
installcheck-local: install
test/run-sql-test.sh
tag:
cd $(top_srcdir) && \
git tag v$(VERSION) -a -m 'Mroonga $(VERSION)!!!'
update-latest-release: misc
@if test -z "$(OLD_RELEASE)"; then \
echo "\$$(OLD_RELEASE) is missing"; \
exit 1; \
fi
@if test -z "$(OLD_RELEASE_DATE)"; then \
echo "\$$(OLD_RELEASE_DATE) is missing"; \
exit 1; \
fi
@if test -z "$(NEW_RELEASE_DATE)"; then \
echo "\$$(NEW_RELEASE_DATE) is missing"; \
exit 1; \
fi
cd $(top_srcdir) && \
misc/update-latest-release.rb \
$(PACKAGE) $(OLD_RELEASE) $(OLD_RELEASE_DATE) \
$(VERSION) $(NEW_RELEASE_DATE) \
packages/rpm/fedora/mysql-mroonga.spec.in \
packages/rpm/fedora/mariadb-mroonga.spec.in \
packages/rpm/centos/mariadb-mroonga.spec.in \
packages/rpm/centos/mysql55-mroonga.spec.in \
packages/rpm/centos/mysql56-community-mroonga.spec.in \
packages/debian/changelog \
doc/source/install/*.rst \
doc/locale/*/LC_MESSAGES/install.po \
$(MROONGA_GITHUB_COM_PATH)/index.html \
$(MROONGA_GITHUB_COM_PATH)/ja/index.html
update-po:
@for lang in $(LOCALES); do \
(cd $(top_srcdir)/doc/locale/$$lang/LC_MESSAGES && make update) \
done
update-document:
@if test -z "$(MROONGA_GITHUB_COM_PATH)"; then \
echo "\$$(MROONGA_GITHUB_COM_PATH) is missing"; \
echo "add --with-mroonga-github-com-path in configure"; \
exit 1; \
fi
rm -rf tmp-doc
mkdir tmp-doc
(cd doc && $(MAKE) clean-html)
(cd doc && $(MAKE) install docdir=$(abs_srcdir)/tmp-doc/install)
ruby $(srcdir)/tools/prepare-sphinx-html.rb tmp-doc/install tmp-doc/dist
rm -rf $(MROONGA_GITHUB_COM_PATH)/docs
mv tmp-doc/dist/en $(MROONGA_GITHUB_COM_PATH)/docs
for locale in `cd tmp-doc/dist; echo *`; do \
dest_base_dir=$(MROONGA_GITHUB_COM_PATH)/$${locale}; \
mkdir -p $${dest_base_dir}; \
dest_dir=$${dest_base_dir}/docs; \
rm -rf $${dest_dir}; \
mv tmp-doc/dist/$${locale} $${dest_dir}; \
done
update-files:
cd $(srcdir)/doc && $(MAKE) update-files
update-version:
@if test -z "$(NEW_VERSION_MAJOR)"; then \
echo "\$$(NEW_VERSION_MAJOR) is missing"; \
exit 1; \
fi
@if test -z "$(NEW_VERSION_MINOR)"; then \
echo "\$$(NEW_VERSION_MINOR) is missing"; \
exit 1; \
fi
@if test -z "$(NEW_VERSION_MICRO)"; then \
echo "\$$(NEW_VERSION_MICRO) is missing"; \
exit 1; \
fi
@echo -n $(NEW_VERSION_MAJOR) > $(srcdir)/version_major
@echo -n $(NEW_VERSION_MINOR) > $(srcdir)/version_minor
@echo -n $(NEW_VERSION_MICRO) > $(srcdir)/version_micro
@echo -n $(NEW_VERSION_MAJOR).$(NEW_VERSION_MINOR)$(NEW_VERSION_MICRO) \
> $(srcdir)/version
@if test $(NEW_VERSION_MINOR) -eq 0 ; then \
printf "0x%02x%02x" \
$(NEW_VERSION_MAJOR) $(NEW_VERSION_MICRO) \
> $(srcdir)/version_in_hex; \
printf "%d.%d" \
$(NEW_VERSION_MAJOR) $(NEW_VERSION_MICRO) \
> $(srcdir)/plugin_version; \
else \
printf "0x%02x%02x" \
$(NEW_VERSION_MAJOR) $(NEW_VERSION_MINOR)$(NEW_VERSION_MICRO) \
> $(srcdir)/version_in_hex; \
printf "%d.%d" \
$(NEW_VERSION_MAJOR) $(NEW_VERSION_MINOR)$(NEW_VERSION_MICRO) \
> $(srcdir)/plugin_version; \
fi
upload-to-github:
ruby $(srcdir)/tools/upload-to-github.rb \
$$USER $(PACKAGE)-$(VERSION).tar.gz
echo-cutter:
echo $(CUTTER)
misc:
@if test -z "$(CUTTER_SOURCE_PATH)"; then \
echo "\$$(CUTTER_SOURCE_PATH) is missing"; \
exit 1; \
fi
ln -s "$(CUTTER_SOURCE_PATH)/misc" misc
See doc/source/news.txt or http://mroonga.github.com/docs/news.html.
See doc/locale/en/html/index.html or doc/locale/ja/html/index.html
#!/bin/sh
warn() {
echo " WARNING: $@" 1>&2
}
# init
LIBTOOLIZE=libtoolize
ACLOCAL=aclocal
AUTOCONF=autoconf
AUTOHEADER=autoheader
AUTOMAKE=automake
case `uname -s` in
Darwin)
LIBTOOLIZE=glibtoolize
;;
FreeBSD)
ACLOCAL_ARGS="$ACLOCAL_ARGS -I /usr/local/share/aclocal/"
;;
esac
# libtoolize
echo "Searching libtoolize..."
if [ `which $LIBTOOLIZE` ] ; then
echo " FOUND: libtoolize -> $LIBTOOLIZE"
else
warn "Cannot Found libtoolize... input libtool command"
read LIBTOOLIZE
LIBTOOLIZE=`which $LIBTOOLIZE`
if [ `which $LIBTOOLIZE` ] ; then
echo " SET: libtoolize -> $LIBTOOLIZE"
else
warn "$LIBTOOLIZE: Command not found."
exit 1;
fi
fi
# aclocal
echo "Searching aclocal..."
if [ `which $ACLOCAL` ] ; then
echo " FOUND: aclocal -> $ACLOCAL"
else
warn "Cannot Found aclocal... input aclocal command"
read ACLOCAL
ACLOCAL=`which $ACLOCAL`
if [ `which $ACLOCAL` ] ; then
echo " SET: aclocal -> $ACLOCAL"
else
warn "$ACLOCAL: Command not found."
exit 1;
fi
fi
# automake
echo "Searching automake..."
if [ `which $AUTOMAKE` ] ; then
echo " FOUND: automake -> $AUTOMAKE"
else
warn "Cannot Found automake... input automake command"
read AUTOMAKE
ACLOCAL=`which $AUTOMAKE`
if [ `which $AUTOMAKE` ] ; then
echo " SET: automake -> $AUTOMAKE"
else
warn "$AUTOMAKE: Command not found."
exit 1;
fi
fi
# autoheader
echo "Searching autoheader..."
if [ `which $AUTOHEADER` ] ; then
echo " FOUND: autoheader -> $AUTOHEADER"
else
warn "Cannot Found autoheader... input autoheader command"
read AUTOHEADER
ACLOCAL=`which $AUTOHEADER`
if [ `which $AUTOHEADER` ] ; then
echo " SET: autoheader -> $AUTOHEADER"
else
warn "$AUTOHEADER: Command not found."
exit 1;
fi
fi
# autoconf
echo "Searching autoconf..."
if [ `which $AUTOCONF` ] ; then
echo " FOUND: autoconf -> $AUTOCONF"
else
warn "Cannot Found autoconf... input autoconf command"
read AUTOCONF
ACLOCAL=`which $AUTOCONF`
if [ `which $AUTOCONF` ] ; then
echo " SET: autoconf -> $AUTOCONF"
else
warn "$AUTOCONF: Command not found."
exit 1;
fi
fi
set -e
echo "Running libtoolize ..."
$LIBTOOLIZE --force --copy
echo "Running aclocal ..."
$ACLOCAL ${ACLOCAL_ARGS}
echo "Running autoheader..."
$AUTOHEADER
echo "Running automake ..."
$AUTOMAKE --add-missing --copy
echo "Running autoconf ..."
$AUTOCONF
SUBDIRS = \
cmake_modules
EXTRA_DIST = \
ReadFileList.cmake
# Copyright(C) 2012 Brazil
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
macro(read_file_list file_name output_variable)
file(READ ${file_name} ${output_variable})
# Remove variable declaration at the first line:
# "libgroonga_la_SOURCES = \" -> ""
string(REGEX REPLACE "^.*=[ \t]*\\\\" ""
${output_variable} "${${output_variable}}")
# Remove white spaces: " com.c \\\n com.h \\\n" -> "com.c\\com.h"
string(REGEX REPLACE "[ \t\n]" "" ${output_variable} "${${output_variable}}")
# Convert string to list: "com.c\\com.h" -> "com.c;com.h"
# NOTE: List in CMake is ";" separated string.
string(REGEX REPLACE "\\\\" ";" ${output_variable} "${${output_variable}}")
endmacro()
BUILT_SOURCES =
EXTRA_DIST =
SUFFIXES =
include $(top_srcdir)/build/makefiles/gettext.am
include $(top_srcdir)/doc/files.am
include $(top_srcdir)/build/makefiles/sphinx-build.am
EXTRA_DIST += \
$(po_files)
if DOCUMENT_AVAILABLE
EXTRA_DIST += \
$(mo_files)
endif
if DOCUMENT_BUILDABLE
BUILT_SOURCES += \
pot-build-stamp \
edit-po-build-stamp \
$(mo_files)
endif
SUFFIXES += .pot .po .mo .edit
.PHONY: gettext update build
.pot.edit:
if test -f $*.po; then \
msgmerge \
--quiet \
--sort-by-file \
--output-file=$@.tmp \
$*.po \
$<; \
else \
msginit \
--input=$< \
--output-file=$@.tmp \
--locale=$(LOCALE) \
--no-translator; \
fi
(echo "# -*- po -*-"; \
GREP_OPTIONS= grep -v '^# -\*- po -\*-' $@.tmp | \
GREP_OPTIONS= grep -v '^"POT-Creation-Date:') > $@
rm $@.tmp
.edit.po:
msgcat --no-location --output $@ $<
.po.mo:
msgfmt -o $@ $<
if DOCUMENT_BUILDABLE
update: pot-build-stamp edit-po-build-stamp
build: update $(mo_files)
else
update:
build:
endif
html: build
man: build
pdf: build
gettext:
rm *.pot || true
$(SPHINX_BUILD_COMMAND) -d doctrees -b gettext $(ALLSPHINXOPTS) .
xgettext --language Python --output conf.pot \
$(top_srcdir)/doc/source/conf.py
pot-build-stamp: $(absolute_source_files)
$(MAKE) gettext
@touch $@
edit-po-build-stamp: $(absolute_source_files)
$(MAKE) $(edit_po_files)
@touch $@
SUBDIRS = LC_MESSAGES
BUILT_SOURCES =
EXTRA_DIST =
include $(top_srcdir)/build/makefiles/sphinx.am
init:
cd LC_MESSAGES && $(MAKE) $@
update-po:
cd LC_MESSAGES && $(MAKE) update
# You can set these variables from the command line.
DOCTREES_BASE = doctrees
SPHINXOPTS =
PAPER =
# Internal variables.
SOURCE_DIR = $(abs_top_srcdir)/doc/source
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) -E $(SPHINXOPTS) $(SOURCE_DIR)
SPHINX_DIR = $(abs_top_builddir)/doc/sphinx
SPHINX_BUILD_COMMAND = \
DOCUMENT_VERSION="$(DOCUMENT_VERSION)" \
DOCUMENT_VERSION_FULL="$(DOCUMENT_VERSION_FULL)" \
LOCALE="$(LOCALE)" \
PYTHONPATH="$(SPHINX_DIR):$$PYTHONPATH" \
$(SPHINX_BUILD)
include $(top_srcdir)/doc/files.am
include $(top_srcdir)/build/makefiles/sphinx-build.am
$(html_files): html-build-stamp
$(html_files_relative_from_locale_dir): html-build-stamp
$(man_files): man-build-stamp
am__nobase_dist_doc_locale_DATA_DIST =
if DOCUMENT_AVAILABLE
doc_localedir = $(docdir)/$(LOCALE)
nobase_dist_doc_locale_DATA = \
$(html_files_relative_from_locale_dir)
am__nobase_dist_doc_locale_DATA_DIST += \
$(nobase_dist_doc_locale_DATA)
endif
document_source_files = \
$(absolute_source_files) \
$(absolute_theme_files) \
$(po_files_relative_from_locale_dir) \
$(mo_files_relative_from_locale_dir)
required_build_stamps = \
html-build-stamp \
man-build-stamp \
mo-build-stamp
if DOCUMENT_BUILDABLE
EXTRA_DIST += $(required_build_stamps)
endif
man_files = \
man/$(PACKAGE_NAME).1
generated_files = \
$(DOCTREES_BASE) \
man \
man-build-stamp \
html \
html-build-stamp \
pdf \
pdf-build-stamp \
dirhtml \
dirhtml-build-stamp \
pickle \
pikcle-build-stamp \
json \
json-build-stamp \
htmlhelp \
htmlhelp-build-stamp \
qthelp \
qthelp-build-stamp \
latex \
latex-build-stamp \
changes \
changes-build-stamp \
linkcheck \
linkcheck-build-stamp \
doctest
$(mo_files_relative_from_locale_dir): mo-build-stamp
mo-build-stamp: $(po_files_relative_from_locale_dir)
cd LC_MESSAGES && $(MAKE) build
@touch $@
if DOCUMENT_BUILDABLE
clean-local: $(clean_targets) clean-doctrees
clean-doctrees:
rm -rf $(DOCTREES_BASE)
maintainer-clean-local:
rm -rf -- $(generated_files)
endif
.PHONY: help
.PHONY: man clean-man
.PHONY: html clean-html
.PHONY: pdf
.PHONY: dirhtml
.PHONY: pickle
.PHONY: json
.PHONY: htmlhelp
.PHONY: qthelp
.PHONY: latex
.PHONY: changes
.PHONY: linkcheck
.PHONY: doctest
if DOCUMENT_BUILDABLE
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " man to make man files"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " rdoc to make RDoc files"
@echo " textile to make Textile files"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
man: man-build-stamp
html: html-build-stamp
dirhtml: dirhtml-build-stamp
pickle: pickle-build-stamp
json: json-build-stamp
htmlhelp: htmlhelp-build-stamp
qthelp: qthelp-build-stamp
latex: latex-build-stamp
rdoc: rdoc-build-stamp
textile: textile-build-stamp
changes: changes-build-stamp
linkcheck: linkcheck-build-stamp
doctest: doctest-build-stamp
clean_targets = \
clean-man \
clean-html \
clean-dirhtml \
clean-pickle \
clean-json \
clean-htmlhelp \
clean-qthelp \
clean-latex \
clean-rdoc \
clean-textile \
clean-changes \
clean-linkcheck \
clean-doctest
$(clean_targets):
target=`echo $@ | sed -e 's/^clean-//'`; \
rm -rf $${target}-build-stamp $${target}
build_stamps = \
man-build-stamp \
html-build-stamp \
dirhtml-build-stamp \
pickle-build-stamp \
json-build-stamp \
htmlhelp-build-stamp \
qthelp-build-stamp \
latex-build-stamp \
rdoc-build-stamp \
textile-build-stamp \
changes-build-stamp \
linkcheck-build-stamp \
doctest-build-stamp
$(build_stamps): $(document_source_files)
target=`echo $@ | sed -e 's/-build-stamp$$//'`; \
$(SPHINX_BUILD_COMMAND) \
-Dlanguage=$(LOCALE) \
-d $(DOCTREES_BASE)/$${target} \
-b $${target} \
$(ALLSPHINXOPTS) \
$${target}
@touch $@
qthelp: qthelp-message
qthelp-message: qthelp-build-stamp
@echo "Build finished; now you can run 'qcollectiongenerator' with the" \
".qhcp project file in qthelp/*, like this:"
@echo "# qcollectiongenerator qthelp/groonga.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile qthelp/groonga.qhc"
latex: latex-message
latex-message: latex-build-stamp
@echo "Build finished; the LaTeX files are in latex/*."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
endif
# Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
MYSQL_SOURCE_DIR="@MYSQL_SOURCE_DIR@"
MYSQL_BUILD_DIR="@MYSQL_BUILD_DIR@"
MYSQL_VERSION="@MYSQL_VERSION@"
MRN_BUNDLED="@MRN_BUNDLED@"
This diff is collapsed.
sqldir = $(pkgdatadir)
dist_sql_DATA = \
install.sql \
uninstall.sql
DELETE IGNORE FROM mysql.plugin WHERE dl = 'ha_mroonga@MRN_PLUGIN_SUFFIX@';
INSTALL PLUGIN Mroonga SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@';
DROP FUNCTION IF EXISTS last_insert_grn_id;
CREATE FUNCTION last_insert_grn_id RETURNS INTEGER
SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@';
DROP FUNCTION IF EXISTS mroonga_snippet;
CREATE FUNCTION mroonga_snippet RETURNS STRING
SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@';
DROP FUNCTION IF EXISTS mroonga_command;
CREATE FUNCTION mroonga_command RETURNS STRING
SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@';
DROP FUNCTION IF EXISTS mroonga_escape;
CREATE FUNCTION mroonga_escape RETURNS STRING
SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@';
DROP FUNCTION IF EXISTS last_insert_grn_id;
DROP FUNCTION IF EXISTS mroonga_snippet;
DROP FUNCTION IF EXISTS mroonga_command;
DROP FUNCTION IF EXISTS mroonga_escape;
UNINSTALL PLUGIN Mroonga;
FLUSH TABLES;
This diff is collapsed.
LIBRARY ha_mroonga
VERSION 1.0
EXPORTS
last_insert_grn_id
last_insert_grn_id_init
last_insert_grn_id_deinit
mroonga_snippet
mroonga_snippet_init
mroonga_snippet_deinit
mroonga_command
mroonga_command_init
mroonga_command_deinit
mroonga_escape
mroonga_escape_init
mroonga_escape_deinit
This diff is collapsed.
AM_CPPFLAGS = \
-I$(top_builddir) \
-I$(top_srcdir) \
$(MYSQL_INCLUDES) \
$(GROONGA_CFLAGS) \
$(MYSQL_VERSION_CFLAGS)
libmrn_need_mysql_la_CXXFLAGS = $(AM_CXXFLAGS) $(MYSQL_CFLAGS)
if WITH_LIBMYSQLSERVICES_COMPAT
LIBMYSQLSERVICES_COMPAT = libmysqlservices.la
endif
noinst_LTLIBRARIES = \
$(LIBMYSQLSERVICES_COMPAT) \
libmrn_no_mysql.la \
libmrn_need_mysql.la
include libmrn_no_mysql_sources.am
include libmrn_need_mysql_sources.am
if WITH_LIBMYSQLSERVICES_COMPAT
include libmysqlservices_compat_sources.am
endif
libmrn_need_mysql_la_SOURCES = \
mrn_index_table_name.cpp \
mrn_index_table_name.hpp \
mrn_index_column_name.cpp \
mrn_index_column_name.hpp \
mrn_debug_column_access.cpp \
mrn_debug_column_access.hpp \
mrn_auto_increment_value_lock.cpp \
mrn_auto_increment_value_lock.hpp \
mrn_external_lock.cpp \
mrn_external_lock.hpp \
mrn_multiple_column_key_codec.cpp \
mrn_multiple_column_key_codec.hpp \
mrn_field_normalizer.cpp \
mrn_field_normalizer.hpp \
mrn_encoding.cpp \
mrn_encoding.hpp \
mrn_parameters_parser.cpp \
mrn_parameters_parser.hpp \
mrn_lock.cpp \
mrn_lock.hpp \
mrn_condition_converter.cpp \
mrn_condition_converter.hpp \
mrn_time_converter.cpp \
mrn_time_converter.hpp
libmrn_no_mysql_la_SOURCES = \
mrn_match_escalation_threshold_scope.cpp \
mrn_match_escalation_threshold_scope.hpp \
mrn_path_mapper.cpp \
mrn_path_mapper.hpp \
mrn_windows.hpp \
mrn_smart_grn_obj.cpp \
mrn_smart_grn_obj.hpp
libmysqlservices_la_SOURCES = \
mrn_mysqlservices.cpp
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mrn_auto_increment_value_lock.hpp"
#if MYSQL_VERSION_ID >= 50500
# define AUTO_INCREMENT_VALUE_MUTEX(table_share) (&(table_share->LOCK_ha_data))
#else
# define AUTO_INCREMENT_VALUE_MUTEX(table_share) (&(table_share->mutex))
#endif
namespace mrn {
AutoIncrementValueLock::AutoIncrementValueLock(TABLE_SHARE *table_share)
: table_share_(table_share),
need_lock_(table_share_->tmp_table == NO_TMP_TABLE) {
if (need_lock_) {
mysql_mutex_lock(AUTO_INCREMENT_VALUE_MUTEX(table_share_));
}
}
AutoIncrementValueLock::~AutoIncrementValueLock() {
if (need_lock_) {
mysql_mutex_unlock(AUTO_INCREMENT_VALUE_MUTEX(table_share_));
}
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_AUTO_INCREMENT_VALUE_LOCK_HPP_
#define MRN_AUTO_INCREMENT_VALUE_LOCK_HPP_
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
namespace mrn {
class AutoIncrementValueLock {
TABLE_SHARE *table_share_;
bool need_lock_;
public:
AutoIncrementValueLock(TABLE_SHARE *table_share);
~AutoIncrementValueLock();
};
}
#endif // MRN_AUTO_INCREMENT_VALUE_LOCK_HPP_
This diff is collapsed.
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_CONDITION_CONVERTER_HPP_
#define MRN_CONDITION_CONVERTER_HPP_
#include <groonga.h>
#include <mrn_mysql_compat.h>
namespace mrn {
class ConditionConverter {
public:
ConditionConverter(grn_ctx *ctx, grn_obj *table, bool is_storage_mode);
~ConditionConverter();
bool is_convertable(const Item *item);
const Item_func *find_match_against(const Item *item);
// caller must check "where" can be convertable by
// is_convertable(). This method doesn't validate "where".
void convert(const Item *where, grn_obj *expression);
private:
enum NormalizedType {
STRING_TYPE,
INT_TYPE,
TIME_TYPE,
UNSUPPORTED_TYPE,
};
grn_ctx *ctx_;
grn_obj *table_;
bool is_storage_mode_;
grn_obj column_name_;
grn_obj value_;
bool is_convertable(const Item_cond *cond_item);
bool is_convertable(const Item_func *func_item);
bool is_convertable_binary_operation(const Item_field *field_item,
Item *value_item,
Item_func::Functype func_type);
bool is_convertable_between(const Item_field *field_item,
Item *min_item,
Item *max_item);
bool is_valid_time_value(const Item_field *field_item,
Item *value_item);
bool get_time_value(const Item_field *field_item,
Item *value_item,
MYSQL_TIME *mysql_time);
bool have_index(const Item_field *field_item, grn_operator _operator);
bool have_index(const Item_field *field_item, Item_func::Functype func_type);
NormalizedType normalize_field_type(enum_field_types field_type);
void convert_binary_operation(const Item_func *func_item,
grn_obj *expression,
grn_operator _operator);
void convert_between(const Item_func *func_item, grn_obj *expression);
void append_field_value(const Item_field *field_item,
grn_obj *expression);
void append_const_item(const Item_field *field_item,
Item *const_item,
grn_obj *expression);
};
}
#endif /* MRN_CONDITION_CONVERTER_HPP_ */
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mrn_debug_column_access.hpp"
namespace mrn {
DebugColumnAccess::DebugColumnAccess(TABLE *table, MY_BITMAP *bitmap)
: table_(table),
bitmap_(bitmap) {
#ifndef DBUG_OFF
map_ = dbug_tmp_use_all_columns(table_, bitmap_);
#endif
}
DebugColumnAccess::~DebugColumnAccess() {
#ifndef DBUG_OFF
dbug_tmp_restore_column_map(bitmap_, map_);
#endif
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_DEBUG_COLUMN_ACCESS_HPP_
#define MRN_DEBUG_COLUMN_ACCESS_HPP_
#include <mrn_mysql.h>
namespace mrn {
class DebugColumnAccess {
TABLE *table_;
MY_BITMAP *bitmap_;
#ifndef DBUG_OFF
my_bitmap_map *map_;
#endif
public:
DebugColumnAccess(TABLE *table, MY_BITMAP *bitmap);
~DebugColumnAccess();
};
}
#endif // MRN_DEBUG_COLUMN_ACCESS_HPP_
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
Copyright(C) 2011-2013 Kentoku SHIBA
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <mrn_err.h>
#include "mrn_encoding.hpp"
namespace mrn {
namespace encoding {
CHARSET_INFO *mrn_charset_utf8 = NULL;
CHARSET_INFO *mrn_charset_utf8mb4 = NULL;
CHARSET_INFO *mrn_charset_binary = NULL;
CHARSET_INFO *mrn_charset_ascii = NULL;
CHARSET_INFO *mrn_charset_latin1_1 = NULL;
CHARSET_INFO *mrn_charset_latin1_2 = NULL;
CHARSET_INFO *mrn_charset_cp932 = NULL;
CHARSET_INFO *mrn_charset_sjis = NULL;
CHARSET_INFO *mrn_charset_eucjpms = NULL;
CHARSET_INFO *mrn_charset_ujis = NULL;
CHARSET_INFO *mrn_charset_koi8r = NULL;
void init(void) {
CHARSET_INFO **cs;
MRN_DBUG_ENTER_FUNCTION();
for (cs = all_charsets; cs < all_charsets + MY_ALL_CHARSETS_SIZE; cs++)
{
if (!cs[0])
continue;
if (!strcmp(cs[0]->csname, "utf8"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_utf8)
mrn_charset_utf8 = cs[0];
else if (mrn_charset_utf8->cset != cs[0]->cset)
DBUG_ASSERT(0);
continue;
}
if (!strcmp(cs[0]->csname, "utf8mb4"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_utf8mb4)
mrn_charset_utf8mb4 = cs[0];
else if (mrn_charset_utf8mb4->cset != cs[0]->cset)
DBUG_ASSERT(0);
continue;
}
if (!strcmp(cs[0]->csname, "binary"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_binary)
mrn_charset_binary = cs[0];
else if (mrn_charset_binary->cset != cs[0]->cset)
DBUG_ASSERT(0);
continue;
}
if (!strcmp(cs[0]->csname, "ascii"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_ascii)
mrn_charset_ascii = cs[0];
else if (mrn_charset_ascii->cset != cs[0]->cset)
DBUG_ASSERT(0);
continue;
}
if (!strcmp(cs[0]->csname, "latin1"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_latin1_1)
mrn_charset_latin1_1 = cs[0];
else if (mrn_charset_latin1_1->cset != cs[0]->cset)
{
if (!mrn_charset_latin1_2)
mrn_charset_latin1_2 = cs[0];
else if (mrn_charset_latin1_2->cset != cs[0]->cset)
DBUG_ASSERT(0);
}
continue;
}
if (!strcmp(cs[0]->csname, "cp932"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_cp932)
mrn_charset_cp932 = cs[0];
else if (mrn_charset_cp932->cset != cs[0]->cset)
DBUG_ASSERT(0);
continue;
}
if (!strcmp(cs[0]->csname, "sjis"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_sjis)
mrn_charset_sjis = cs[0];
else if (mrn_charset_sjis->cset != cs[0]->cset)
DBUG_ASSERT(0);
continue;
}
if (!strcmp(cs[0]->csname, "eucjpms"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_eucjpms)
mrn_charset_eucjpms = cs[0];
else if (mrn_charset_eucjpms->cset != cs[0]->cset)
DBUG_ASSERT(0);
continue;
}
if (!strcmp(cs[0]->csname, "ujis"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_ujis)
mrn_charset_ujis = cs[0];
else if (mrn_charset_ujis->cset != cs[0]->cset)
DBUG_ASSERT(0);
continue;
}
if (!strcmp(cs[0]->csname, "koi8r"))
{
DBUG_PRINT("info", ("mroonga: %s is %s [%p]",
cs[0]->name, cs[0]->csname, cs[0]->cset));
if (!mrn_charset_koi8r)
mrn_charset_koi8r = cs[0];
else if (mrn_charset_koi8r->cset != cs[0]->cset)
DBUG_ASSERT(0);
continue;
}
DBUG_PRINT("info", ("mroonga: %s[%s][%p] is not supported",
cs[0]->name, cs[0]->csname, cs[0]->cset));
}
DBUG_VOID_RETURN;
}
bool set(grn_ctx *ctx, const CHARSET_INFO *charset) {
MRN_DBUG_ENTER_FUNCTION();
if (!charset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_NONE);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_utf8->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8);
DBUG_RETURN(true);
}
if (mrn_charset_utf8mb4 && charset->cset == mrn_charset_utf8mb4->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_cp932->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_SJIS);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_eucjpms->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_EUC_JP);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_latin1_1->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_LATIN1);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_latin1_2->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_LATIN1);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_koi8r->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_KOI8R);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_binary->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_NONE);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_ascii->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_sjis->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_SJIS);
DBUG_RETURN(true);
}
if (charset->cset == mrn_charset_ujis->cset)
{
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_EUC_JP);
DBUG_RETURN(true);
}
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_NONE);
DBUG_RETURN(false);
}
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_ENCODING_HPP_
#define MRN_ENCODING_HPP_
#include <groonga.h>
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
namespace mrn {
namespace encoding {
void init(void);
bool set(grn_ctx *ctx, const CHARSET_INFO *charset);
}
}
#endif // MRN_ENCODING_HPP_
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2012 Kentoku SHIBA
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mrn_external_lock.hpp"
namespace mrn {
ExternalLock::ExternalLock(THD *thd, handler *handler, int lock_type)
: thd_(thd),
handler_(handler),
lock_type_(lock_type) {
if (lock_type_ != F_UNLCK) {
error_ = handler_->ha_external_lock(thd_, lock_type);
} else {
error_ = 0;
}
}
ExternalLock::~ExternalLock() {
if (lock_type_ != F_UNLCK) {
handler_->ha_external_lock(thd_, F_UNLCK);
}
}
int ExternalLock::error() {
return error_;
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2012 Kentoku SHIBA
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_EXTERNAL_LOCK_HPP_
#define MRN_EXTERNAL_LOCK_HPP_
#include <mrn_mysql.h>
namespace mrn {
class ExternalLock {
THD *thd_;
handler *handler_;
int lock_type_;
int error_;
public:
ExternalLock(THD *thd, handler *handler, int lock_type);
~ExternalLock();
int error();
};
}
#endif // MRN_EXTERNAL_LOCK_HPP_
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mrn_field_normalizer.hpp"
#include "mrn_encoding.hpp"
// for debug
#define MRN_CLASS_NAME "mrn::FieldNormalizer"
namespace mrn {
FieldNormalizer::FieldNormalizer(grn_ctx *ctx, THD *thread, Field *field)
: ctx_(ctx),
thread_(thread),
field_(field) {
}
FieldNormalizer::~FieldNormalizer() {
}
bool FieldNormalizer::should_normalize() {
MRN_DBUG_ENTER_METHOD();
DBUG_PRINT("info",
("mroonga: result_type = %u", field_->result_type()));
DBUG_PRINT("info",
("mroonga: charset->name = %s", field_->charset()->name));
DBUG_PRINT("info",
("mroonga: charset->csname = %s", field_->charset()->csname));
DBUG_PRINT("info",
("mroonga: charset->state = %u", field_->charset()->state));
bool need_normalize_p;
if (field_->charset()->state & (MY_CS_BINSORT | MY_CS_CSSORT)) {
need_normalize_p = false;
DBUG_PRINT("info",
("mroonga: should_normalize: false: sort is required"));
} else {
if (is_text_type()) {
need_normalize_p = true;
DBUG_PRINT("info", ("mroonga: should_normalize: true: text type"));
} else {
need_normalize_p = false;
DBUG_PRINT("info", ("mroonga: should_normalize: false: no text type"));
}
}
DBUG_RETURN(need_normalize_p);
}
bool FieldNormalizer::is_text_type() {
MRN_DBUG_ENTER_METHOD();
bool text_type_p;
switch (field_->type()) {
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_VAR_STRING:
text_type_p = true;
break;
case MYSQL_TYPE_STRING:
switch (field_->real_type()) {
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
text_type_p = false;
break;
default:
text_type_p = true;
break;
}
break;
default:
text_type_p = false;
break;
}
DBUG_RETURN(text_type_p);
}
grn_obj *FieldNormalizer::normalize(const char *string,
unsigned int string_length) {
MRN_DBUG_ENTER_METHOD();
grn_obj *normalizer = find_grn_normalizer();
int flags = 0;
grn_encoding original_encoding = GRN_CTX_GET_ENCODING(ctx_);
encoding::set(ctx_, field_->charset());
grn_obj *grn_string = grn_string_open(ctx_, string, string_length,
normalizer, flags);
GRN_CTX_SET_ENCODING(ctx_, original_encoding);
DBUG_RETURN(grn_string);
}
grn_obj *FieldNormalizer::find_grn_normalizer() {
MRN_DBUG_ENTER_METHOD();
const CHARSET_INFO *charset_info = field_->charset();
const char *normalizer_name = NULL;
const char *default_normalizer_name = "NormalizerAuto";
if ((strcmp(charset_info->name, "utf8_general_ci") == 0) ||
(strcmp(charset_info->name, "utf8mb4_general_ci") == 0)) {
normalizer_name = "NormalizerMySQLGeneralCI";
} else if ((strcmp(charset_info->name, "utf8_unicode_ci") == 0) ||
(strcmp(charset_info->name, "utf8mb4_unicode_ci") == 0)) {
normalizer_name = "NormalizerMySQLUnicodeCI";
}
grn_obj *normalizer = NULL;
if (normalizer_name) {
normalizer = grn_ctx_get(ctx_, normalizer_name, -1);
if (!normalizer) {
char error_message[MRN_MESSAGE_BUFFER_SIZE];
snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE,
"%s normalizer isn't found for %s. "
"Install groonga-normalizer-mysql normalizer. "
"%s is used as fallback.",
normalizer_name,
charset_info->name,
default_normalizer_name);
push_warning(thread_, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED, error_message);
}
}
if (!normalizer) {
normalizer = grn_ctx_get(ctx_, default_normalizer_name, -1);
}
DBUG_RETURN(normalizer);
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_FIELD_NORMALIZER_HPP_
#define MRN_FIELD_NORMALIZER_HPP_
#include <groonga.h>
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
namespace mrn {
class FieldNormalizer {
public:
FieldNormalizer(grn_ctx *ctx, THD *thread, Field *field);
~FieldNormalizer();
bool should_normalize();
grn_obj *normalize(const char *string, unsigned int string_length);
grn_obj *find_grn_normalizer();
private:
grn_ctx *ctx_;
THD *thread_;
Field *field_;
bool is_text_type();
};
}
#endif // MRN_FIELD_NORMALIZER_HPP_
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011-2013 Kentoku SHIBA
Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <mrn_mysql.h>
#include "mrn_index_column_name.hpp"
#define MRN_MIN_INDEX_COLUMN_NAME_LENGTH 65
// for debug
#define MRN_CLASS_NAME "mrn::IndexColumnName"
namespace mrn {
IndexColumnName::IndexColumnName(const char *table_name,
const char *mysql_column_name)
: table_name_(table_name),
mysql_column_name_(mysql_column_name) {
uchar encoded_mysql_column_name_multibyte[MRN_MAX_KEY_SIZE];
const uchar *mysql_column_name_multibyte =
reinterpret_cast<const uchar *>(mysql_column_name_);
encode(encoded_mysql_column_name_multibyte,
encoded_mysql_column_name_multibyte + MRN_MAX_KEY_SIZE,
mysql_column_name_multibyte,
mysql_column_name_multibyte + strlen(mysql_column_name_));
snprintf(name_, MRN_MAX_KEY_SIZE,
"%s-%s", table_name_, encoded_mysql_column_name_multibyte);
length_ = strlen(name_);
if (length_ < MRN_MIN_INDEX_COLUMN_NAME_LENGTH) {
memset(name_ + length_, '-', MRN_MIN_INDEX_COLUMN_NAME_LENGTH - length_);
length_ = MRN_MIN_INDEX_COLUMN_NAME_LENGTH;
name_[length_] = '\0';
}
}
const char *IndexColumnName::c_str() {
return name_;
}
size_t IndexColumnName::length() {
return length_;
}
uint IndexColumnName::encode(uchar *encoded_start,
uchar *encoded_end,
const uchar *mysql_string_start,
const uchar *mysql_string_end) {
MRN_DBUG_ENTER_METHOD();
my_charset_conv_mb_wc mb_wc = system_charset_info->cset->mb_wc;
my_charset_conv_wc_mb wc_mb = my_charset_filename.cset->wc_mb;
DBUG_PRINT("info", ("mroonga: in=%s", mysql_string_start));
encoded_end--;
uchar *encoded = encoded_start;
const uchar *mysql_string = mysql_string_start;
while (mysql_string < mysql_string_end && encoded < encoded_end) {
my_wc_t wc;
int mb_wc_converted_length;
int wc_mb_converted_length;
mb_wc_converted_length =
(*mb_wc)(NULL, &wc, mysql_string, mysql_string_end);
if (mb_wc_converted_length > 0) {
wc_mb_converted_length = (*wc_mb)(NULL, wc, encoded, encoded_end);
if (wc_mb_converted_length <= 0) {
break;
}
} else if (mb_wc_converted_length == MY_CS_ILSEQ) {
*encoded = *mysql_string;
mb_wc_converted_length = 1;
wc_mb_converted_length = 1;
} else {
break;
}
mysql_string += mb_wc_converted_length;
encoded += wc_mb_converted_length;
}
*encoded = '\0';
DBUG_PRINT("info", ("mroonga: out=%s", encoded_start));
DBUG_RETURN(encoded - encoded_start);
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011-2013 Kentoku SHIBA
Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_INDEX_COLUMN_NAME_HPP_
#define MRN_INDEX_COLUMN_NAME_HPP_
#include <mrn_constants.hpp>
namespace mrn {
class IndexColumnName {
public:
IndexColumnName(const char *table_name, const char *mysql_column_name);
const char *c_str();
size_t length();
private:
const char *table_name_;
const char *mysql_column_name_;
char name_[MRN_MAX_KEY_SIZE];
size_t length_;
uint encode(uchar *encoded_start, uchar *encoded_end,
const uchar *mysql_string_start, const uchar *mysql_string_end);
};
}
#endif /* MRN_INDEX_COLUMN_NAME_HPP_ */
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011 Kentoku SHIBA
Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <mrn_mysql.h>
#include "mrn_index_table_name.hpp"
// for debug
#define MRN_CLASS_NAME "mrn::IndexTableName"
namespace mrn {
IndexTableName::IndexTableName(const char *table_name,
const char *mysql_index_name)
: table_name_(table_name),
mysql_index_name_(mysql_index_name) {
uchar encoded_mysql_index_name_multibyte[MRN_MAX_KEY_SIZE];
const uchar *mysql_index_name_multibyte =
reinterpret_cast<const uchar *>(mysql_index_name_);
encode(encoded_mysql_index_name_multibyte,
encoded_mysql_index_name_multibyte + MRN_MAX_KEY_SIZE,
mysql_index_name_multibyte,
mysql_index_name_multibyte + strlen(mysql_index_name_));
snprintf(name_, MRN_MAX_KEY_SIZE,
"%s-%s", table_name_, encoded_mysql_index_name_multibyte);
length_ = strlen(name_);
}
const char *IndexTableName::c_str() {
return name_;
}
size_t IndexTableName::length() {
return length_;
}
uint IndexTableName::encode(uchar *encoded_start,
uchar *encoded_end,
const uchar *mysql_string_start,
const uchar *mysql_string_end) {
MRN_DBUG_ENTER_METHOD();
my_charset_conv_mb_wc mb_wc = system_charset_info->cset->mb_wc;
my_charset_conv_wc_mb wc_mb = my_charset_filename.cset->wc_mb;
DBUG_PRINT("info", ("mroonga: in=%s", mysql_string_start));
encoded_end--;
uchar *encoded = encoded_start;
const uchar *mysql_string = mysql_string_start;
while (mysql_string < mysql_string_end && encoded < encoded_end) {
my_wc_t wc;
int mb_wc_converted_length;
int wc_mb_converted_length;
mb_wc_converted_length =
(*mb_wc)(NULL, &wc, mysql_string, mysql_string_end);
if (mb_wc_converted_length > 0) {
wc_mb_converted_length = (*wc_mb)(NULL, wc, encoded, encoded_end);
if (wc_mb_converted_length <= 0) {
break;
}
} else if (mb_wc_converted_length == MY_CS_ILSEQ) {
*encoded = *mysql_string;
mb_wc_converted_length = 1;
wc_mb_converted_length = 1;
} else {
break;
}
mysql_string += mb_wc_converted_length;
encoded += wc_mb_converted_length;
}
*encoded = '\0';
DBUG_PRINT("info", ("mroonga: out=%s", encoded_start));
DBUG_RETURN(encoded - encoded_start);
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011 Kentoku SHIBA
Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_INDEX_TABLE_NAME_HPP_
#define MRN_INDEX_TABLE_NAME_HPP_
#include <mrn_constants.hpp>
namespace mrn {
class IndexTableName {
public:
IndexTableName(const char *table_name, const char *mysql_index_name);
const char *c_str();
size_t length();
private:
const char *table_name_;
const char *mysql_index_name_;
char name_[MRN_MAX_KEY_SIZE];
size_t length_;
uint encode(uchar *encoded_start, uchar *encoded_end,
const uchar *mysql_string_start, const uchar *mysql_string_end);
};
}
#endif /* MRN_INDEX_TABLE_NAME_HPP_ */
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mrn_lock.hpp"
namespace mrn {
Lock::Lock(pthread_mutex_t *mutex)
: mutex_(mutex) {
pthread_mutex_lock(mutex_);
}
Lock::~Lock() {
pthread_mutex_unlock(mutex_);
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_LOCK_HPP_
#define MRN_LOCK_HPP_
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
namespace mrn {
class Lock {
public:
Lock(pthread_mutex_t *mutex);
~Lock();
private:
pthread_mutex_t *mutex_;
};
}
#endif /* MRN_LOCK_HPP_ */
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mrn_match_escalation_threshold_scope.hpp"
namespace mrn {
MatchEscalationThresholdScope::MatchEscalationThresholdScope(
grn_ctx *ctx, long long int threshold)
: ctx_(ctx),
original_threshold_(grn_ctx_get_match_escalation_threshold(ctx_)) {
grn_ctx_set_match_escalation_threshold(ctx_, threshold);
}
MatchEscalationThresholdScope::~MatchEscalationThresholdScope() {
grn_ctx_set_match_escalation_threshold(ctx_, original_threshold_);
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_MATCH_ESCALATION_THRESHOLD_SCOPE_HPP_
#define MRN_MATCH_ESCALATION_THRESHOLD_SCOPE_HPP_
#include <groonga.h>
namespace mrn {
class MatchEscalationThresholdScope {
grn_ctx *ctx_;
long long int original_threshold_;
public:
MatchEscalationThresholdScope(grn_ctx *ctx, long long int threshold);
~MatchEscalationThresholdScope();
};
}
#endif // MRN_MATCH_ESCALATION_THRESHOLD_SCOPE_HPP_
This diff is collapsed.
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_
#define MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_
#include <groonga.h>
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
namespace mrn {
class MultipleColumnKeyCodec {
public:
MultipleColumnKeyCodec(grn_ctx *ctx, THD *thread, KEY *key_info);
~MultipleColumnKeyCodec();
int encode(const uchar *mysql_key, uint mysql_key_length,
uchar *grn_key, uint *grn_key_length);
int decode(const uchar *grn_key, uint grn_key_length,
uchar *mysql_key, uint *mysql_key_length);
uint size();
private:
enum DataType {
TYPE_UNKNOWN,
TYPE_LONG_LONG_NUMBER,
TYPE_NUMBER,
TYPE_FLOAT,
TYPE_DOUBLE,
TYPE_BYTE_SEQUENCE,
TYPE_BYTE_REVERSE,
TYPE_BYTE_BLOB
};
grn_ctx *ctx_;
THD *thread_;
KEY *key_info_;
void get_key_info(KEY_PART_INFO *key_part,
DataType *data_type, uint *data_size);
void encode_float(volatile float value, uint data_size, uchar *grn_key);
void decode_float(const uchar *grn_key, uchar *mysql_key, uint data_size);
void encode_double(volatile double value, uint data_size, uchar *grn_key);
void decode_double(const uchar *grn_key, uchar *mysql_key, uint data_size);
void encode_reverse(const uchar *mysql_key, uint data_size, uchar *grn_key);
void decode_reverse(const uchar *grn_key, uchar *mysql_key, uint data_size);
void encode_blob(Field *field,
const uchar *mysql_key, uchar *grn_key, uint *data_size);
};
}
#endif // MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_
/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <mrn_mysql.h>
#include <mrn_mysql_compat.h>
/*
void *thd_alloc(MYSQL_THD thd, unsigned int size)
{
return thd->alloc(size);
}
*/
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011-2013 Kentoku SHIBA
Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mrn_parameters_parser.hpp"
#include <mrn_mysql_compat.h>
namespace mrn {
class Parameter {
public:
char *key_;
char *value_;
Parameter(const char *key, unsigned int key_length,
const char *value, unsigned int value_length)
: key_(my_strndup(key, key_length, MYF(0))),
value_(my_strndup(value, value_length, MYF(0))) {
};
~Parameter() {
if (key_) {
my_free(key_, MYF(0));
}
if (value_) {
my_free(value_, MYF(0));
}
};
};
ParametersParser::ParametersParser(const char *input,
unsigned int input_length)
: input_(input),
input_length_(input_length),
parameters_(NULL) {
}
ParametersParser::~ParametersParser() {
for (LIST *next = parameters_; next; next = next->next) {
Parameter *parameter = static_cast<Parameter *>(next->data);
delete parameter;
}
list_free(parameters_, false);
}
void ParametersParser::parse() {
const char *current = input_;
const char *end = input_ + input_length_;
for (; current < end; ++current) {
if (is_white_space(current[0])) {
continue;
}
const char *key = current;
unsigned int key_length = 0;
while (current < end &&
!is_white_space(current[0]) &&
current[0] != '\'' && current[0] != '"' && current[0] != ',') {
++current;
++key_length;
}
if (current == end) {
break;
}
while (current < end && is_white_space(current[0])) {
++current;
}
if (current == end) {
break;
}
current = parse_value(current, end, key, key_length);
if (!current) {
break;
}
while (current < end && is_white_space(current[0])) {
++current;
}
if (current == end) {
break;
}
if (current[0] != ',') {
// TODO: report error
break;
}
}
}
const char *ParametersParser::parse_value(const char *current,
const char *end,
const char *key,
unsigned int key_length) {
char quote = current[0];
if (quote != '\'' && quote != '"') {
// TODO: report error
return NULL;
}
++current;
bool found = false;
static const unsigned int max_value_length = 4096;
char value[max_value_length];
unsigned int value_length = 0;
for (; current < end && value_length < max_value_length; ++current) {
if (current[0] == quote) {
Parameter *parameter = new Parameter(key, key_length,
value, value_length);
list_push(parameters_, parameter);
found = true;
++current;
break;
}
switch (current[0]) {
case '\\':
if (current + 1 == end) {
break;
}
switch (current[1]) {
case 'b':
value[value_length] = '\b';
break;
case 'n':
value[value_length] = '\n';
break;
case 'r':
value[value_length] = '\r';
break;
case 't':
value[value_length] = '\t';
break;
default:
value[value_length] = current[1];
break;
}
break;
default:
value[value_length] = current[0];
break;
}
++value_length;
}
if (!found) {
// TODO: report error
}
return current;
}
const char *ParametersParser::operator[](const char *key) {
for (LIST *next = parameters_; next; next = next->next) {
Parameter *parameter = static_cast<Parameter *>(next->data);
if (strcasecmp(parameter->key_, key) == 0) {
return parameter->value_;
}
}
return NULL;
}
}
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011-2013 Kentoku SHIBA
Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_PARAMETERS_PARSER_HPP_
#define MRN_PARAMETERS_PARSER_HPP_
#include <mrn_mysql.h>
#include <my_list.h>
namespace mrn {
class ParametersParser {
public:
ParametersParser(const char *input, unsigned int input_length);
~ParametersParser();
void parse();
const char *operator[](const char *key);
private:
const char *input_;
unsigned int input_length_;
LIST *parameters_;
bool is_white_space(char character) {
switch (character) {
case ' ':
case '\r':
case '\n':
case '\t':
return true;
break;
default:
return false;
break;
}
};
const char *parse_value(const char *current, const char *end,
const char *key, unsigned int key_length);
};
}
#endif /* MRN_PARAMETERS_PARSER_HPP_ */
This diff is collapsed.
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2010 Tetsuro IKEDA
Copyright(C) 2010-2013 Kentoku SHIBA
Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MRN_PATH_MAPPER_HPP_
#define MRN_PATH_MAPPER_HPP_
#include <mrn_constants.hpp>
namespace mrn {
class PathMapper {
public:
static char *default_path_prefix;
static char *default_mysql_data_home_path;
PathMapper(const char *mysql_path,
const char *path_prefix=default_path_prefix,
const char *mysql_data_home_path=default_mysql_data_home_path);
const char *db_path();
const char *db_name();
const char *table_name();
const char *mysql_table_name();
private:
const char *mysql_path_;
const char *path_prefix_;
const char *mysql_data_home_path_;
char db_path_[MRN_MAX_PATH_SIZE];
char db_name_[MRN_MAX_PATH_SIZE];
char table_name_[MRN_MAX_PATH_SIZE];
char mysql_table_name_[MRN_MAX_PATH_SIZE];
};
}
#endif /* MRN_PATH_MAPPER_HPP_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
dist-hook:
if [ -n "`find mroonga -name '*.reject'`" ]; then \
echo "reject files exist"; \
exit 1; \
fi
EXTRA_DIST = \
mroonga
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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