My Project
Public Member Functions | Public Attributes
Item_insert_value Class Reference
Inheritance diagram for Item_insert_value:
Item_field Item_ident Item

List of all members.

Public Member Functions

 Item_insert_value (Name_resolution_context *context_arg, Item *a)
bool eq (const Item *item, bool binary_cmp) const
bool fix_fields (THD *, Item **)
virtual void print (String *str, enum_query_type query_type)
type_conversion_status save_in_field (Field *field_arg, bool no_conversions)
table_map used_tables () const
bool walk (Item_processor processor, bool walk_subquery, uchar *args)

Public Attributes

Itemarg

Member Function Documentation

bool Item_insert_value::eq ( const Item item,
bool  binary_cmp 
) const [virtual]

This function is called when:

  • Comparing items in the WHERE clause (when doing where optimization)
  • When trying to find an ORDER BY/GROUP BY item in the SELECT part
  • When matching fields in multiple equality objects (Item_equal)

Reimplemented from Item_field.

bool Item_insert_value::fix_fields ( THD *  thd,
Item **  reference 
) [virtual]

Resolve the name of a column reference.

The method resolves the column reference represented by 'this' as a column present in one of: FROM clause, SELECT clause, GROUP BY clause of a query Q, or in outer queries that contain Q.

The name resolution algorithm used is (where [T_j] is an optional table name that qualifies the column name):

    resolve_column_reference([T_j].col_ref_i)
    {
      search for a column or derived column named col_ref_i
      [in table T_j] in the FROM clause of Q;

      if such a column is NOT found AND    // Lookup in outer queries.
         there are outer queries
      {
        for each outer query Q_k beginning from the inner-most one
        {
          search for a column or derived column named col_ref_i
          [in table T_j] in the FROM clause of Q_k;

          if such a column is not found
            Search for a column or derived column named col_ref_i
            [in table T_j] in the SELECT and GROUP clauses of Q_k.
        }
      }
    }

Notice that compared to Item_ref::fix_fields, here we first search the FROM clause, and then we search the SELECT and GROUP BY clauses.

Parameters:
[in]thdcurrent thread
[in,out]referenceview column if this item was resolved to a view column
Return values:
TRUEif error
FALSEon success

Reimplemented from Item_field.

void Item_insert_value::print ( String str,
enum_query_type  query_type 
) [virtual]

This method is used for to:

  • to generate a view definition query (SELECT-statement);
  • to generate a SQL-query for EXPLAIN EXTENDED;
  • to generate a SQL-query to be shown in INFORMATION_SCHEMA;
  • debug.

For more information about view definition query, INFORMATION_SCHEMA query and why they should be generated from the Item-tree,

See also:
mysql_register_view().

Reimplemented from Item_field.

type_conversion_status Item_insert_value::save_in_field ( Field field,
bool  no_conversions 
) [inline, virtual]

Save a temporal value in packed longlong format into a Field. Used in optimizer.

Parameters:
OUTfield The field to set the value to.
Return values:
0On success.
>0In error.

Reimplemented from Item_field.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines