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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
24d6ec8d
Commit
24d6ec8d
authored
Dec 05, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17907 Class Static_binary_string
parent
d6a00d9b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
240 additions
and
217 deletions
+240
-217
sql/sql_string.cc
sql/sql_string.cc
+8
-28
sql/sql_string.h
sql/sql_string.h
+232
-189
No files found.
sql/sql_string.cc
View file @
24d6ec8d
...
@@ -156,7 +156,7 @@ static inline void APPEND_HEX(char *&to, uchar value)
...
@@ -156,7 +156,7 @@ static inline void APPEND_HEX(char *&to, uchar value)
}
}
void
String
::
qs_append_hex
(
const
char
*
str
,
uint32
len
)
void
St
atic_binary_st
ring
::
qs_append_hex
(
const
char
*
str
,
uint32
len
)
{
{
const
char
*
str_end
=
str
+
len
;
const
char
*
str_end
=
str
+
len
;
for
(
char
*
to
=
Ptr
+
str_length
;
str
<
str_end
;
str
++
)
for
(
char
*
to
=
Ptr
+
str_length
;
str
<
str_end
;
str
++
)
...
@@ -677,7 +677,7 @@ bool String::append_with_prefill(const char *s,uint32 arg_length,
...
@@ -677,7 +677,7 @@ bool String::append_with_prefill(const char *s,uint32 arg_length,
}
}
int
St
ring
::
strstr
(
const
String
&
s
,
uint32
offset
)
int
St
atic_binary_string
::
strstr
(
const
Static_binary_string
&
s
,
uint32
offset
)
{
{
if
(
s
.
length
()
+
offset
<=
str_length
)
if
(
s
.
length
()
+
offset
<=
str_length
)
{
{
...
@@ -708,7 +708,7 @@ int String::strstr(const String &s,uint32 offset)
...
@@ -708,7 +708,7 @@ int String::strstr(const String &s,uint32 offset)
** Search string from end. Offset is offset to the end of string
** Search string from end. Offset is offset to the end of string
*/
*/
int
St
ring
::
strrstr
(
const
String
&
s
,
uint32
offset
)
int
St
atic_binary_string
::
strrstr
(
const
Static_binary_string
&
s
,
uint32
offset
)
{
{
if
(
s
.
length
()
<=
offset
&&
offset
<=
str_length
)
if
(
s
.
length
()
<=
offset
&&
offset
<=
str_length
)
{
{
...
@@ -787,34 +787,34 @@ int String::reserve(size_t space_needed, size_t grow_by)
...
@@ -787,34 +787,34 @@ int String::reserve(size_t space_needed, size_t grow_by)
return
FALSE
;
return
FALSE
;
}
}
void
String
::
qs_append
(
const
char
*
str
,
size_t
len
)
void
St
atic_binary_st
ring
::
qs_append
(
const
char
*
str
,
size_t
len
)
{
{
memcpy
(
Ptr
+
str_length
,
str
,
len
+
1
);
memcpy
(
Ptr
+
str_length
,
str
,
len
+
1
);
str_length
+=
(
uint32
)
len
;
str_length
+=
(
uint32
)
len
;
}
}
void
String
::
qs_append
(
double
d
)
void
St
atic_binary_st
ring
::
qs_append
(
double
d
)
{
{
char
*
buff
=
Ptr
+
str_length
;
char
*
buff
=
Ptr
+
str_length
;
str_length
+=
(
uint32
)
my_gcvt
(
d
,
MY_GCVT_ARG_DOUBLE
,
FLOATING_POINT_BUFFER
-
1
,
buff
,
str_length
+=
(
uint32
)
my_gcvt
(
d
,
MY_GCVT_ARG_DOUBLE
,
FLOATING_POINT_BUFFER
-
1
,
buff
,
NULL
);
NULL
);
}
}
void
String
::
qs_append
(
double
*
d
)
void
St
atic_binary_st
ring
::
qs_append
(
double
*
d
)
{
{
double
ld
;
double
ld
;
float8get
(
ld
,
(
char
*
)
d
);
float8get
(
ld
,
(
char
*
)
d
);
qs_append
(
ld
);
qs_append
(
ld
);
}
}
void
String
::
qs_append
(
int
i
)
void
St
atic_binary_st
ring
::
qs_append
(
int
i
)
{
{
char
*
buff
=
Ptr
+
str_length
;
char
*
buff
=
Ptr
+
str_length
;
char
*
end
=
int10_to_str
(
i
,
buff
,
-
10
);
char
*
end
=
int10_to_str
(
i
,
buff
,
-
10
);
str_length
+=
(
int
)
(
end
-
buff
);
str_length
+=
(
int
)
(
end
-
buff
);
}
}
void
String
::
qs_append
(
ulonglong
i
)
void
St
atic_binary_st
ring
::
qs_append
(
ulonglong
i
)
{
{
char
*
buff
=
Ptr
+
str_length
;
char
*
buff
=
Ptr
+
str_length
;
char
*
end
=
longlong10_to_str
(
i
,
buff
,
10
);
char
*
end
=
longlong10_to_str
(
i
,
buff
,
10
);
...
@@ -1149,26 +1149,6 @@ void String::print_with_conversion(String *print, CHARSET_INFO *cs) const
...
@@ -1149,26 +1149,6 @@ void String::print_with_conversion(String *print, CHARSET_INFO *cs) const
}
}
/*
Exchange state of this object and argument.
SYNOPSIS
String::swap()
RETURN
Target string will contain state of this object and vice versa.
*/
void
String
::
swap
(
String
&
s
)
{
swap_variables
(
char
*
,
Ptr
,
s
.
Ptr
);
swap_variables
(
uint32
,
str_length
,
s
.
str_length
);
swap_variables
(
uint32
,
Alloced_length
,
s
.
Alloced_length
);
swap_variables
(
bool
,
alloced
,
s
.
alloced
);
Charset
::
swap
(
s
);
}
/**
/**
Convert string to printable ASCII string
Convert string to printable ASCII string
...
...
sql/sql_string.h
View file @
24d6ec8d
This diff is collapsed.
Click to expand it.
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