Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ede07fcd
Commit
ede07fcd
authored
Mar 18, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed signed numeric literal parsing
parent
613104ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
10 deletions
+27
-10
sql/item.h
sql/item.h
+19
-7
sql/sql_yacc.yy
sql/sql_yacc.yy
+8
-3
No files found.
sql/item.h
View file @
ede07fcd
...
...
@@ -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
;
}
};
...
...
sql/sql_yacc.yy
View file @
ede07fcd
...
...
@@ -64,6 +64,7 @@ inline Item *or_or_concat(THD *thd, Item* A, Item* B)
Table_ident *table;
char *simple_string;
Item *item;
Item_num *item_num;
List<Item> *item_list;
List<String> *string_list;
String *string;
...
...
@@ -628,7 +629,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
using_list expr_or_default set_expr_or_default interval_expr
param_marker singlerow_subselect singlerow_subselect_init
exists_subselect exists_subselect_init geometry_function
signed_literal NUM_literal
signed_literal
%type <item_num>
NUM_literal
%type <item_list>
expr_list udf_expr_list when_list ident_list ident_list_arg
...
...
@@ -4525,8 +4529,9 @@ signed_literal:
| '+' NUM_literal { $$ = $2; }
| '-' NUM_literal
{
/* $2 it's Item_int -> we can get value without fix_fields call */
$$= new Item_int(-$2->val_int(), $2->max_length+1);
$2->neg();
$2->max_length++;
$$= $2;
}
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment