492.3.2
by Lee
code clean up to moving functions into drizzled/functions directory - Item_num_op and Item_numhybrid |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
492.3.2
by Lee
code clean up to moving functions into drizzled/functions directory - Item_num_op and Item_numhybrid |
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
20 |
#pragma once
|
492.3.2
by Lee
code clean up to moving functions into drizzled/functions directory - Item_num_op and Item_numhybrid |
21 |
|
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
22 |
#include <drizzled/function/func.h> |
492.3.2
by Lee
code clean up to moving functions into drizzled/functions directory - Item_num_op and Item_numhybrid |
23 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
24 |
namespace drizzled |
25 |
{
|
|
26 |
||
492.3.2
by Lee
code clean up to moving functions into drizzled/functions directory - Item_num_op and Item_numhybrid |
27 |
class Item_func_numhybrid: public Item_func |
28 |
{
|
|
29 |
protected: |
|
30 |
Item_result hybrid_type; |
|
31 |
public: |
|
1759.3.1
by Stewart Smith
move ABS() function into math_functions plugin. We now have '3 AS three' allowed as a parameter, just like all the UDFs did |
32 |
Item_func_numhybrid(): Item_func(), hybrid_type(REAL_RESULT) |
33 |
{}
|
|
492.3.2
by Lee
code clean up to moving functions into drizzled/functions directory - Item_num_op and Item_numhybrid |
34 |
Item_func_numhybrid(Item *a) :Item_func(a), hybrid_type(REAL_RESULT) |
35 |
{}
|
|
36 |
Item_func_numhybrid(Item *a,Item *b) |
|
37 |
:Item_func(a,b), hybrid_type(REAL_RESULT) |
|
38 |
{}
|
|
39 |
Item_func_numhybrid(List<Item> &list) |
|
40 |
:Item_func(list), hybrid_type(REAL_RESULT) |
|
41 |
{}
|
|
42 |
||
43 |
enum Item_result result_type () const { return hybrid_type; } |
|
44 |
void fix_length_and_dec(); |
|
45 |
void fix_num_length_and_dec(); |
|
46 |
virtual void find_num_type()= 0; /* To be called from fix_length_and_dec */ |
|
47 |
||
48 |
double val_real(); |
|
49 |
int64_t val_int(); |
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
50 |
type::Decimal *val_decimal(type::Decimal *); |
492.3.2
by Lee
code clean up to moving functions into drizzled/functions directory - Item_num_op and Item_numhybrid |
51 |
String *val_str(String*str); |
52 |
||
53 |
/**
|
|
54 |
@brief Performs the operation that this functions implements when the
|
|
55 |
result type is INT.
|
|
56 |
||
57 |
@return The result of the operation.
|
|
58 |
*/
|
|
59 |
virtual int64_t int_op()= 0; |
|
60 |
||
61 |
/**
|
|
62 |
@brief Performs the operation that this functions implements when the
|
|
63 |
result type is REAL.
|
|
64 |
||
65 |
@return The result of the operation.
|
|
66 |
*/
|
|
67 |
virtual double real_op()= 0; |
|
68 |
||
69 |
/**
|
|
70 |
@brief Performs the operation that this functions implements when the
|
|
71 |
result type is DECIMAL.
|
|
72 |
||
73 |
@param A pointer where the DECIMAL value will be allocated.
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
74 |
@return
|
492.3.2
by Lee
code clean up to moving functions into drizzled/functions directory - Item_num_op and Item_numhybrid |
75 |
- 0 If the result is NULL
|
76 |
- The same pointer it was given, with the area initialized to the
|
|
77 |
result of the operation.
|
|
78 |
*/
|
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
79 |
virtual type::Decimal *decimal_op(type::Decimal *)= 0; |
492.3.2
by Lee
code clean up to moving functions into drizzled/functions directory - Item_num_op and Item_numhybrid |
80 |
|
81 |
/**
|
|
82 |
@brief Performs the operation that this functions implements when the
|
|
83 |
result type is a string type.
|
|
84 |
||
85 |
@return The result of the operation.
|
|
86 |
*/
|
|
87 |
virtual String *str_op(String *)= 0; |
|
88 |
bool is_null() { update_null_value(); return null_value; } |
|
89 |
};
|
|
90 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
91 |
} /* namespace drizzled */ |
92 |