My Project
Defines | Functions
item_cmpfunc.cc File Reference

This file defines all compare functions. More...

#include "sql_priv.h"
#include <m_ctype.h>
#include "sql_select.h"
#include "sql_optimizer.h"
#include "sql_parse.h"
#include "sql_time.h"
#include <algorithm>

Defines

#define OLD_CMP
#define likeconv(cs, A)   (uchar) (cs)->sort_order[(uchar) (A)]

Functions

enum_field_types agg_field_type (Item **items, uint nitems)
 Aggregates field types from the array of items.
bool get_mysql_time_from_str (THD *thd, String *str, timestamp_type warn_type, const char *warn_name, MYSQL_TIME *l_time)
longlong get_time_value (THD *thd, Item ***item_arg, Item **cache_arg, Item *warn_item, bool *is_null)
longlong get_datetime_value (THD *thd, Item ***item_arg, Item **cache_arg, Item *warn_item, bool *is_null)
int cmp_longlong (void *cmp_arg, in_longlong::packed_longlong *a, in_longlong::packed_longlong *b)
Itemand_expressions (Item *a, Item *b, Item **org_item)

Detailed Description

This file defines all compare functions.


Function Documentation

enum_field_types agg_field_type ( Item **  items,
uint  nitems 
)

Aggregates field types from the array of items.

Parameters:
[in]itemsarray of items to aggregate the type from [in] nitems number of items in the array

This function aggregates field types from the array of items. Found type is supposed to be used later as the result field type of a multi-argument function. Aggregation itself is performed by the Field::field_type_merge() function.

Note:
The term "aggregation" is used here in the sense of inferring the result type of a function from its argument types.
Returns:
aggregated field type.
Item* and_expressions ( Item a,
Item b,
Item **  org_item 
)

Create an AND expression from two expressions.

Parameters:
aexpression or NULL
bexpression.
org_itemDon't modify a if a == *org_item. If a == NULL, org_item is set to point at b, to ensure that future calls will not modify b.
Note:
This will not modify item pointed to by org_item or b The idea is that one can call this in a loop and create and 'and' over all items without modifying any of the original items.
Return values:
NULLError
Item
bool get_mysql_time_from_str ( THD *  thd,
String str,
timestamp_type  warn_type,
const char *  warn_name,
MYSQL_TIME *  l_time 
)

Parse date provided in a string to a MYSQL_TIME.

Parameters:
[in]thdThread handle
[in]strA string to convert
[in]warn_typeType of the timestamp for issuing the warning
[in]warn_nameField name for issuing the warning
[out]l_timeThe MYSQL_TIME objects is initialized.

Parses a date provided in the string str into a MYSQL_TIME object. If the string contains an incorrect date or doesn't correspond to a date at all then a warning is issued. The warn_type and the warn_name arguments are used as the name and the type of the field when issuing the warning. If any input was discarded (trailing or non-timestamp-y characters), return value will be TRUE.

Returns:
Status flag
Return values:
FALSESuccess.
TrueIndicates failure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines