/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* Copyright (C) 2008 Sun Microsystems
*
* 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
* the Free Software Foundation; version 2 of the License.
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Functions to create an item. Used by sql/sql_yacc.yy */
#ifndef DRIZZLE_SERVER_ITEM_CREATE_H
#define DRIZZLE_SERVER_ITEM_CREATE_H
/**
Public function builder interface.
The parser (sql/sql_yacc.yy) uses a factory / builder pattern to
construct an Item
object for each function call.
All the concrete function builders implements this interface,
either directly or indirectly with some adapter helpers.
Keeping the function creation separated from the bison grammar allows
to simplify the parser, and avoid the need to introduce a new token
for each function, which has undesirable side effects in the grammar.
*/
class Create_func
{
public:
/**
The builder create method.
Given the function name and list or arguments, this method creates
an Item
that represents the function call.
In case or errors, a NULL item is returned, and an error is reported.
Note that the session
object may be modified by the builder.
In particular, the following members/methods can be set/called,
depending on the function called and the function possible side effects.
session->lex->binlog_row_based_if_mixed
session->lex->current_context()
session->lex->safe_to_cache_query
session->lex->uncacheable(UNCACHEABLE_SIDEEFFECT)
session->lex->uncacheable(UNCACHEABLE_RAND)
session->lex->add_time_zone_tables_to_query_tables(session)
db.func(expr, expr, ...)
.
*/
class Create_qfunc : public Create_func
{
public:
/**
The builder create method, for unqualified functions.
This builder will use the current database for the database name.
@param session The current thread
@param name The function name
@param item_list The list of arguments to the function, can be NULL
@return An item representing the parsed function call
*/
virtual Item *create(Session *session, LEX_STRING name, List