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
28062413
Commit
28062413
authored
Aug 06, 2002
by
bar@bar.udmsearch.izhnet.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New CRC32() SQL function
parent
bbbfcdca
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
0 deletions
+30
-0
sql/item_create.cc
sql/item_create.cc
+5
-0
sql/item_create.h
sql/item_create.h
+1
-0
sql/item_func.cc
sql/item_func.cc
+13
-0
sql/item_func.h
sql/item_func.h
+10
-0
sql/lex.h
sql/lex.h
+1
-0
No files found.
sql/item_create.cc
View file @
28062413
...
@@ -86,6 +86,11 @@ Item *create_func_cot(Item* a)
...
@@ -86,6 +86,11 @@ Item *create_func_cot(Item* a)
new
Item_func_tan
(
a
));
new
Item_func_tan
(
a
));
}
}
Item
*
create_func_crc32
(
Item
*
a
)
{
return
new
Item_func_crc32
(
a
);
}
Item
*
create_func_date_format
(
Item
*
a
,
Item
*
b
)
Item
*
create_func_date_format
(
Item
*
a
,
Item
*
b
)
{
{
return
new
Item_func_date_format
(
a
,
b
,
0
);
return
new
Item_func_date_format
(
a
,
b
,
0
);
...
...
sql/item_create.h
View file @
28062413
...
@@ -29,6 +29,7 @@ Item *create_func_connection_id(void);
...
@@ -29,6 +29,7 @@ Item *create_func_connection_id(void);
Item
*
create_func_conv
(
Item
*
a
,
Item
*
b
,
Item
*
c
);
Item
*
create_func_conv
(
Item
*
a
,
Item
*
b
,
Item
*
c
);
Item
*
create_func_cos
(
Item
*
a
);
Item
*
create_func_cos
(
Item
*
a
);
Item
*
create_func_cot
(
Item
*
a
);
Item
*
create_func_cot
(
Item
*
a
);
Item
*
create_func_crc32
(
Item
*
a
);
Item
*
create_func_date_format
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_date_format
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_dayname
(
Item
*
a
);
Item
*
create_func_dayname
(
Item
*
a
);
Item
*
create_func_dayofmonth
(
Item
*
a
);
Item
*
create_func_dayofmonth
(
Item
*
a
);
...
...
sql/item_func.cc
View file @
28062413
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <hash.h>
#include <hash.h>
#include <time.h>
#include <time.h>
#include <ft_global.h>
#include <ft_global.h>
#include <zlib.h>
#include "slave.h" // for wait_for_master_pos
#include "slave.h" // for wait_for_master_pos
#include "gstream.h"
#include "gstream.h"
...
@@ -801,6 +802,18 @@ longlong Item_func_min_max::val_int()
...
@@ -801,6 +802,18 @@ longlong Item_func_min_max::val_int()
return
value
;
return
value
;
}
}
longlong
Item_func_crc32
::
val_int
()
{
String
*
res
=
args
[
0
]
->
val_str
(
&
value
);
if
(
!
res
)
{
null_value
=
1
;
return
0
;
/* purecov: inspected */
}
null_value
=
0
;
return
(
longlong
)
crc32
(
0L
,
(
Bytef
*
)
res
->
ptr
(),
res
->
length
());
}
longlong
Item_func_length
::
val_int
()
longlong
Item_func_length
::
val_int
()
{
{
...
...
sql/item_func.h
View file @
28062413
...
@@ -518,6 +518,16 @@ public:
...
@@ -518,6 +518,16 @@ public:
const
char
*
func_name
()
const
{
return
"greatest"
;
}
const
char
*
func_name
()
const
{
return
"greatest"
;
}
};
};
class
Item_func_crc32
:
public
Item_int_func
{
String
value
;
public:
Item_func_crc32
(
Item
*
a
)
:
Item_int_func
(
a
)
{}
longlong
val_int
();
const
char
*
func_name
()
const
{
return
"crc32"
;
}
void
fix_length_and_dec
()
{
max_length
=
10
;
}
};
class
Item_func_length
:
public
Item_int_func
class
Item_func_length
:
public
Item_int_func
{
{
...
...
sql/lex.h
View file @
28062413
...
@@ -430,6 +430,7 @@ static SYMBOL sql_functions[] = {
...
@@ -430,6 +430,7 @@ static SYMBOL sql_functions[] = {
{
"COUNT"
,
SYM
(
COUNT_SYM
),
0
,
0
},
{
"COUNT"
,
SYM
(
COUNT_SYM
),
0
,
0
},
{
"COS"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_cos
)},
{
"COS"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_cos
)},
{
"COT"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_cot
)},
{
"COT"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_cot
)},
{
"CRC32"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_crc32
)},
{
"CROSSES"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_crosses
)},
{
"CROSSES"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_crosses
)},
{
"CURDATE"
,
SYM
(
CURDATE
),
0
,
0
},
{
"CURDATE"
,
SYM
(
CURDATE
),
0
,
0
},
{
"CURTIME"
,
SYM
(
CURTIME
),
0
,
0
},
{
"CURTIME"
,
SYM
(
CURTIME
),
0
,
0
},
...
...
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