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
6148e5a4
Commit
6148e5a4
authored
Aug 10, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QUOTE() code cleanup
mysql-test/r/func_str.result: cleanup sql/item_strfunc.cc: cleanup
parent
9b1d739e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+1
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+6
-6
No files found.
mysql-test/r/func_str.result
View file @
6148e5a4
...
@@ -148,7 +148,7 @@ decode(encode("abcdef","monty"),"monty")="abcdef"
...
@@ -148,7 +148,7 @@ decode(encode("abcdef","monty"),"monty")="abcdef"
1
1
select quote('\'\"\\test');
select quote('\'\"\\test');
quote('\'\"\\test')
quote('\'\"\\test')
'\'
\
"\\test'
'\'"\\test'
select quote(concat('abc\'', '\\cba'));
select quote(concat('abc\'', '\\cba'));
quote(concat('abc\'', '\\cba'))
quote(concat('abc\'', '\\cba'))
'abc\'\\cba'
'abc\'\\cba'
...
...
sql/item_strfunc.cc
View file @
6148e5a4
...
@@ -2071,13 +2071,15 @@ String* Item_func_inet_ntoa::val_str(String* str)
...
@@ -2071,13 +2071,15 @@ String* Item_func_inet_ntoa::val_str(String* str)
return
str
;
return
str
;
}
}
#define get_esc_bit(mask, num) (1 & (*((mask) + ((num) >> 3))) >> ((num) & 7))
/*
/*
QUOTE() function returns argument string in single quotes,
QUOTE() function returns argument string in single quotes,
also adds a \ before \, ' CHAR(0) and CHAR(24)
also adds a \ before \, ' CHAR(0) and CHAR(24)
*/
*/
String
*
Item_func_quote
::
val_str
(
String
*
str
)
String
*
Item_func_quote
::
val_str
(
String
*
str
)
{
{
static
char
escmask
[
64
]
=
{
0x01
,
0x00
,
0x00
,
0x04
,
0x80
,
0x00
,
0x00
,
0x00
,
static
char
escmask
[
32
]
=
{
0x01
,
0x00
,
0x00
,
0x04
,
0x80
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x10
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x10
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
...
@@ -2089,10 +2091,8 @@ String *Item_func_quote::val_str(String *str)
...
@@ -2089,10 +2091,8 @@ String *Item_func_quote::val_str(String *str)
goto
null
;
goto
null
;
for
(
from
=
(
char
*
)
arg
->
ptr
(),
end
=
from
+
arg
->
length
();
from
<
end
;
from
++
)
for
(
from
=
(
char
*
)
arg
->
ptr
(),
end
=
from
+
arg
->
length
();
from
<
end
;
from
++
)
{
delta
+=
get_esc_bit
(
escmask
,
*
from
);
if
(
*
(
escmask
+
(
*
from
>>
3
))
and
(
1
<<
(
*
from
&
7
)))
delta
++
;
}
if
(
str
->
alloc
(
arg
->
length
()
+
delta
))
if
(
str
->
alloc
(
arg
->
length
()
+
delta
))
goto
null
;
goto
null
;
to
=
(
char
*
)
str
->
ptr
()
+
arg
->
length
()
+
delta
-
1
;
to
=
(
char
*
)
str
->
ptr
()
+
arg
->
length
()
+
delta
-
1
;
...
@@ -2101,7 +2101,7 @@ String *Item_func_quote::val_str(String *str)
...
@@ -2101,7 +2101,7 @@ String *Item_func_quote::val_str(String *str)
from
--
,
to
--
)
from
--
,
to
--
)
{
{
*
to
=
*
from
;
*
to
=
*
from
;
if
(
*
(
escmask
+
(
*
from
>>
3
))
and
(
1
<<
(
*
from
&
7
)
))
if
(
get_esc_bit
(
escmask
,
*
from
))
*--
to
=
'\\'
;
*--
to
=
'\\'
;
}
}
*
to
=
'\''
;
*
to
=
'\''
;
...
...
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