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
235f0ffe
Commit
235f0ffe
authored
Mar 05, 2004
by
ingo@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge istruewing@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/mydev/mysql/mysql-4.1
parents
3d13fb00
54c1debc
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
96 additions
and
11 deletions
+96
-11
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+9
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+3
-0
mysys/my_getsystime.c
mysys/my_getsystime.c
+8
-0
sql/item_create.cc
sql/item_create.cc
+5
-0
sql/item_create.h
sql/item_create.h
+1
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+43
-1
sql/item_strfunc.h
sql/item_strfunc.h
+25
-10
sql/lex.h
sql/lex.h
+1
-0
No files found.
BitKeeper/etc/logging_ok
View file @
235f0ffe
...
...
@@ -48,6 +48,7 @@ hf@deer.mysql.r18.ru
hf@genie.(none)
igor@hundin.mysql.fi
igor@rurik.mysql.com
ingo@mysql.com
jani@dsl-jkl1657.dial.inet.fi
jani@dsl-kpogw4gb5.dial.inet.fi
jani@hynda.(none)
...
...
mysql-test/r/func_str.result
View file @
235f0ffe
...
...
@@ -192,6 +192,15 @@ length(quote(concat(char(0),"test")))
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))))
27E0E3E6E7E8EAEB27
select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678");
unhex(hex("foobar")) hex(unhex("1234567890ABCDEF")) unhex("345678")
foobar 1234567890ABCDEF 4Vx
select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex("12345")) hex(unhex("123456"))
01 12 0123 1234 012345 123456
select length(unhex(md5("abrakadabra")));
length(unhex(md5("abrakadabra")))
16
select reverse("");
reverse("")
...
...
mysql-test/t/func_str.test
View file @
235f0ffe
...
...
@@ -78,6 +78,9 @@ select quote(concat('abc\'', '\\cba'));
select
quote
(
1
/
0
),
quote
(
'\0\Z'
);
select
length
(
quote
(
concat
(
char
(
0
),
"test"
)));
select
hex
(
quote
(
concat
(
char
(
224
),
char
(
227
),
char
(
230
),
char
(
231
),
char
(
232
),
char
(
234
),
char
(
235
))));
select
unhex
(
hex
(
"foobar"
)),
hex
(
unhex
(
"1234567890ABCDEF"
)),
unhex
(
"345678"
);
select
hex
(
unhex
(
"1"
)),
hex
(
unhex
(
"12"
)),
hex
(
unhex
(
"123"
)),
hex
(
unhex
(
"1234"
)),
hex
(
unhex
(
"12345"
)),
hex
(
unhex
(
"123456"
));
select
length
(
unhex
(
md5
(
"abrakadabra"
)));
#
# Wrong usage of functions
...
...
mysys/my_getsystime.c
View file @
235f0ffe
...
...
@@ -18,6 +18,10 @@
/* thus to get the current time we should use the system function
with the highest possible resolution */
#ifdef __NETWARE__
#include <nks/time.h>
#endif
#include "mysys_priv.h"
ulonglong
my_getsystime
()
{
...
...
@@ -31,6 +35,10 @@ ulonglong my_getsystime()
struct
_timeb
tb
;
_ftime
(
&
tb
);
return
(
ulonglong
)
tb
.
time
*
10000000
+
(
ulonglong
)
tb
.
millitm
*
10000
;
#elif defined(__NETWARE__)
NXTime_t
tm
;
NXGetTime
(
NX_SINCE_1970
,
NX_NSECONDS
,
&
tm
);
return
(
ulonglong
)
tm
/
100
;
#else
/* TODO: check for other possibilities for hi-res timestamping */
struct
timeval
tv
;
...
...
sql/item_create.cc
View file @
235f0ffe
...
...
@@ -426,6 +426,11 @@ Item *create_func_ucase(Item* a)
return
new
Item_func_ucase
(
a
);
}
Item
*
create_func_unhex
(
Item
*
a
)
{
return
new
Item_func_unhex
(
a
);
}
Item
*
create_func_uuid
(
void
)
{
return
new
Item_func_uuid
();
...
...
sql/item_create.h
View file @
235f0ffe
...
...
@@ -92,6 +92,7 @@ Item *create_func_time_format(Item *a, Item *b);
Item
*
create_func_time_to_sec
(
Item
*
a
);
Item
*
create_func_to_days
(
Item
*
a
);
Item
*
create_func_ucase
(
Item
*
a
);
Item
*
create_func_unhex
(
Item
*
a
);
Item
*
create_func_uuid
(
void
);
Item
*
create_func_version
(
void
);
Item
*
create_func_weekday
(
Item
*
a
);
...
...
sql/item_strfunc.cc
View file @
235f0ffe
...
...
@@ -2231,7 +2231,7 @@ String *Item_func_hex::val_str(String *str)
null_value
=
0
;
tmp_value
.
length
(
res
->
length
()
*
2
);
for
(
from
=
res
->
ptr
(),
end
=
from
+
res
->
length
(),
to
=
(
char
*
)
tmp_value
.
ptr
();
from
!=
end
;
from
<
end
;
from
++
,
to
+=
2
)
{
uint
tmp
=
(
uint
)
(
uchar
)
*
from
;
...
...
@@ -2241,6 +2241,48 @@ String *Item_func_hex::val_str(String *str)
return
&
tmp_value
;
}
int
inline
hexchar_to_int
(
char
c
)
{
if
(
c
<=
'9'
&&
c
>=
'0'
)
return
c
-
'0'
;
c
|=
32
;
if
(
c
<=
'f'
&&
c
>=
'a'
)
return
c
-
'a'
+
10
;
return
-
1
;
}
String
*
Item_func_unhex
::
val_str
(
String
*
str
)
{
/* Convert given hex string to a binary string */
String
*
res
=
args
[
0
]
->
val_str
(
str
);
const
char
*
from
=
res
->
ptr
(),
*
end
;
char
*
to
;
int
r
;
if
(
!
res
||
tmp_value
.
alloc
((
1
+
res
->
length
())
/
2
))
{
null_value
=
1
;
return
0
;
}
null_value
=
0
;
tmp_value
.
length
((
1
+
res
->
length
())
/
2
);
to
=
(
char
*
)
tmp_value
.
ptr
();
if
(
res
->
length
()
%
2
)
{
*
to
++=
r
=
hexchar_to_int
(
*
from
++
);
if
((
null_value
=
(
r
==
-
1
)))
return
0
;
}
for
(
end
=
res
->
ptr
()
+
res
->
length
();
from
<
end
;
from
+=
2
,
to
++
)
{
*
to
=
(
r
=
hexchar_to_int
(
from
[
0
]))
<<
4
;
if
((
null_value
=
(
r
==
-
1
)))
return
0
;
*
to
|=
r
=
hexchar_to_int
(
from
[
1
]);
if
((
null_value
=
(
r
==
-
1
)))
return
0
;
}
return
&
tmp_value
;
}
void
Item_func_binary
::
print
(
String
*
str
)
{
...
...
sql/item_strfunc.h
View file @
235f0ffe
...
...
@@ -523,6 +523,21 @@ public:
}
};
class
Item_func_unhex
:
public
Item_str_func
{
String
tmp_value
;
public:
Item_func_unhex
(
Item
*
a
)
:
Item_str_func
(
a
)
{}
const
char
*
func_name
()
const
{
return
"unhex"
;
}
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
collation
.
set
(
&
my_charset_bin
);
decimals
=
0
;
max_length
=
(
1
+
args
[
0
]
->
max_length
)
/
2
;
}
};
class
Item_func_binary
:
public
Item_str_func
{
...
...
sql/lex.h
View file @
235f0ffe
...
...
@@ -671,6 +671,7 @@ static SYMBOL sql_functions[] = {
{
"UCASE"
,
F_SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_ucase
)},
{
"UNCOMPRESS"
,
F_SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_uncompress
)},
{
"UNCOMPRESSED_LENGTH"
,
F_SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_uncompressed_length
)},
{
"UNHEX"
,
F_SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_unhex
)},
{
"UNIQUE_USERS"
,
SYM
(
UNIQUE_USERS
)},
{
"UNIX_TIMESTAMP"
,
SYM
(
UNIX_TIMESTAMP
)},
{
"UPPER"
,
F_SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_ucase
)},
...
...
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