diff options
author | unknown <bell@sanja.is.com.ua> | 2004-03-18 18:27:03 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-03-18 18:27:03 +0200 |
commit | adc4aa5ae69e5d3fcc5ea6fd0350402fbd976511 (patch) | |
tree | 3a985f7a301b3fb3561e467c887e3b33a4a9124d /sql/item.h | |
parent | 41e3170af1dd02aad8d8f6559c99452d9d9d009e (diff) | |
download | mariadb-git-adc4aa5ae69e5d3fcc5ea6fd0350402fbd976511.tar.gz |
fixed signed numeric literal parsing
sql/item.h:
added negation methods for numeric Items
sql/sql_yacc.yy:
fixed numeric literal
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sql/item.h b/sql/item.h index 7f50495d23b..6917a5ffef7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -242,6 +242,13 @@ public: }; +class Item_num: public Item +{ +public: + virtual void neg()= 0; +}; + + class st_select_lex; class Item_ident :public Item { @@ -398,10 +405,10 @@ public: void print(String *str) { str->append('?'); } }; -class Item_int :public Item +class Item_int :public Item_num { public: - const longlong value; + longlong value; Item_int(int32 i,uint length=11) :value((longlong) i) { max_length=length; fixed= 1; } #ifdef HAVE_LONG_LONG @@ -425,12 +432,16 @@ public: Item *new_item() { return new Item_int(name,value,max_length); } // to prevent drop fixed flag (no need parent cleanup call) void cleanup() { fixed= 1; } - void print(String *strclass Item_uint :public Item_int + void print(String *str); + void neg() { value= -value; } +}; + + +class Item_uint :public Item_int { public: Item_uint(const char *str_arg, uint length) : - Item_int(str_arg, (longlong) strtoull(str_arg,(char**) 0,10), length) - Item_int(str_arg, (longlong) strtoull(str_arg,(char**) 0,10), length) + Item_int(str_arg, (longlong) strtoull(str_arg, (char**) 0,10), length) { unsigned_flag= 1; } Item_uint(uint32 i) :Item_int((longlong) i, 10) { unsigned_flag= 1; } @@ -443,10 +454,10 @@ public: }; -class Item_real :public Item +class Item_real :public Item_num { public: - const double value; + double value; // Item_real() :value(0) {} Item_real(const char *str_arg,uint length) :value(my_atof(str_arg)) { @@ -474,6 +485,7 @@ public: String *val_str(String*); bool basic_const_item() const { return 1; } Item *new_item() { return new Item_real(name,value,decimals,max_length); } + void neg() { value= -value; } }; |