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
672a7791
Commit
672a7791
authored
Oct 15, 2003
by
harrison@bud.lordblink.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in bit_xor function (approved by Sergei)
parent
9ed99782
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
0 deletions
+40
-0
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
sql/item_sum.cc
sql/item_sum.cc
+23
-0
sql/item_sum.h
sql/item_sum.h
+12
-0
sql/lex.h
sql/lex.h
+1
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-0
No files found.
BitKeeper/etc/logging_ok
View file @
672a7791
...
...
@@ -30,6 +30,7 @@ greg@mysql.com
guilhem@mysql.com
gweir@build.mysql.com
gweir@work.mysql.com
harrison@mysql.com
heikki@donna.mysql.fi
heikki@hundin.mysql.fi
heikki@rescue.
...
...
sql/item_sum.cc
View file @
672a7791
...
...
@@ -625,6 +625,20 @@ bool Item_sum_or::add()
return
0
;
}
Item
*
Item_sum_xor
::
copy_or_same
(
THD
*
thd
)
{
return
new
(
&
thd
->
mem_root
)
Item_sum_xor
(
thd
,
*
this
);
}
bool
Item_sum_xor
::
add
()
{
ulonglong
value
=
(
ulonglong
)
args
[
0
]
->
val_int
();
if
(
!
args
[
0
]
->
null_value
)
bits
^=
value
;
return
0
;
}
Item
*
Item_sum_and
::
copy_or_same
(
THD
*
thd
)
{
return
new
(
&
thd
->
mem_root
)
Item_sum_and
(
thd
,
*
this
);
...
...
@@ -912,6 +926,15 @@ void Item_sum_or::update_field()
int8store
(
res
,
nr
);
}
void
Item_sum_xor
::
update_field
()
{
ulonglong
nr
;
char
*
res
=
result_field
->
ptr
;
nr
=
uint8korr
(
res
);
nr
^=
(
ulonglong
)
args
[
0
]
->
val_int
();
int8store
(
res
,
nr
);
}
void
Item_sum_and
::
update_field
()
{
...
...
sql/item_sum.h
View file @
672a7791
...
...
@@ -484,6 +484,18 @@ class Item_sum_and :public Item_sum_bit
Item
*
copy_or_same
(
THD
*
thd
);
};
class
Item_sum_xor
:
public
Item_sum_bit
{
public:
Item_sum_xor
(
Item
*
item_par
)
:
Item_sum_bit
(
item_par
,
LL
(
0
))
{}
Item_sum_xor
(
THD
*
thd
,
Item_sum_xor
&
item
)
:
Item_sum_bit
(
thd
,
item
)
{}
bool
add
();
void
update_field
();
const
char
*
func_name
()
const
{
return
"bit_xor"
;
}
Item
*
copy_or_same
(
THD
*
thd
);
};
/*
** user defined aggregates
*/
...
...
sql/lex.h
View file @
672a7791
...
...
@@ -465,6 +465,7 @@ static SYMBOL sql_functions[] = {
{
"BIT_COUNT"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_bit_count
)},
{
"BIT_OR"
,
SYM
(
BIT_OR
),
0
,
0
},
{
"BIT_AND"
,
SYM
(
BIT_AND
),
0
,
0
},
{
"BIT_XOR"
,
SYM
(
BIT_XOR
),
0
,
0
},
{
"CAST"
,
SYM
(
CAST_SYM
),
0
,
0
},
{
"CEIL"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_ceiling
)},
{
"CEILING"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_ceiling
)},
...
...
sql/sql_yacc.yy
View file @
672a7791
...
...
@@ -449,6 +449,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token BETWEEN_SYM
%token BIT_AND
%token BIT_OR
%token BIT_XOR
%token CASE_SYM
%token CONCAT
%token CONCAT_WS
...
...
@@ -2846,6 +2847,8 @@ sum_expr:
{ $$=new Item_sum_and($3); }
| BIT_OR '(' in_sum_expr ')'
{ $$=new Item_sum_or($3); }
| BIT_XOR '(' in_sum_expr ')'
{ $$=new Item_sum_xor($3); }
| COUNT_SYM '(' opt_all '*' ')'
{ $$=new Item_sum_count(new Item_int((int32) 0L,1)); }
| COUNT_SYM '(' in_sum_expr ')'
...
...
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