2009-09-23 23:32:31 +02:00
|
|
|
#ifndef ITEM_GEOFUNC_INCLUDED
|
|
|
|
#define ITEM_GEOFUNC_INCLUDED
|
|
|
|
|
2016-04-20 15:25:55 +02:00
|
|
|
/* Copyright (c) 2000, 2016 Oracle and/or its affiliates.
|
|
|
|
Copyright (C) 2011, 2016, MariaDB
|
2003-05-30 12:22:34 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2006-12-23 20:17:15 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
2003-05-30 12:22:34 +02:00
|
|
|
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2013-03-19 15:53:48 +01:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
|
2003-05-30 12:22:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* This file defines all spatial functions */
|
|
|
|
|
2004-01-15 18:06:22 +01:00
|
|
|
#ifdef HAVE_SPATIAL
|
|
|
|
|
2005-05-04 15:05:56 +02:00
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
2003-05-30 12:22:34 +02:00
|
|
|
#pragma interface /* gcc class implementation */
|
|
|
|
#endif
|
|
|
|
|
2011-05-04 20:20:17 +02:00
|
|
|
#include "gcalc_slicescan.h"
|
2011-07-04 13:03:36 +02:00
|
|
|
#include "gcalc_tools.h"
|
2011-05-04 20:20:17 +02:00
|
|
|
|
2004-09-22 19:36:53 +02:00
|
|
|
class Item_geometry_func: public Item_str_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_geometry_func(THD *thd): Item_str_func(thd) {}
|
|
|
|
Item_geometry_func(THD *thd, Item *a): Item_str_func(thd, a) {}
|
|
|
|
Item_geometry_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
|
|
|
Item_geometry_func(THD *thd, Item *a, Item *b, Item *c):
|
|
|
|
Item_str_func(thd, a, b, c) {}
|
|
|
|
Item_geometry_func(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
|
2004-09-22 19:36:53 +02:00
|
|
|
void fix_length_and_dec();
|
2006-06-22 19:11:27 +02:00
|
|
|
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
|
2016-07-01 19:45:57 +02:00
|
|
|
Field *create_field_for_create_select(TABLE *table);
|
2004-09-22 19:36:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class Item_func_geometry_from_text: public Item_geometry_func
|
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_geometry_from_text(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
|
|
|
Item_func_geometry_from_text(THD *thd, Item *a, Item *srid):
|
|
|
|
Item_geometry_func(thd, a, srid) {}
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_geometryfromtext"; }
|
2003-05-30 12:22:34 +02:00
|
|
|
String *val_str(String *);
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_geometry_from_text>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2004-09-22 19:36:53 +02:00
|
|
|
class Item_func_geometry_from_wkb: public Item_geometry_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_geometry_from_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
|
|
|
Item_func_geometry_from_wkb(THD *thd, Item *a, Item *srid):
|
|
|
|
Item_geometry_func(thd, a, srid) {}
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_geometryfromwkb"; }
|
2003-05-30 12:22:34 +02:00
|
|
|
String *val_str(String *);
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_geometry_from_wkb>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2017-01-23 23:29:04 +01:00
|
|
|
|
|
|
|
class Item_func_geometry_from_json: public Item_geometry_func
|
|
|
|
{
|
|
|
|
String tmp_js;
|
|
|
|
public:
|
|
|
|
Item_func_geometry_from_json(THD *thd, Item *js): Item_geometry_func(thd, js) {}
|
|
|
|
Item_func_geometry_from_json(THD *thd, Item *js, Item *opt):
|
|
|
|
Item_geometry_func(thd, js, opt) {}
|
|
|
|
Item_func_geometry_from_json(THD *thd, Item *js, Item *opt, Item *srid):
|
|
|
|
Item_geometry_func(thd, js, opt, srid) {}
|
|
|
|
const char *func_name() const { return "st_geomfromgeojson"; }
|
|
|
|
String *val_str(String *);
|
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_geometry_from_json>(thd, mem_root, this); }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
WL#2649 Number-to-string conversions
added:
include/ctype_numconv.inc
mysql-test/include/ctype_numconv.inc
mysql-test/r/ctype_binary.result
mysql-test/t/ctype_binary.test
Adding tests
modified:
mysql-test/r/bigint.result
mysql-test/r/case.result
mysql-test/r/create.result
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_ucs.result
mysql-test/r/func_gconcat.result
mysql-test/r/func_str.result
mysql-test/r/metadata.result
mysql-test/r/ps_1general.result
mysql-test/r/ps_2myisam.result
mysql-test/r/ps_3innodb.result
mysql-test/r/ps_4heap.result
mysql-test/r/ps_5merge.result
mysql-test/r/show_check.result
mysql-test/r/type_datetime.result
mysql-test/r/type_ranges.result
mysql-test/r/union.result
mysql-test/suite/ndb/r/ps_7ndb.result
mysql-test/t/ctype_cp1251.test
mysql-test/t/ctype_latin1.test
mysql-test/t/ctype_ucs.test
mysql-test/t/func_str.test
Fixing tests
@ sql/field.cc
- Return str result using my_charset_numeric.
- Using real multi-byte aware str_to_XXX functions
to handle tricky charset values propely (e.g. UCS2)
@ sql/field.h
- Changing derivation of non-string field types to DERIVATION_NUMERIC.
- Changing binary() for numeric/datetime fields to always
return TRUE even if charset is not my_charset_bin. We need
this to keep ha_base_keytype() return HA_KEYTYPE_BINARY.
- Adding BINARY_FLAG into some fields, because it's not
being set automatically anymore with
"my_charset_bin to my_charset_numeric" change.
- Changing derivation for numeric/datetime datatypes to a weaker
value, to make "SELECT concat('string', field)" use character
set of the string literal for the result of the function.
@ sql/item.cc
- Implementing generic val_str_ascii().
- Using max_char_length() instead of direct read of max_length
to make "tricky" charsets like UCS2 work.
NOTE: in the future we'll possibly remove all direct reads of max_length
- Fixing Item_num::safe_charset_converter().
Previously it alligned binary string to
character string (for example by adding leading 0x00
when doing binary->UCS2 conversion). Now it just
converts from my_charset_numbner to "tocs".
- Using val_str_ascii() in Item::get_time() to make UCS2 arguments work.
- Other misc changes
@ sql/item.h
- Changing MY_COLL_CMP_CONV and MY_COLL_ALLOW_CONV to
bit operations instead of hard-coded bit masks.
- Addding new method DTCollation.set_numeric().
- Adding new methods to Item.
- Adding helper functions to make code look nicer:
agg_item_charsets_for_string_result()
agg_item_charsets_for_comparison()
- Changing charset for Item_num-derived items
from my_charset_bin to my_charset_numeric
(which is an alias for latin1).
@ sql/item_cmpfunc.cc
- Using new helper functions
- Other misc changes
@ sql/item_cmpfunc.h
- Fixing strcmp() to return max_length=2.
Previously it returned 1, which was wrong,
because it did not fit '-1'.
@ sql/item_func.cc
- Using new helper functions
- Other minor changes
@ sql/item_func.h
- Removing unused functions
- Adding helper functions
agg_arg_charsets_for_string_result()
agg_arg_charsets_for_comparison()
- Adding set_numeric() into constructors of numeric items.
- Using fix_length_and_charset() and fix_char_length()
instead of direct write to max_length.
@ sql/item_geofunc.cc
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when character_set_connection=ucs2).
@ sql/item_geofunc.h
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when @@character_set_connection=ucs2).
@ sql/item_strfunc.cc
- Implementing Item_str_func::val_str().
- Renaming val_str to val_str_ascii for some items,
to make them work with UCS2 properly.
- Using new helper functions
- All single-argument functions that expect string
result now call this method:
agg_arg_charsets_for_string_result(collation, args, 1);
This enables character set conversion to @@character_set_connection
in case of pure numeric input.
@ sql/item_strfunc.h
- Introducing Item_str_ascii_func - for functions
which return pure ASCII data, for performance purposes,
as well as for the cases when the old implementation
of val_str() was heavily 8-bit oriented and implementing
a UCS2-aware version is tricky.
@ sql/item_sum.cc
- Using new helper functions.
@ sql/item_timefunc.cc
- Using my_charset_numeric instead of my_charset_bin.
- Using fix_char_length(), fix_length_and_charset()
and fix_length_and_charset_datetime()
instead of direct write to max_length.
- Using tricky-charset aware function str_to_time_with_warn()
@ sql/item_timefunc.h
- Using new helper functions for charset and length initialization.
- Changing base class for Item_func_get_format() to make
it return UCS2 properly (when character_set_connection=ucs2).
@ sql/item_xmlfunc.cc
- Using new helper function
@ sql/my_decimal.cc
- Adding a new DECIMAL to CHAR converter
with real multibyte support (e.g. UCS2)
@ sql/mysql_priv.h
- Introducing a new derivation level for numeric/datetime data types.
- Adding macros for my_charset_numeric and MY_REPERTOIRE_NUMERIC.
- Adding prototypes for str_set_decimal()
- Adding prototypes for character-set aware str_to_xxx() functions.
@ sql/protocol.cc
- Changing charsetnr to "binary" client-side metadata for
numeric/datetime data types.
@ sql/time.cc
- Adding to_ascii() helper function, to convert a string
in any character set to ascii representation. In the
future can be extended to understand digits written
in various non-Latin word scripts.
- Adding real multy-byte character set aware versions for str_to_XXXX,
to make these these type of queries work correct:
INSERT INTO t1 SET datetime_column=ucs2_expression;
@ strings/ctype-ucs2.c
- endptr was not calculated correctly. INSERTing of UCS2
values into numeric columns returned warnings about
truncated wrong data.
2010-02-11 05:17:25 +01:00
|
|
|
class Item_func_as_wkt: public Item_str_ascii_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_as_wkt(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_astext"; }
|
WL#2649 Number-to-string conversions
added:
include/ctype_numconv.inc
mysql-test/include/ctype_numconv.inc
mysql-test/r/ctype_binary.result
mysql-test/t/ctype_binary.test
Adding tests
modified:
mysql-test/r/bigint.result
mysql-test/r/case.result
mysql-test/r/create.result
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_ucs.result
mysql-test/r/func_gconcat.result
mysql-test/r/func_str.result
mysql-test/r/metadata.result
mysql-test/r/ps_1general.result
mysql-test/r/ps_2myisam.result
mysql-test/r/ps_3innodb.result
mysql-test/r/ps_4heap.result
mysql-test/r/ps_5merge.result
mysql-test/r/show_check.result
mysql-test/r/type_datetime.result
mysql-test/r/type_ranges.result
mysql-test/r/union.result
mysql-test/suite/ndb/r/ps_7ndb.result
mysql-test/t/ctype_cp1251.test
mysql-test/t/ctype_latin1.test
mysql-test/t/ctype_ucs.test
mysql-test/t/func_str.test
Fixing tests
@ sql/field.cc
- Return str result using my_charset_numeric.
- Using real multi-byte aware str_to_XXX functions
to handle tricky charset values propely (e.g. UCS2)
@ sql/field.h
- Changing derivation of non-string field types to DERIVATION_NUMERIC.
- Changing binary() for numeric/datetime fields to always
return TRUE even if charset is not my_charset_bin. We need
this to keep ha_base_keytype() return HA_KEYTYPE_BINARY.
- Adding BINARY_FLAG into some fields, because it's not
being set automatically anymore with
"my_charset_bin to my_charset_numeric" change.
- Changing derivation for numeric/datetime datatypes to a weaker
value, to make "SELECT concat('string', field)" use character
set of the string literal for the result of the function.
@ sql/item.cc
- Implementing generic val_str_ascii().
- Using max_char_length() instead of direct read of max_length
to make "tricky" charsets like UCS2 work.
NOTE: in the future we'll possibly remove all direct reads of max_length
- Fixing Item_num::safe_charset_converter().
Previously it alligned binary string to
character string (for example by adding leading 0x00
when doing binary->UCS2 conversion). Now it just
converts from my_charset_numbner to "tocs".
- Using val_str_ascii() in Item::get_time() to make UCS2 arguments work.
- Other misc changes
@ sql/item.h
- Changing MY_COLL_CMP_CONV and MY_COLL_ALLOW_CONV to
bit operations instead of hard-coded bit masks.
- Addding new method DTCollation.set_numeric().
- Adding new methods to Item.
- Adding helper functions to make code look nicer:
agg_item_charsets_for_string_result()
agg_item_charsets_for_comparison()
- Changing charset for Item_num-derived items
from my_charset_bin to my_charset_numeric
(which is an alias for latin1).
@ sql/item_cmpfunc.cc
- Using new helper functions
- Other misc changes
@ sql/item_cmpfunc.h
- Fixing strcmp() to return max_length=2.
Previously it returned 1, which was wrong,
because it did not fit '-1'.
@ sql/item_func.cc
- Using new helper functions
- Other minor changes
@ sql/item_func.h
- Removing unused functions
- Adding helper functions
agg_arg_charsets_for_string_result()
agg_arg_charsets_for_comparison()
- Adding set_numeric() into constructors of numeric items.
- Using fix_length_and_charset() and fix_char_length()
instead of direct write to max_length.
@ sql/item_geofunc.cc
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when character_set_connection=ucs2).
@ sql/item_geofunc.h
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when @@character_set_connection=ucs2).
@ sql/item_strfunc.cc
- Implementing Item_str_func::val_str().
- Renaming val_str to val_str_ascii for some items,
to make them work with UCS2 properly.
- Using new helper functions
- All single-argument functions that expect string
result now call this method:
agg_arg_charsets_for_string_result(collation, args, 1);
This enables character set conversion to @@character_set_connection
in case of pure numeric input.
@ sql/item_strfunc.h
- Introducing Item_str_ascii_func - for functions
which return pure ASCII data, for performance purposes,
as well as for the cases when the old implementation
of val_str() was heavily 8-bit oriented and implementing
a UCS2-aware version is tricky.
@ sql/item_sum.cc
- Using new helper functions.
@ sql/item_timefunc.cc
- Using my_charset_numeric instead of my_charset_bin.
- Using fix_char_length(), fix_length_and_charset()
and fix_length_and_charset_datetime()
instead of direct write to max_length.
- Using tricky-charset aware function str_to_time_with_warn()
@ sql/item_timefunc.h
- Using new helper functions for charset and length initialization.
- Changing base class for Item_func_get_format() to make
it return UCS2 properly (when character_set_connection=ucs2).
@ sql/item_xmlfunc.cc
- Using new helper function
@ sql/my_decimal.cc
- Adding a new DECIMAL to CHAR converter
with real multibyte support (e.g. UCS2)
@ sql/mysql_priv.h
- Introducing a new derivation level for numeric/datetime data types.
- Adding macros for my_charset_numeric and MY_REPERTOIRE_NUMERIC.
- Adding prototypes for str_set_decimal()
- Adding prototypes for character-set aware str_to_xxx() functions.
@ sql/protocol.cc
- Changing charsetnr to "binary" client-side metadata for
numeric/datetime data types.
@ sql/time.cc
- Adding to_ascii() helper function, to convert a string
in any character set to ascii representation. In the
future can be extended to understand digits written
in various non-Latin word scripts.
- Adding real multy-byte character set aware versions for str_to_XXXX,
to make these these type of queries work correct:
INSERT INTO t1 SET datetime_column=ucs2_expression;
@ strings/ctype-ucs2.c
- endptr was not calculated correctly. INSERTing of UCS2
values into numeric columns returned warnings about
truncated wrong data.
2010-02-11 05:17:25 +01:00
|
|
|
String *val_str_ascii(String *);
|
2003-05-30 12:22:34 +02:00
|
|
|
void fix_length_and_dec();
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_as_wkt>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2004-09-22 19:36:53 +02:00
|
|
|
class Item_func_as_wkb: public Item_geometry_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_as_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_aswkb"; }
|
2003-05-30 12:22:34 +02:00
|
|
|
String *val_str(String *);
|
2006-06-22 19:11:27 +02:00
|
|
|
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_as_wkb>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2017-01-23 23:29:04 +01:00
|
|
|
|
|
|
|
class Item_func_as_geojson: public Item_str_ascii_func
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Item_func_as_geojson(THD *thd, Item *js): Item_str_ascii_func(thd, js) {}
|
|
|
|
Item_func_as_geojson(THD *thd, Item *js, Item *max_dec_digits):
|
|
|
|
Item_str_ascii_func(thd, js, max_dec_digits) {}
|
|
|
|
Item_func_as_geojson(THD *thd, Item *js, Item *max_dec_digits, Item *opt):
|
|
|
|
Item_str_ascii_func(thd, js, max_dec_digits, opt) {}
|
|
|
|
const char *func_name() const { return "st_asgeojson"; }
|
|
|
|
void fix_length_and_dec();
|
|
|
|
String *val_str_ascii(String *);
|
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_as_geojson>(thd, mem_root, this); }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
WL#2649 Number-to-string conversions
added:
include/ctype_numconv.inc
mysql-test/include/ctype_numconv.inc
mysql-test/r/ctype_binary.result
mysql-test/t/ctype_binary.test
Adding tests
modified:
mysql-test/r/bigint.result
mysql-test/r/case.result
mysql-test/r/create.result
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_ucs.result
mysql-test/r/func_gconcat.result
mysql-test/r/func_str.result
mysql-test/r/metadata.result
mysql-test/r/ps_1general.result
mysql-test/r/ps_2myisam.result
mysql-test/r/ps_3innodb.result
mysql-test/r/ps_4heap.result
mysql-test/r/ps_5merge.result
mysql-test/r/show_check.result
mysql-test/r/type_datetime.result
mysql-test/r/type_ranges.result
mysql-test/r/union.result
mysql-test/suite/ndb/r/ps_7ndb.result
mysql-test/t/ctype_cp1251.test
mysql-test/t/ctype_latin1.test
mysql-test/t/ctype_ucs.test
mysql-test/t/func_str.test
Fixing tests
@ sql/field.cc
- Return str result using my_charset_numeric.
- Using real multi-byte aware str_to_XXX functions
to handle tricky charset values propely (e.g. UCS2)
@ sql/field.h
- Changing derivation of non-string field types to DERIVATION_NUMERIC.
- Changing binary() for numeric/datetime fields to always
return TRUE even if charset is not my_charset_bin. We need
this to keep ha_base_keytype() return HA_KEYTYPE_BINARY.
- Adding BINARY_FLAG into some fields, because it's not
being set automatically anymore with
"my_charset_bin to my_charset_numeric" change.
- Changing derivation for numeric/datetime datatypes to a weaker
value, to make "SELECT concat('string', field)" use character
set of the string literal for the result of the function.
@ sql/item.cc
- Implementing generic val_str_ascii().
- Using max_char_length() instead of direct read of max_length
to make "tricky" charsets like UCS2 work.
NOTE: in the future we'll possibly remove all direct reads of max_length
- Fixing Item_num::safe_charset_converter().
Previously it alligned binary string to
character string (for example by adding leading 0x00
when doing binary->UCS2 conversion). Now it just
converts from my_charset_numbner to "tocs".
- Using val_str_ascii() in Item::get_time() to make UCS2 arguments work.
- Other misc changes
@ sql/item.h
- Changing MY_COLL_CMP_CONV and MY_COLL_ALLOW_CONV to
bit operations instead of hard-coded bit masks.
- Addding new method DTCollation.set_numeric().
- Adding new methods to Item.
- Adding helper functions to make code look nicer:
agg_item_charsets_for_string_result()
agg_item_charsets_for_comparison()
- Changing charset for Item_num-derived items
from my_charset_bin to my_charset_numeric
(which is an alias for latin1).
@ sql/item_cmpfunc.cc
- Using new helper functions
- Other misc changes
@ sql/item_cmpfunc.h
- Fixing strcmp() to return max_length=2.
Previously it returned 1, which was wrong,
because it did not fit '-1'.
@ sql/item_func.cc
- Using new helper functions
- Other minor changes
@ sql/item_func.h
- Removing unused functions
- Adding helper functions
agg_arg_charsets_for_string_result()
agg_arg_charsets_for_comparison()
- Adding set_numeric() into constructors of numeric items.
- Using fix_length_and_charset() and fix_char_length()
instead of direct write to max_length.
@ sql/item_geofunc.cc
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when character_set_connection=ucs2).
@ sql/item_geofunc.h
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when @@character_set_connection=ucs2).
@ sql/item_strfunc.cc
- Implementing Item_str_func::val_str().
- Renaming val_str to val_str_ascii for some items,
to make them work with UCS2 properly.
- Using new helper functions
- All single-argument functions that expect string
result now call this method:
agg_arg_charsets_for_string_result(collation, args, 1);
This enables character set conversion to @@character_set_connection
in case of pure numeric input.
@ sql/item_strfunc.h
- Introducing Item_str_ascii_func - for functions
which return pure ASCII data, for performance purposes,
as well as for the cases when the old implementation
of val_str() was heavily 8-bit oriented and implementing
a UCS2-aware version is tricky.
@ sql/item_sum.cc
- Using new helper functions.
@ sql/item_timefunc.cc
- Using my_charset_numeric instead of my_charset_bin.
- Using fix_char_length(), fix_length_and_charset()
and fix_length_and_charset_datetime()
instead of direct write to max_length.
- Using tricky-charset aware function str_to_time_with_warn()
@ sql/item_timefunc.h
- Using new helper functions for charset and length initialization.
- Changing base class for Item_func_get_format() to make
it return UCS2 properly (when character_set_connection=ucs2).
@ sql/item_xmlfunc.cc
- Using new helper function
@ sql/my_decimal.cc
- Adding a new DECIMAL to CHAR converter
with real multibyte support (e.g. UCS2)
@ sql/mysql_priv.h
- Introducing a new derivation level for numeric/datetime data types.
- Adding macros for my_charset_numeric and MY_REPERTOIRE_NUMERIC.
- Adding prototypes for str_set_decimal()
- Adding prototypes for character-set aware str_to_xxx() functions.
@ sql/protocol.cc
- Changing charsetnr to "binary" client-side metadata for
numeric/datetime data types.
@ sql/time.cc
- Adding to_ascii() helper function, to convert a string
in any character set to ascii representation. In the
future can be extended to understand digits written
in various non-Latin word scripts.
- Adding real multy-byte character set aware versions for str_to_XXXX,
to make these these type of queries work correct:
INSERT INTO t1 SET datetime_column=ucs2_expression;
@ strings/ctype-ucs2.c
- endptr was not calculated correctly. INSERTing of UCS2
values into numeric columns returned warnings about
truncated wrong data.
2010-02-11 05:17:25 +01:00
|
|
|
class Item_func_geometry_type: public Item_str_ascii_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_geometry_type(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
|
WL#2649 Number-to-string conversions
added:
include/ctype_numconv.inc
mysql-test/include/ctype_numconv.inc
mysql-test/r/ctype_binary.result
mysql-test/t/ctype_binary.test
Adding tests
modified:
mysql-test/r/bigint.result
mysql-test/r/case.result
mysql-test/r/create.result
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_ucs.result
mysql-test/r/func_gconcat.result
mysql-test/r/func_str.result
mysql-test/r/metadata.result
mysql-test/r/ps_1general.result
mysql-test/r/ps_2myisam.result
mysql-test/r/ps_3innodb.result
mysql-test/r/ps_4heap.result
mysql-test/r/ps_5merge.result
mysql-test/r/show_check.result
mysql-test/r/type_datetime.result
mysql-test/r/type_ranges.result
mysql-test/r/union.result
mysql-test/suite/ndb/r/ps_7ndb.result
mysql-test/t/ctype_cp1251.test
mysql-test/t/ctype_latin1.test
mysql-test/t/ctype_ucs.test
mysql-test/t/func_str.test
Fixing tests
@ sql/field.cc
- Return str result using my_charset_numeric.
- Using real multi-byte aware str_to_XXX functions
to handle tricky charset values propely (e.g. UCS2)
@ sql/field.h
- Changing derivation of non-string field types to DERIVATION_NUMERIC.
- Changing binary() for numeric/datetime fields to always
return TRUE even if charset is not my_charset_bin. We need
this to keep ha_base_keytype() return HA_KEYTYPE_BINARY.
- Adding BINARY_FLAG into some fields, because it's not
being set automatically anymore with
"my_charset_bin to my_charset_numeric" change.
- Changing derivation for numeric/datetime datatypes to a weaker
value, to make "SELECT concat('string', field)" use character
set of the string literal for the result of the function.
@ sql/item.cc
- Implementing generic val_str_ascii().
- Using max_char_length() instead of direct read of max_length
to make "tricky" charsets like UCS2 work.
NOTE: in the future we'll possibly remove all direct reads of max_length
- Fixing Item_num::safe_charset_converter().
Previously it alligned binary string to
character string (for example by adding leading 0x00
when doing binary->UCS2 conversion). Now it just
converts from my_charset_numbner to "tocs".
- Using val_str_ascii() in Item::get_time() to make UCS2 arguments work.
- Other misc changes
@ sql/item.h
- Changing MY_COLL_CMP_CONV and MY_COLL_ALLOW_CONV to
bit operations instead of hard-coded bit masks.
- Addding new method DTCollation.set_numeric().
- Adding new methods to Item.
- Adding helper functions to make code look nicer:
agg_item_charsets_for_string_result()
agg_item_charsets_for_comparison()
- Changing charset for Item_num-derived items
from my_charset_bin to my_charset_numeric
(which is an alias for latin1).
@ sql/item_cmpfunc.cc
- Using new helper functions
- Other misc changes
@ sql/item_cmpfunc.h
- Fixing strcmp() to return max_length=2.
Previously it returned 1, which was wrong,
because it did not fit '-1'.
@ sql/item_func.cc
- Using new helper functions
- Other minor changes
@ sql/item_func.h
- Removing unused functions
- Adding helper functions
agg_arg_charsets_for_string_result()
agg_arg_charsets_for_comparison()
- Adding set_numeric() into constructors of numeric items.
- Using fix_length_and_charset() and fix_char_length()
instead of direct write to max_length.
@ sql/item_geofunc.cc
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when character_set_connection=ucs2).
@ sql/item_geofunc.h
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when @@character_set_connection=ucs2).
@ sql/item_strfunc.cc
- Implementing Item_str_func::val_str().
- Renaming val_str to val_str_ascii for some items,
to make them work with UCS2 properly.
- Using new helper functions
- All single-argument functions that expect string
result now call this method:
agg_arg_charsets_for_string_result(collation, args, 1);
This enables character set conversion to @@character_set_connection
in case of pure numeric input.
@ sql/item_strfunc.h
- Introducing Item_str_ascii_func - for functions
which return pure ASCII data, for performance purposes,
as well as for the cases when the old implementation
of val_str() was heavily 8-bit oriented and implementing
a UCS2-aware version is tricky.
@ sql/item_sum.cc
- Using new helper functions.
@ sql/item_timefunc.cc
- Using my_charset_numeric instead of my_charset_bin.
- Using fix_char_length(), fix_length_and_charset()
and fix_length_and_charset_datetime()
instead of direct write to max_length.
- Using tricky-charset aware function str_to_time_with_warn()
@ sql/item_timefunc.h
- Using new helper functions for charset and length initialization.
- Changing base class for Item_func_get_format() to make
it return UCS2 properly (when character_set_connection=ucs2).
@ sql/item_xmlfunc.cc
- Using new helper function
@ sql/my_decimal.cc
- Adding a new DECIMAL to CHAR converter
with real multibyte support (e.g. UCS2)
@ sql/mysql_priv.h
- Introducing a new derivation level for numeric/datetime data types.
- Adding macros for my_charset_numeric and MY_REPERTOIRE_NUMERIC.
- Adding prototypes for str_set_decimal()
- Adding prototypes for character-set aware str_to_xxx() functions.
@ sql/protocol.cc
- Changing charsetnr to "binary" client-side metadata for
numeric/datetime data types.
@ sql/time.cc
- Adding to_ascii() helper function, to convert a string
in any character set to ascii representation. In the
future can be extended to understand digits written
in various non-Latin word scripts.
- Adding real multy-byte character set aware versions for str_to_XXXX,
to make these these type of queries work correct:
INSERT INTO t1 SET datetime_column=ucs2_expression;
@ strings/ctype-ucs2.c
- endptr was not calculated correctly. INSERTing of UCS2
values into numeric columns returned warnings about
truncated wrong data.
2010-02-11 05:17:25 +01:00
|
|
|
String *val_str_ascii(String *);
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_geometrytype"; }
|
2003-05-30 12:22:34 +02:00
|
|
|
void fix_length_and_dec()
|
|
|
|
{
|
WL#2649 Number-to-string conversions
added:
include/ctype_numconv.inc
mysql-test/include/ctype_numconv.inc
mysql-test/r/ctype_binary.result
mysql-test/t/ctype_binary.test
Adding tests
modified:
mysql-test/r/bigint.result
mysql-test/r/case.result
mysql-test/r/create.result
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_ucs.result
mysql-test/r/func_gconcat.result
mysql-test/r/func_str.result
mysql-test/r/metadata.result
mysql-test/r/ps_1general.result
mysql-test/r/ps_2myisam.result
mysql-test/r/ps_3innodb.result
mysql-test/r/ps_4heap.result
mysql-test/r/ps_5merge.result
mysql-test/r/show_check.result
mysql-test/r/type_datetime.result
mysql-test/r/type_ranges.result
mysql-test/r/union.result
mysql-test/suite/ndb/r/ps_7ndb.result
mysql-test/t/ctype_cp1251.test
mysql-test/t/ctype_latin1.test
mysql-test/t/ctype_ucs.test
mysql-test/t/func_str.test
Fixing tests
@ sql/field.cc
- Return str result using my_charset_numeric.
- Using real multi-byte aware str_to_XXX functions
to handle tricky charset values propely (e.g. UCS2)
@ sql/field.h
- Changing derivation of non-string field types to DERIVATION_NUMERIC.
- Changing binary() for numeric/datetime fields to always
return TRUE even if charset is not my_charset_bin. We need
this to keep ha_base_keytype() return HA_KEYTYPE_BINARY.
- Adding BINARY_FLAG into some fields, because it's not
being set automatically anymore with
"my_charset_bin to my_charset_numeric" change.
- Changing derivation for numeric/datetime datatypes to a weaker
value, to make "SELECT concat('string', field)" use character
set of the string literal for the result of the function.
@ sql/item.cc
- Implementing generic val_str_ascii().
- Using max_char_length() instead of direct read of max_length
to make "tricky" charsets like UCS2 work.
NOTE: in the future we'll possibly remove all direct reads of max_length
- Fixing Item_num::safe_charset_converter().
Previously it alligned binary string to
character string (for example by adding leading 0x00
when doing binary->UCS2 conversion). Now it just
converts from my_charset_numbner to "tocs".
- Using val_str_ascii() in Item::get_time() to make UCS2 arguments work.
- Other misc changes
@ sql/item.h
- Changing MY_COLL_CMP_CONV and MY_COLL_ALLOW_CONV to
bit operations instead of hard-coded bit masks.
- Addding new method DTCollation.set_numeric().
- Adding new methods to Item.
- Adding helper functions to make code look nicer:
agg_item_charsets_for_string_result()
agg_item_charsets_for_comparison()
- Changing charset for Item_num-derived items
from my_charset_bin to my_charset_numeric
(which is an alias for latin1).
@ sql/item_cmpfunc.cc
- Using new helper functions
- Other misc changes
@ sql/item_cmpfunc.h
- Fixing strcmp() to return max_length=2.
Previously it returned 1, which was wrong,
because it did not fit '-1'.
@ sql/item_func.cc
- Using new helper functions
- Other minor changes
@ sql/item_func.h
- Removing unused functions
- Adding helper functions
agg_arg_charsets_for_string_result()
agg_arg_charsets_for_comparison()
- Adding set_numeric() into constructors of numeric items.
- Using fix_length_and_charset() and fix_char_length()
instead of direct write to max_length.
@ sql/item_geofunc.cc
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when character_set_connection=ucs2).
@ sql/item_geofunc.h
- Changing class for Item_func_geometry_type and
Item_func_as_wkt from Item_str_func to
Item_str_ascii_func, to make them return UCS2 result
properly (when @@character_set_connection=ucs2).
@ sql/item_strfunc.cc
- Implementing Item_str_func::val_str().
- Renaming val_str to val_str_ascii for some items,
to make them work with UCS2 properly.
- Using new helper functions
- All single-argument functions that expect string
result now call this method:
agg_arg_charsets_for_string_result(collation, args, 1);
This enables character set conversion to @@character_set_connection
in case of pure numeric input.
@ sql/item_strfunc.h
- Introducing Item_str_ascii_func - for functions
which return pure ASCII data, for performance purposes,
as well as for the cases when the old implementation
of val_str() was heavily 8-bit oriented and implementing
a UCS2-aware version is tricky.
@ sql/item_sum.cc
- Using new helper functions.
@ sql/item_timefunc.cc
- Using my_charset_numeric instead of my_charset_bin.
- Using fix_char_length(), fix_length_and_charset()
and fix_length_and_charset_datetime()
instead of direct write to max_length.
- Using tricky-charset aware function str_to_time_with_warn()
@ sql/item_timefunc.h
- Using new helper functions for charset and length initialization.
- Changing base class for Item_func_get_format() to make
it return UCS2 properly (when character_set_connection=ucs2).
@ sql/item_xmlfunc.cc
- Using new helper function
@ sql/my_decimal.cc
- Adding a new DECIMAL to CHAR converter
with real multibyte support (e.g. UCS2)
@ sql/mysql_priv.h
- Introducing a new derivation level for numeric/datetime data types.
- Adding macros for my_charset_numeric and MY_REPERTOIRE_NUMERIC.
- Adding prototypes for str_set_decimal()
- Adding prototypes for character-set aware str_to_xxx() functions.
@ sql/protocol.cc
- Changing charsetnr to "binary" client-side metadata for
numeric/datetime data types.
@ sql/time.cc
- Adding to_ascii() helper function, to convert a string
in any character set to ascii representation. In the
future can be extended to understand digits written
in various non-Latin word scripts.
- Adding real multy-byte character set aware versions for str_to_XXXX,
to make these these type of queries work correct:
INSERT INTO t1 SET datetime_column=ucs2_expression;
@ strings/ctype-ucs2.c
- endptr was not calculated correctly. INSERTing of UCS2
values into numeric columns returned warnings about
truncated wrong data.
2010-02-11 05:17:25 +01:00
|
|
|
// "GeometryCollection" is the longest
|
|
|
|
fix_length_and_charset(20, default_charset());
|
2013-09-25 14:30:13 +02:00
|
|
|
maybe_null= 1;
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_geometry_type>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2014-11-27 21:29:37 +01:00
|
|
|
|
|
|
|
// #define HEAVY_CONVEX_HULL
|
|
|
|
class Item_func_convexhull: public Item_geometry_func
|
|
|
|
{
|
|
|
|
class ch_node: public Gcalc_dyn_list::Item
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
const Gcalc_heap::Info *pi;
|
|
|
|
ch_node *prev;
|
|
|
|
Gcalc_dyn_list::Item *next;
|
|
|
|
ch_node *get_next() { return (ch_node *) next; }
|
|
|
|
};
|
|
|
|
|
|
|
|
Gcalc_heap collector;
|
|
|
|
Gcalc_function func;
|
|
|
|
Gcalc_dyn_list res_heap;
|
|
|
|
|
|
|
|
Gcalc_result_receiver res_receiver;
|
|
|
|
String tmp_value;
|
|
|
|
#ifdef HEAVY_CONVEX_HULL
|
|
|
|
Gcalc_scan_iterator scan_it;
|
|
|
|
#endif /*HEAVY_CONVEX_HULL*/
|
|
|
|
ch_node *new_ch_node() { return (ch_node *) res_heap.new_item(); }
|
|
|
|
int add_node_to_line(ch_node **p_cur, int dir, const Gcalc_heap::Info *pi);
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_convexhull(THD *thd, Item *a): Item_geometry_func(thd, a),
|
2014-11-27 21:29:37 +01:00
|
|
|
res_heap(8192, sizeof(ch_node))
|
|
|
|
{}
|
|
|
|
const char *func_name() const { return "st_convexhull"; }
|
|
|
|
String *val_str(String *);
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_convexhull>(thd, mem_root, this); }
|
2014-11-27 21:29:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-09-22 19:36:53 +02:00
|
|
|
class Item_func_centroid: public Item_geometry_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_centroid(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_centroid"; }
|
2003-05-30 12:22:34 +02:00
|
|
|
String *val_str(String *);
|
2007-10-04 09:01:28 +02:00
|
|
|
Field::geometry_type get_geometry_type() const;
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_centroid>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2004-09-22 19:36:53 +02:00
|
|
|
class Item_func_envelope: public Item_geometry_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_envelope(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_envelope"; }
|
2003-05-30 12:22:34 +02:00
|
|
|
String *val_str(String *);
|
2007-10-04 09:01:28 +02:00
|
|
|
Field::geometry_type get_geometry_type() const;
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_envelope>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2014-11-27 21:29:37 +01:00
|
|
|
|
|
|
|
class Item_func_boundary: public Item_geometry_func
|
|
|
|
{
|
|
|
|
class Transporter : public Gcalc_shape_transporter
|
|
|
|
{
|
|
|
|
Gcalc_result_receiver *m_receiver;
|
|
|
|
uint n_points;
|
|
|
|
Gcalc_function::shape_type current_type;
|
|
|
|
double last_x, last_y;
|
|
|
|
public:
|
|
|
|
Transporter(Gcalc_result_receiver *receiver) :
|
|
|
|
Gcalc_shape_transporter(NULL), m_receiver(receiver)
|
|
|
|
{}
|
|
|
|
int single_point(double x, double y);
|
|
|
|
int start_line();
|
|
|
|
int complete_line();
|
|
|
|
int start_poly();
|
|
|
|
int complete_poly();
|
|
|
|
int start_ring();
|
|
|
|
int complete_ring();
|
|
|
|
int add_point(double x, double y);
|
|
|
|
|
|
|
|
int start_collection(int n_objects);
|
|
|
|
};
|
|
|
|
Gcalc_result_receiver res_receiver;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_boundary(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
2014-11-27 21:29:37 +01:00
|
|
|
const char *func_name() const { return "st_boundary"; }
|
|
|
|
String *val_str(String *);
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_boundary>(thd, mem_root, this); }
|
2014-11-27 21:29:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-09-22 19:36:53 +02:00
|
|
|
class Item_func_point: public Item_geometry_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_point(THD *thd, Item *a, Item *b): Item_geometry_func(thd, a, b) {}
|
|
|
|
Item_func_point(THD *thd, Item *a, Item *b, Item *srid):
|
|
|
|
Item_geometry_func(thd, a, b, srid) {}
|
2015-04-28 12:31:49 +02:00
|
|
|
const char *func_name() const { return "point"; }
|
2003-05-30 12:22:34 +02:00
|
|
|
String *val_str(String *);
|
2007-10-04 09:01:28 +02:00
|
|
|
Field::geometry_type get_geometry_type() const;
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_point>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2004-09-22 19:36:53 +02:00
|
|
|
class Item_func_spatial_decomp: public Item_geometry_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
enum Functype decomp_func;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_spatial_decomp(THD *thd, Item *a, Item_func::Functype ft):
|
|
|
|
Item_geometry_func(thd, a) { decomp_func = ft; }
|
2003-05-30 12:22:34 +02:00
|
|
|
const char *func_name() const
|
|
|
|
{
|
|
|
|
switch (decomp_func)
|
|
|
|
{
|
|
|
|
case SP_STARTPOINT:
|
2011-05-04 20:20:17 +02:00
|
|
|
return "st_startpoint";
|
2003-05-30 12:22:34 +02:00
|
|
|
case SP_ENDPOINT:
|
2011-05-04 20:20:17 +02:00
|
|
|
return "st_endpoint";
|
2003-05-30 12:22:34 +02:00
|
|
|
case SP_EXTERIORRING:
|
2011-05-04 20:20:17 +02:00
|
|
|
return "st_exteriorring";
|
2003-05-30 12:22:34 +02:00
|
|
|
default:
|
2003-10-12 16:56:05 +02:00
|
|
|
DBUG_ASSERT(0); // Should never happened
|
2003-05-30 12:22:34 +02:00
|
|
|
return "spatial_decomp_unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String *val_str(String *);
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_spatial_decomp>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2004-09-22 19:36:53 +02:00
|
|
|
class Item_func_spatial_decomp_n: public Item_geometry_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
enum Functype decomp_func_n;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_spatial_decomp_n(THD *thd, Item *a, Item *b, Item_func::Functype ft):
|
|
|
|
Item_geometry_func(thd, a, b) { decomp_func_n = ft; }
|
2003-05-30 12:22:34 +02:00
|
|
|
const char *func_name() const
|
|
|
|
{
|
|
|
|
switch (decomp_func_n)
|
|
|
|
{
|
|
|
|
case SP_POINTN:
|
2011-05-04 20:20:17 +02:00
|
|
|
return "st_pointn";
|
2003-05-30 12:22:34 +02:00
|
|
|
case SP_GEOMETRYN:
|
2011-05-04 20:20:17 +02:00
|
|
|
return "st_geometryn";
|
2003-05-30 12:22:34 +02:00
|
|
|
case SP_INTERIORRINGN:
|
2011-05-04 20:20:17 +02:00
|
|
|
return "st_interiorringn";
|
2003-05-30 12:22:34 +02:00
|
|
|
default:
|
2003-10-12 16:56:05 +02:00
|
|
|
DBUG_ASSERT(0); // Should never happened
|
2003-05-30 12:22:34 +02:00
|
|
|
return "spatial_decomp_n_unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String *val_str(String *);
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_spatial_decomp_n>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2004-09-22 19:36:53 +02:00
|
|
|
class Item_func_spatial_collection: public Item_geometry_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
enum Geometry::wkbType coll_type;
|
|
|
|
enum Geometry::wkbType item_type;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_spatial_collection(THD *thd,
|
2003-05-30 12:22:34 +02:00
|
|
|
List<Item> &list, enum Geometry::wkbType ct, enum Geometry::wkbType it):
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_geometry_func(thd, list)
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
coll_type=ct;
|
|
|
|
item_type=it;
|
|
|
|
}
|
|
|
|
String *val_str(String *);
|
2010-09-07 11:37:46 +02:00
|
|
|
void fix_length_and_dec()
|
|
|
|
{
|
2011-01-12 14:02:41 +01:00
|
|
|
Item_geometry_func::fix_length_and_dec();
|
2010-09-09 11:40:17 +02:00
|
|
|
for (unsigned int i= 0; i < arg_count; ++i)
|
2010-09-07 11:37:46 +02:00
|
|
|
{
|
2010-09-09 11:40:17 +02:00
|
|
|
if (args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY)
|
2010-09-07 11:37:46 +02:00
|
|
|
{
|
|
|
|
String str;
|
2016-01-07 12:53:18 +01:00
|
|
|
args[i]->print(&str, QT_NO_DATA_EXPANSION);
|
2010-09-09 11:40:17 +02:00
|
|
|
str.append('\0');
|
|
|
|
my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "non geometric",
|
|
|
|
str.ptr());
|
2010-09-07 11:37:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-06 22:25:39 +01:00
|
|
|
const char *func_name() const { return "geometrycollection"; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_spatial_collection>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2011-05-04 20:20:17 +02:00
|
|
|
|
2003-05-30 12:22:34 +02:00
|
|
|
/*
|
|
|
|
Spatial relations
|
|
|
|
*/
|
|
|
|
|
2015-10-04 07:37:57 +02:00
|
|
|
class Item_func_spatial_rel: public Item_bool_func2_with_rev
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
2015-05-05 07:30:17 +02:00
|
|
|
protected:
|
2003-05-30 12:22:34 +02:00
|
|
|
enum Functype spatial_rel;
|
2015-05-05 07:30:17 +02:00
|
|
|
String tmp_value1, tmp_value2;
|
2015-08-13 12:25:51 +02:00
|
|
|
SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field,
|
|
|
|
KEY_PART *key_part,
|
|
|
|
Item_func::Functype type, Item *value);
|
2003-05-30 12:22:34 +02:00
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_spatial_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
|
2015-10-04 07:37:57 +02:00
|
|
|
Item_bool_func2_with_rev(thd, a, b), spatial_rel(sp_rel)
|
2015-09-11 21:26:02 +02:00
|
|
|
{
|
|
|
|
maybe_null= true;
|
|
|
|
}
|
2015-05-05 07:30:17 +02:00
|
|
|
enum Functype functype() const { return spatial_rel; }
|
2003-05-30 12:22:34 +02:00
|
|
|
enum Functype rev_functype() const { return spatial_rel; }
|
2011-05-04 20:20:17 +02:00
|
|
|
bool is_null() { (void) val_int(); return null_value; }
|
2015-05-19 15:03:18 +02:00
|
|
|
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
|
|
|
|
uint *and_level, table_map usable_tables,
|
|
|
|
SARGABLE_PARAM **sargables)
|
|
|
|
{
|
|
|
|
return add_key_fields_optimize_op(join, key_fields, and_level,
|
|
|
|
usable_tables, sargables, false);
|
|
|
|
}
|
2016-06-29 21:10:35 +02:00
|
|
|
bool need_parentheses_in_default() { return false; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *build_clone(THD *thd, MEM_ROOT *mem_root) { return 0; }
|
2011-05-04 20:20:17 +02:00
|
|
|
};
|
|
|
|
|
2008-02-22 11:30:33 +01:00
|
|
|
|
2015-05-05 07:30:17 +02:00
|
|
|
class Item_func_spatial_mbr_rel: public Item_func_spatial_rel
|
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_spatial_mbr_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
|
|
|
|
Item_func_spatial_rel(thd, a, b, sp_rel)
|
2015-05-05 07:30:17 +02:00
|
|
|
{ }
|
|
|
|
longlong val_int();
|
|
|
|
const char *func_name() const;
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_spatial_mbr_rel>(thd, mem_root, this); }
|
2015-05-05 07:30:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Item_func_spatial_precise_rel: public Item_func_spatial_rel
|
2011-05-04 20:20:17 +02:00
|
|
|
{
|
|
|
|
Gcalc_heap collector;
|
|
|
|
Gcalc_scan_iterator scan_it;
|
|
|
|
Gcalc_function func;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_spatial_precise_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
|
|
|
|
Item_func_spatial_rel(thd, a, b, sp_rel), collector()
|
2015-05-05 07:30:17 +02:00
|
|
|
{ }
|
2011-05-04 20:20:17 +02:00
|
|
|
longlong val_int();
|
|
|
|
const char *func_name() const;
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_spatial_precise_rel>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2011-05-04 20:20:17 +02:00
|
|
|
|
2015-06-26 13:42:49 +02:00
|
|
|
class Item_func_spatial_relate: public Item_bool_func
|
|
|
|
{
|
|
|
|
Gcalc_heap collector;
|
|
|
|
Gcalc_scan_iterator scan_it;
|
|
|
|
Gcalc_function func;
|
|
|
|
String tmp_value1, tmp_value2, tmp_matrix;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_spatial_relate(THD *thd, Item *a, Item *b, Item *matrix):
|
|
|
|
Item_bool_func(thd, a, b, matrix)
|
2015-06-26 13:42:49 +02:00
|
|
|
{ }
|
|
|
|
longlong val_int();
|
|
|
|
const char *func_name() const { return "st_relate"; }
|
2016-06-29 21:10:35 +02:00
|
|
|
bool need_parentheses_in_default() { return false; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_spatial_relate>(thd, mem_root, this); }
|
2015-06-26 13:42:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-05-04 20:20:17 +02:00
|
|
|
/*
|
|
|
|
Spatial operations
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Item_func_spatial_operation: public Item_geometry_func
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Gcalc_function::op_type spatial_op;
|
|
|
|
Gcalc_heap collector;
|
|
|
|
Gcalc_function func;
|
|
|
|
|
|
|
|
Gcalc_result_receiver res_receiver;
|
|
|
|
Gcalc_operation_reducer operation;
|
|
|
|
String tmp_value1,tmp_value2;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_spatial_operation(THD *thd, Item *a,Item *b,
|
|
|
|
Gcalc_function::op_type sp_op):
|
|
|
|
Item_geometry_func(thd, a, b), spatial_op(sp_op)
|
2011-05-04 20:20:17 +02:00
|
|
|
{}
|
|
|
|
virtual ~Item_func_spatial_operation();
|
|
|
|
String *val_str(String *);
|
|
|
|
const char *func_name() const;
|
|
|
|
virtual inline void print(String *str, enum_query_type query_type)
|
|
|
|
{
|
|
|
|
Item_func::print(str, query_type);
|
|
|
|
}
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_spatial_operation>(thd, mem_root, this); }
|
2011-05-04 20:20:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Item_func_buffer: public Item_geometry_func
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
class Transporter : public Gcalc_operation_transporter
|
|
|
|
{
|
|
|
|
int m_npoints;
|
|
|
|
double m_d;
|
|
|
|
double x1,y1,x2,y2;
|
|
|
|
double x00,y00,x01,y01;
|
|
|
|
int add_edge_buffer(double x3, double y3, bool round_p1, bool round_p2);
|
|
|
|
int add_last_edge_buffer();
|
|
|
|
int add_point_buffer(double x, double y);
|
|
|
|
int complete();
|
|
|
|
int m_nshapes;
|
2011-07-04 13:03:36 +02:00
|
|
|
Gcalc_function::op_type buffer_op;
|
|
|
|
int last_shape_pos;
|
|
|
|
bool skip_line;
|
|
|
|
|
|
|
|
public:
|
2011-05-04 20:20:17 +02:00
|
|
|
Transporter(Gcalc_function *fn, Gcalc_heap *heap, double d) :
|
2011-07-04 13:03:36 +02:00
|
|
|
Gcalc_operation_transporter(fn, heap), m_npoints(0), m_d(d),
|
|
|
|
m_nshapes(0), buffer_op((d > 0.0) ? Gcalc_function::op_union :
|
|
|
|
Gcalc_function::op_difference),
|
|
|
|
skip_line(FALSE)
|
2011-05-04 20:20:17 +02:00
|
|
|
{}
|
|
|
|
int single_point(double x, double y);
|
|
|
|
int start_line();
|
|
|
|
int complete_line();
|
|
|
|
int start_poly();
|
2011-07-04 13:03:36 +02:00
|
|
|
int complete_poly();
|
2011-05-04 20:20:17 +02:00
|
|
|
int start_ring();
|
|
|
|
int complete_ring();
|
|
|
|
int add_point(double x, double y);
|
2011-07-04 13:03:36 +02:00
|
|
|
|
|
|
|
int start_collection(int n_objects);
|
2011-05-04 20:20:17 +02:00
|
|
|
};
|
|
|
|
Gcalc_heap collector;
|
|
|
|
Gcalc_function func;
|
|
|
|
|
|
|
|
Gcalc_result_receiver res_receiver;
|
|
|
|
Gcalc_operation_reducer operation;
|
|
|
|
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_buffer(THD *thd, Item *obj, Item *distance):
|
|
|
|
Item_geometry_func(thd, obj, distance) {}
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_buffer"; }
|
|
|
|
String *val_str(String *);
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_buffer>(thd, mem_root, this); }
|
2011-05-04 20:20:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-05-30 12:22:34 +02:00
|
|
|
class Item_func_isempty: public Item_bool_func
|
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_isempty(THD *thd, Item *a): Item_bool_func(thd, a) {}
|
2003-05-30 12:22:34 +02:00
|
|
|
longlong val_int();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_isempty"; }
|
2013-09-25 14:30:13 +02:00
|
|
|
void fix_length_and_dec() { maybe_null= 1; }
|
2016-06-29 21:10:35 +02:00
|
|
|
bool need_parentheses_in_default() { return false; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_isempty>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2015-06-25 10:16:27 +02:00
|
|
|
class Item_func_issimple: public Item_int_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
2011-05-04 20:20:17 +02:00
|
|
|
Gcalc_heap collector;
|
|
|
|
Gcalc_function func;
|
|
|
|
Gcalc_scan_iterator scan_it;
|
|
|
|
String tmp;
|
2003-05-30 12:22:34 +02:00
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_issimple(THD *thd, Item *a): Item_int_func(thd, a) {}
|
2003-05-30 12:22:34 +02:00
|
|
|
longlong val_int();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_issimple"; }
|
2015-06-25 10:16:27 +02:00
|
|
|
void fix_length_and_dec() { decimals=0; max_length=2; }
|
|
|
|
uint decimal_precision() const { return 1; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_issimple>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2015-06-25 10:16:27 +02:00
|
|
|
class Item_func_isclosed: public Item_int_func
|
2003-05-30 12:22:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_isclosed(THD *thd, Item *a): Item_int_func(thd, a) {}
|
2003-05-30 12:22:34 +02:00
|
|
|
longlong val_int();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_isclosed"; }
|
2015-06-25 10:16:27 +02:00
|
|
|
void fix_length_and_dec() { decimals=0; max_length=2; }
|
|
|
|
uint decimal_precision() const { return 1; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_isclosed>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
2014-11-27 21:29:37 +01:00
|
|
|
class Item_func_isring: public Item_func_issimple
|
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_isring(THD *thd, Item *a): Item_func_issimple(thd, a) {}
|
2014-11-27 21:29:37 +01:00
|
|
|
longlong val_int();
|
|
|
|
const char *func_name() const { return "st_isring"; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_isring>(thd, mem_root, this); }
|
2014-11-27 21:29:37 +01:00
|
|
|
};
|
|
|
|
|
2003-05-30 12:22:34 +02:00
|
|
|
class Item_func_dimension: public Item_int_func
|
|
|
|
{
|
|
|
|
String value;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_dimension(THD *thd, Item *a): Item_int_func(thd, a) {}
|
2003-05-30 12:22:34 +02:00
|
|
|
longlong val_int();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_dimension"; }
|
2013-09-25 14:30:13 +02:00
|
|
|
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_dimension>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class Item_func_x: public Item_real_func
|
|
|
|
{
|
|
|
|
String value;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_x(THD *thd, Item *a): Item_real_func(thd, a) {}
|
2004-11-11 19:39:35 +01:00
|
|
|
double val_real();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_x"; }
|
2007-02-21 11:45:19 +01:00
|
|
|
void fix_length_and_dec()
|
|
|
|
{
|
|
|
|
Item_real_func::fix_length_and_dec();
|
2013-09-25 14:30:13 +02:00
|
|
|
maybe_null= 1;
|
2007-02-21 11:45:19 +01:00
|
|
|
}
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_x>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Item_func_y: public Item_real_func
|
|
|
|
{
|
|
|
|
String value;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_y(THD *thd, Item *a): Item_real_func(thd, a) {}
|
2004-11-11 19:39:35 +01:00
|
|
|
double val_real();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_y"; }
|
2007-02-21 11:45:19 +01:00
|
|
|
void fix_length_and_dec()
|
|
|
|
{
|
|
|
|
Item_real_func::fix_length_and_dec();
|
2013-09-25 14:30:13 +02:00
|
|
|
maybe_null= 1;
|
2007-02-21 11:45:19 +01:00
|
|
|
}
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_y>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Item_func_numgeometries: public Item_int_func
|
|
|
|
{
|
|
|
|
String value;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_numgeometries(THD *thd, Item *a): Item_int_func(thd, a) {}
|
2003-05-30 12:22:34 +02:00
|
|
|
longlong val_int();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_numgeometries"; }
|
2013-09-25 14:30:13 +02:00
|
|
|
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_numgeometries>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Item_func_numinteriorring: public Item_int_func
|
|
|
|
{
|
|
|
|
String value;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_numinteriorring(THD *thd, Item *a): Item_int_func(thd, a) {}
|
2003-05-30 12:22:34 +02:00
|
|
|
longlong val_int();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_numinteriorrings"; }
|
2013-09-25 14:30:13 +02:00
|
|
|
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_numinteriorring>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Item_func_numpoints: public Item_int_func
|
|
|
|
{
|
|
|
|
String value;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_numpoints(THD *thd, Item *a): Item_int_func(thd, a) {}
|
2003-05-30 12:22:34 +02:00
|
|
|
longlong val_int();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_numpoints"; }
|
2013-09-25 14:30:13 +02:00
|
|
|
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_numpoints>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Item_func_area: public Item_real_func
|
|
|
|
{
|
|
|
|
String value;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_area(THD *thd, Item *a): Item_real_func(thd, a) {}
|
2004-11-11 19:39:35 +01:00
|
|
|
double val_real();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_area"; }
|
2007-02-21 11:45:19 +01:00
|
|
|
void fix_length_and_dec()
|
|
|
|
{
|
|
|
|
Item_real_func::fix_length_and_dec();
|
2013-09-25 14:30:13 +02:00
|
|
|
maybe_null= 1;
|
2007-02-21 11:45:19 +01:00
|
|
|
}
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_area>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Item_func_glength: public Item_real_func
|
|
|
|
{
|
|
|
|
String value;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_glength(THD *thd, Item *a): Item_real_func(thd, a) {}
|
2004-11-11 19:39:35 +01:00
|
|
|
double val_real();
|
2011-05-04 20:20:17 +02:00
|
|
|
const char *func_name() const { return "st_length"; }
|
2007-02-21 11:45:19 +01:00
|
|
|
void fix_length_and_dec()
|
|
|
|
{
|
|
|
|
Item_real_func::fix_length_and_dec();
|
2013-09-25 14:30:13 +02:00
|
|
|
maybe_null= 1;
|
2007-02-21 11:45:19 +01:00
|
|
|
}
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_glength>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Item_func_srid: public Item_int_func
|
|
|
|
{
|
|
|
|
String value;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_srid(THD *thd, Item *a): Item_int_func(thd, a) {}
|
2003-05-30 12:22:34 +02:00
|
|
|
longlong val_int();
|
|
|
|
const char *func_name() const { return "srid"; }
|
2013-09-25 14:30:13 +02:00
|
|
|
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_srid>(thd, mem_root, this); }
|
2003-05-30 12:22:34 +02:00
|
|
|
};
|
2004-01-15 18:06:22 +01:00
|
|
|
|
2011-05-04 20:20:17 +02:00
|
|
|
|
|
|
|
class Item_func_distance: public Item_real_func
|
|
|
|
{
|
|
|
|
String tmp_value1;
|
|
|
|
String tmp_value2;
|
|
|
|
Gcalc_heap collector;
|
|
|
|
Gcalc_function func;
|
|
|
|
Gcalc_scan_iterator scan_it;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_distance(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {}
|
2011-05-04 20:20:17 +02:00
|
|
|
double val_real();
|
|
|
|
const char *func_name() const { return "st_distance"; }
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_distance>(thd, mem_root, this); }
|
2011-05-04 20:20:17 +02:00
|
|
|
};
|
|
|
|
|
2014-06-30 21:30:24 +02:00
|
|
|
|
2014-11-27 21:29:37 +01:00
|
|
|
class Item_func_pointonsurface: public Item_geometry_func
|
|
|
|
{
|
|
|
|
String tmp_value;
|
|
|
|
Gcalc_heap collector;
|
|
|
|
Gcalc_function func;
|
|
|
|
Gcalc_scan_iterator scan_it;
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_pointonsurface(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
2014-11-27 21:29:37 +01:00
|
|
|
const char *func_name() const { return "st_pointonsurface"; }
|
|
|
|
String *val_str(String *);
|
|
|
|
Field::geometry_type get_geometry_type() const;
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_pointonsurface>(thd, mem_root, this); }
|
2014-11-27 21:29:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-06-30 21:30:24 +02:00
|
|
|
#ifndef DBUG_OFF
|
|
|
|
class Item_func_gis_debug: public Item_int_func
|
|
|
|
{
|
|
|
|
public:
|
2015-08-11 09:18:38 +02:00
|
|
|
Item_func_gis_debug(THD *thd, Item *a): Item_int_func(thd, a)
|
|
|
|
{ null_value= false; }
|
2014-06-30 21:30:24 +02:00
|
|
|
const char *func_name() const { return "st_gis_debug"; }
|
|
|
|
longlong val_int();
|
2016-06-26 22:42:48 +02:00
|
|
|
bool check_vcol_func_processor(void *arg)
|
More test for MDEV-10134 Add full support for DEFAULT
Miscelaneous functions:
BENCHMARK(), SLEEP(), ROW_COUNT(), FOUND_ROWS(),
GET_LOCK(), RELEASE_LOCK(), IS_USED_LOCK(), IS_FREE_LOCK(),
MASTER_POS_WAIT(), MASTER_GTID_WAIT(), BINLOG_GTID_POS(),
ST_GIS_DEBUG(), DECODE_HISTOGRAM(),
2016-06-10 10:10:17 +02:00
|
|
|
{
|
2016-06-27 19:22:09 +02:00
|
|
|
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
|
More test for MDEV-10134 Add full support for DEFAULT
Miscelaneous functions:
BENCHMARK(), SLEEP(), ROW_COUNT(), FOUND_ROWS(),
GET_LOCK(), RELEASE_LOCK(), IS_USED_LOCK(), IS_FREE_LOCK(),
MASTER_POS_WAIT(), MASTER_GTID_WAIT(), BINLOG_GTID_POS(),
ST_GIS_DEBUG(), DECODE_HISTOGRAM(),
2016-06-10 10:10:17 +02:00
|
|
|
}
|
2016-05-01 21:29:47 +02:00
|
|
|
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
|
|
|
{ return get_item_copy<Item_func_gis_debug>(thd, mem_root, this); }
|
2014-06-30 21:30:24 +02:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-11-02 19:01:53 +01:00
|
|
|
#define GEOM_NEW(thd, obj_constructor) new (thd->mem_root) obj_constructor
|
2004-01-15 18:06:22 +01:00
|
|
|
|
|
|
|
#else /*HAVE_SPATIAL*/
|
|
|
|
|
2006-11-02 19:01:53 +01:00
|
|
|
#define GEOM_NEW(thd, obj_constructor) NULL
|
2004-01-15 18:06:22 +01:00
|
|
|
|
2011-05-04 20:20:17 +02:00
|
|
|
#endif /*HAVE_SPATIAL*/
|
2009-09-23 23:32:31 +02:00
|
|
|
#endif /* ITEM_GEOFUNC_INCLUDED */
|