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
dedb5843
Commit
dedb5843
authored
Nov 06, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
String->copy() now has a charset arg
parent
6d7d19b8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
18 deletions
+20
-18
sql/field.cc
sql/field.cc
+1
-1
sql/field.h
sql/field.h
+1
-1
sql/item_func.cc
sql/item_func.cc
+2
-3
sql/item_strfunc.cc
sql/item_strfunc.cc
+7
-5
sql/item_sum.cc
sql/item_sum.cc
+1
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+2
-2
sql/procedure.h
sql/procedure.h
+1
-1
sql/sql_string.cc
sql/sql_string.cc
+4
-3
sql/sql_string.h
sql/sql_string.h
+1
-1
No files found.
sql/field.cc
View file @
dedb5843
...
...
@@ -4302,7 +4302,7 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs)
}
}
#endif
/* USE_TIS620 */
value
.
copy
(
from
,
len
);
value
.
copy
(
from
,
len
,
charset
()
);
from
=
value
.
ptr
();
#ifdef USE_TIS620
my_free
(
th_ptr
,
MYF
(
MY_ALLOW_ZERO_PTR
));
...
...
sql/field.h
View file @
dedb5843
...
...
@@ -887,7 +887,7 @@ class Field_blob :public Field_str {
inline
bool
copy
()
{
char
*
tmp
;
get_ptr
(
&
tmp
);
if
(
value
.
copy
(
tmp
,
get_length
()))
if
(
value
.
copy
(
tmp
,
get_length
()
,
charset
()
))
{
Field_blob
::
reset
();
return
1
;
...
...
sql/item_func.cc
View file @
dedb5843
...
...
@@ -1568,7 +1568,7 @@ void item_user_lock_release(ULL *ull)
char
buf
[
256
];
const
char
*
command
=
"DO RELEASE_LOCK(
\"
"
;
String
tmp
(
buf
,
sizeof
(
buf
),
system_charset_info
);
tmp
.
copy
(
command
,
strlen
(
command
));
tmp
.
copy
(
command
,
strlen
(
command
)
,
tmp
.
charset
()
);
tmp
.
append
(
ull
->
key
,
ull
->
key_length
);
tmp
.
append
(
"
\"
)"
);
Query_log_event
qev
(
current_thd
,
tmp
.
ptr
(),
tmp
.
length
());
...
...
@@ -2040,12 +2040,11 @@ Item_func_get_user_var::val_str(String *str)
str
->
set
(
*
(
longlong
*
)
entry
->
value
,
thd_charset
());
break
;
case
STRING_RESULT
:
if
(
str
->
copy
(
entry
->
value
,
entry
->
length
-
1
))
if
(
str
->
copy
(
entry
->
value
,
entry
->
length
-
1
,
entry
->
var_charset
))
{
null_value
=
1
;
return
NULL
;
}
str
->
set_charset
(
entry
->
var_charset
);
break
;
}
return
str
;
...
...
sql/item_strfunc.cc
View file @
dedb5843
...
...
@@ -1373,7 +1373,7 @@ String *Item_func_database::val_str(String *str)
String
*
Item_func_user
::
val_str
(
String
*
str
)
{
THD
*
thd
=
current_thd
;
if
(
str
->
copy
((
const
char
*
)
thd
->
user
,(
uint
)
strlen
(
thd
->
user
))
||
if
(
str
->
copy
((
const
char
*
)
thd
->
user
,(
uint
)
strlen
(
thd
->
user
)
,
system_charset_info
)
||
str
->
append
(
'@'
)
||
str
->
append
(
thd
->
host
?
thd
->
host
:
thd
->
ip
?
thd
->
ip
:
""
))
return
&
empty_string
;
...
...
@@ -1899,7 +1899,7 @@ String *Item_func_conv::val_str(String *str)
else
dec
=
(
longlong
)
strtoull
(
res
->
c_ptr
(),
&
endptr
,
from_base
);
ptr
=
longlong2str
(
dec
,
ans
,
to_base
);
if
(
str
->
copy
(
ans
,(
uint32
)
(
ptr
-
ans
)))
if
(
str
->
copy
(
ans
,(
uint32
)
(
ptr
-
ans
)
,
thd_charset
()
))
return
&
empty_string
;
return
str
;
}
...
...
@@ -2120,7 +2120,7 @@ String *Item_func_charset::val_str(String *str)
if
((
null_value
=
(
args
[
0
]
->
null_value
||
!
res
->
charset
())))
return
0
;
str
->
copy
(
res
->
charset
()
->
name
,
strlen
(
res
->
charset
()
->
name
));
str
->
copy
(
res
->
charset
()
->
name
,
strlen
(
res
->
charset
()
->
name
)
,
default_charset_info
);
return
str
;
}
...
...
@@ -2135,7 +2135,7 @@ String *Item_func_hex::val_str(String *str)
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
ptr
=
longlong2str
(
dec
,
ans
,
16
);
if
(
str
->
copy
(
ans
,(
uint32
)
(
ptr
-
ans
)))
if
(
str
->
copy
(
ans
,(
uint32
)
(
ptr
-
ans
)
,
default_charset_info
))
return
&
empty_string
;
// End of memory
return
str
;
}
...
...
@@ -2454,7 +2454,9 @@ String *Item_func_geometry_type::val_str(String *str)
if
((
null_value
=
(
args
[
0
]
->
null_value
||
geom
.
create_from_wkb
(
wkt
->
ptr
(),
wkt
->
length
()))))
return
0
;
str
->
copy
(
geom
.
get_class_info
()
->
m_name
,
strlen
(
geom
.
get_class_info
()
->
m_name
));
str
->
copy
(
geom
.
get_class_info
()
->
m_name
,
strlen
(
geom
.
get_class_info
()
->
m_name
),
default_charset_info
);
return
str
;
}
...
...
sql/item_sum.cc
View file @
dedb5843
...
...
@@ -106,7 +106,7 @@ Item_sum_int::val_str(String *str)
return
0
;
char
buff
[
21
];
uint
length
=
(
uint
)
(
longlong10_to_str
(
nr
,
buff
,
-
10
)
-
buff
);
str
->
copy
(
buff
,
length
);
str
->
copy
(
buff
,
length
,
thd_charset
()
);
return
str
;
}
...
...
sql/item_timefunc.cc
View file @
dedb5843
...
...
@@ -396,7 +396,7 @@ String *Item_date::val_str(String *str)
return
(
String
*
)
0
;
if
(
!
value
)
// zero daynr
{
str
->
copy
(
"0000-00-00"
,
10
);
str
->
copy
(
"0000-00-00"
,
10
,
my_charset_latin1
);
return
str
;
}
if
(
str
->
alloc
(
11
))
...
...
@@ -547,7 +547,7 @@ String *Item_func_sec_to_time::val_str(String *str)
uint
sec
=
(
uint
)
((
ulonglong
)
seconds
%
3600
);
length
=
my_sprintf
(
buff
,(
buff
,
"%s%02lu:%02u:%02u"
,
sign
,(
long
)
(
seconds
/
3600
),
sec
/
60
,
sec
%
60
));
str
->
copy
(
buff
,
length
);
str
->
copy
(
buff
,
length
,
my_charset_latin1
);
return
str
;
}
...
...
sql/procedure.h
View file @
dedb5843
...
...
@@ -94,7 +94,7 @@ class Item_proc_string :public Item_proc
enum_field_types
field_type
()
const
{
return
FIELD_TYPE_STRING
;
}
void
set
(
double
nr
)
{
str_value
.
set
(
nr
,
2
,
my_thd_charset
);
}
void
set
(
longlong
nr
)
{
str_value
.
set
(
nr
,
my_thd_charset
);
}
void
set
(
const
char
*
str
,
uint
length
)
{
str_value
.
copy
(
str
,
length
);
}
void
set
(
const
char
*
str
,
uint
length
)
{
str_value
.
copy
(
str
,
length
,
my_thd_charset
);
}
double
val
()
{
return
atof
(
str_value
.
ptr
());
}
longlong
val_int
()
{
return
strtoll
(
str_value
.
ptr
(),
NULL
,
10
);
}
String
*
val_str
(
String
*
)
...
...
sql/sql_string.cc
View file @
dedb5843
...
...
@@ -117,7 +117,7 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
if
(
decimals
>=
NOT_FIXED_DEC
)
{
sprintf
(
buff
,
"%.14g"
,
num
);
// Enough for a DATETIME
return
copy
(
buff
,
(
uint32
)
strlen
(
buff
));
return
copy
(
buff
,
(
uint32
)
strlen
(
buff
)
,
my_charset_latin1
);
}
#ifdef HAVE_FCONVERT
int
decpt
,
sign
;
...
...
@@ -182,7 +182,7 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
#else
sprintf
(
buff
,
"%.*f"
,(
int
)
decimals
,
num
);
#endif
return
copy
(
buff
,(
uint32
)
strlen
(
buff
));
return
copy
(
buff
,(
uint32
)
strlen
(
buff
)
,
my_charset_latin1
);
#endif
}
...
...
@@ -208,13 +208,14 @@ bool String::copy(const String &str)
return
FALSE
;
}
bool
String
::
copy
(
const
char
*
str
,
uint32
arg_length
)
bool
String
::
copy
(
const
char
*
str
,
uint32
arg_length
,
CHARSET_INFO
*
cs
)
{
if
(
alloc
(
arg_length
))
return
TRUE
;
if
((
str_length
=
arg_length
))
memcpy
(
Ptr
,
str
,
arg_length
);
Ptr
[
arg_length
]
=
0
;
str_charset
=
cs
;
return
FALSE
;
}
...
...
sql/sql_string.h
View file @
dedb5843
...
...
@@ -178,7 +178,7 @@ class String
bool
copy
();
// Alloc string if not alloced
bool
copy
(
const
String
&
s
);
// Allocate new string
bool
copy
(
const
char
*
s
,
uint32
arg_length
);
// Allocate new string
bool
copy
(
const
char
*
s
,
uint32
arg_length
,
CHARSET_INFO
*
cs
);
// Allocate new string
bool
append
(
const
String
&
s
);
bool
append
(
const
char
*
s
,
uint32
arg_length
=
0
);
bool
append
(
IO_CACHE
*
file
,
uint32
arg_length
);
...
...
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