~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/create.cc

  • Committer: Mark Atwood
  • Date: 2011-06-25 15:38:53 UTC
  • mfrom: (2318.6.78 refactor16)
  • Revision ID: me@mark.atwood.name-20110625153853-za5fjiwd3z0aykdd
mergeĀ lp:~olafvdspek/drizzle/refactor16

Show diffs side-by-side

added added

removed removed

Lines of Context:
2034
2034
  startup only (before going multi-threaded)
2035
2035
*/
2036
2036
 
2037
 
int item_create_init()
2038
 
{
2039
 
  string func_name;
2040
 
 
2041
 
  Native_func_registry *func;
2042
 
  for (func= func_array; func->builder != NULL; func++)
2043
 
  {
2044
 
    func_name.assign(func->name.str, func->name.length);
2045
 
 
2046
 
    FunctionContainer::getMap()[func_name]= func->builder;
2047
 
  }
2048
 
 
2049
 
  return 0;
2050
 
}
2051
 
 
2052
 
 
2053
 
Create_func *
2054
 
find_native_function_builder(LEX_STRING name)
2055
 
{
2056
 
  Create_func *builder= NULL;
2057
 
 
2058
 
  string func_name(name.str, name.length);
2059
 
 
2060
 
  FunctionContainer::Map::iterator func_iter=
2061
 
    FunctionContainer::getMap().find(func_name);
2062
 
 
2063
 
  if (func_iter != FunctionContainer::getMap().end())
2064
 
  {
2065
 
    builder= (*func_iter).second;
2066
 
  }
2067
 
 
2068
 
  return builder;
2069
 
}
2070
 
 
2071
 
 
2072
 
Item*
2073
 
create_func_char_cast(Session *session, Item *a, int len, const charset_info_st * const cs)
2074
 
{
2075
 
  const charset_info_st * const real_cs= (cs ? cs : session->variables.getCollation());
2076
 
  return new (session->mem_root) Item_char_typecast(a, len, real_cs);
2077
 
}
2078
 
 
2079
 
 
2080
 
Item *
2081
 
create_func_cast(Session *session, Item *a, Cast_target cast_type,
 
2037
void item_create_init()
 
2038
{
 
2039
  for (Native_func_registry* func= func_array; func->builder; func++)
 
2040
    FunctionContainer::getMutableMap()[string(func->name.str, func->name.length)]= func->builder;
 
2041
}
 
2042
 
 
2043
Create_func* find_native_function_builder(LEX_STRING name)
 
2044
{
 
2045
  return find_ptr2(FunctionContainer::getMap(), string(name.str, name.length));
 
2046
}
 
2047
 
 
2048
Item* create_func_char_cast(Session *session, Item *a, int len, const charset_info_st * const cs)
 
2049
{
 
2050
  return new (session->mem_root) Item_char_typecast(a, len, cs ? cs : session->variables.getCollation());
 
2051
}
 
2052
 
 
2053
Item* create_func_cast(Session *session, Item *a, Cast_target cast_type,
2082
2054
                 const char *c_len, const char *c_dec,
2083
2055
                 const charset_info_st * const cs)
2084
2056
{