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
13e04a85
Commit
13e04a85
authored
Feb 13, 2004
by
vva@eagle.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some optimization in append_identifier (sql/sql_show.cc)
parent
e8fb5a1d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
sql/sql_show.cc
sql/sql_show.cc
+14
-11
No files found.
sql/sql_show.cc
View file @
13e04a85
...
@@ -1086,7 +1086,7 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
...
@@ -1086,7 +1086,7 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
static
bool
require_quotes
(
const
char
*
name
,
uint
length
)
static
inline
const
char
*
require_quotes
(
const
char
*
name
,
uint
length
)
{
{
uint
i
,
d
,
c
;
uint
i
,
d
,
c
;
for
(
i
=
0
;
i
<
length
;
i
+=
d
)
for
(
i
=
0
;
i
<
length
;
i
+=
d
)
...
@@ -1094,7 +1094,7 @@ static bool require_quotes(const char *name, uint length)
...
@@ -1094,7 +1094,7 @@ static bool require_quotes(const char *name, uint length)
c
=
((
uchar
*
)
name
)[
i
];
c
=
((
uchar
*
)
name
)[
i
];
d
=
my_mbcharlen
(
system_charset_info
,
c
);
d
=
my_mbcharlen
(
system_charset_info
,
c
);
if
(
d
==
1
&&
!
system_charset_info
->
ident_map
[
c
])
if
(
d
==
1
&&
!
system_charset_info
->
ident_map
[
c
])
return
1
;
return
name
+
i
;
}
}
return
0
;
return
0
;
}
}
...
@@ -1113,7 +1113,8 @@ static bool require_quotes(const char *name, uint length)
...
@@ -1113,7 +1113,8 @@ static bool require_quotes(const char *name, uint length)
0 string doesn't contain required char
0 string doesn't contain required char
*/
*/
static
const
char
*
look_for_char
(
const
char
*
name
,
uint
length
,
char
q
)
static
inline
const
char
*
look_for_char
(
const
char
*
name
,
uint
length
,
char
q
)
{
{
const
char
*
cur
=
name
;
const
char
*
cur
=
name
;
const
char
*
end
=
cur
+
length
;
const
char
*
end
=
cur
+
length
;
...
@@ -1141,27 +1142,29 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
...
@@ -1141,27 +1142,29 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
if
(
is_keyword
(
name
,
length
))
if
(
is_keyword
(
name
,
length
))
{
{
packet
->
append
(
&
qtype
,
1
);
packet
->
append
(
&
qtype
,
1
,
system_charset_info
);
packet
->
append
(
name
,
length
,
system_charset_info
);
packet
->
append
(
name
,
length
,
system_charset_info
);
packet
->
append
(
&
qtype
,
1
);
packet
->
append
(
&
qtype
,
1
,
system_charset_info
);
}
}
else
else
{
{
if
(
!
require_quotes
(
name
,
length
))
if
(
!
(
qplace
=
require_quotes
(
name
,
length
)
))
{
{
if
(
!
(
thd
->
options
&
OPTION_QUOTE_SHOW_CREATE
))
if
(
!
(
thd
->
options
&
OPTION_QUOTE_SHOW_CREATE
))
packet
->
append
(
name
,
length
,
system_charset_info
);
packet
->
append
(
name
,
length
,
system_charset_info
);
else
else
{
{
packet
->
append
(
&
qtype
,
1
);
packet
->
append
(
&
qtype
,
1
,
system_charset_info
);
packet
->
append
(
name
,
length
,
system_charset_info
);
packet
->
append
(
name
,
length
,
system_charset_info
);
packet
->
append
(
&
qtype
,
1
);
packet
->
append
(
&
qtype
,
1
,
system_charset_info
);
}
}
}
}
else
else
{
{
packet
->
append
(
&
qtype
,
1
);
packet
->
shrink
(
packet
->
length
()
+
length
+
2
);
qplace
=
look_for_char
(
name
,
length
,
qtype
);
packet
->
append
(
&
qtype
,
1
,
system_charset_info
);
if
(
*
qplace
!=
qtype
)
qplace
=
look_for_char
(
qplace
+
1
,
length
-
(
qplace
-
name
)
-
1
,
qtype
);
while
(
qplace
)
while
(
qplace
)
{
{
if
((
part_len
=
qplace
-
name
))
if
((
part_len
=
qplace
-
name
))
...
@@ -1174,7 +1177,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
...
@@ -1174,7 +1177,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
qplace
=
look_for_char
(
name
+
1
,
length
-
1
,
qtype
);
qplace
=
look_for_char
(
name
+
1
,
length
-
1
,
qtype
);
}
}
packet
->
append
(
name
,
length
,
system_charset_info
);
packet
->
append
(
name
,
length
,
system_charset_info
);
packet
->
append
(
&
qtype
,
1
);
packet
->
append
(
&
qtype
,
1
,
system_charset_info
);
}
}
}
}
}
}
...
...
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