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
99fd8f72
Commit
99fd8f72
authored
18 years ago
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup String::set(integer)
parent
7549dac0
Branches unavailable
Tags unavailable
No related merge requests found
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
43 deletions
+15
-43
sql/field.cc
sql/field.cc
+1
-4
sql/item.cc
sql/item.cc
+1
-4
sql/item_func.cc
sql/item_func.cc
+4
-16
sql/item_sum.cc
sql/item_sum.cc
+1
-4
sql/sql_string.cc
sql/sql_string.cc
+3
-13
sql/sql_string.h
sql/sql_string.h
+5
-2
No files found.
sql/field.cc
View file @
99fd8f72
...
...
@@ -7125,10 +7125,7 @@ int Field_blob::store(double nr)
int
Field_blob
::
store
(
longlong
nr
,
bool
unsigned_val
)
{
CHARSET_INFO
*
cs
=
charset
();
if
(
unsigned_val
)
value
.
set
((
ulonglong
)
nr
,
cs
);
else
value
.
set
(
nr
,
cs
);
value
.
set
(
nr
,
unsigned_val
,
cs
);
return
Field_blob
::
store
(
value
.
ptr
(),
(
uint
)
value
.
length
(),
cs
);
}
...
...
This diff is collapsed.
Click to expand it.
sql/item.cc
View file @
99fd8f72
...
...
@@ -212,10 +212,7 @@ String *Item::val_string_from_int(String *str)
longlong
nr
=
val_int
();
if
(
null_value
)
return
0
;
if
(
unsigned_flag
)
str
->
set
((
ulonglong
)
nr
,
&
my_charset_bin
);
else
str
->
set
(
nr
,
&
my_charset_bin
);
str
->
set
(
nr
,
unsigned_flag
,
&
my_charset_bin
);
return
str
;
}
...
...
This diff is collapsed.
Click to expand it.
sql/item_func.cc
View file @
99fd8f72
...
...
@@ -556,10 +556,7 @@ String *Item_int_func::val_str(String *str)
longlong
nr
=
val_int
();
if
(
null_value
)
return
0
;
if
(
!
unsigned_flag
)
str
->
set
(
nr
,
&
my_charset_bin
);
else
str
->
set
((
ulonglong
)
nr
,
&
my_charset_bin
);
str
->
set
(
nr
,
unsigned_flag
,
&
my_charset_bin
);
return
str
;
}
...
...
@@ -701,10 +698,7 @@ String *Item_func_numhybrid::val_str(String *str)
longlong
nr
=
int_op
();
if
(
null_value
)
return
0
;
/* purecov: inspected */
if
(
!
unsigned_flag
)
str
->
set
(
nr
,
&
my_charset_bin
);
else
str
->
set
((
ulonglong
)
nr
,
&
my_charset_bin
);
str
->
set
(
nr
,
unsigned_flag
,
&
my_charset_bin
);
break
;
}
case
REAL_RESULT
:
...
...
@@ -2058,10 +2052,7 @@ String *Item_func_min_max::val_str(String *str)
longlong
nr
=
val_int
();
if
(
null_value
)
return
0
;
if
(
!
unsigned_flag
)
str
->
set
(
nr
,
&
my_charset_bin
);
else
str
->
set
((
ulonglong
)
nr
,
&
my_charset_bin
);
str
->
set
(
nr
,
unsigned_flag
,
&
my_charset_bin
);
return
str
;
}
case
DECIMAL_RESULT
:
...
...
@@ -2847,10 +2838,7 @@ String *Item_func_udf_int::val_str(String *str)
longlong
nr
=
val_int
();
if
(
null_value
)
return
0
;
if
(
!
unsigned_flag
)
str
->
set
(
nr
,
&
my_charset_bin
);
else
str
->
set
((
ulonglong
)
nr
,
&
my_charset_bin
);
str
->
set
(
nr
,
unsigned_flag
,
&
my_charset_bin
);
return
str
;
}
...
...
This diff is collapsed.
Click to expand it.
sql/item_sum.cc
View file @
99fd8f72
...
...
@@ -1584,10 +1584,7 @@ Item_sum_hybrid::val_str(String *str)
my_decimal2string
(
E_DEC_FATAL_ERROR
,
&
sum_dec
,
0
,
0
,
0
,
str
);
return
str
;
case
INT_RESULT
:
if
(
unsigned_flag
)
str
->
set
((
ulonglong
)
sum_int
,
&
my_charset_bin
);
else
str
->
set
((
longlong
)
sum_int
,
&
my_charset_bin
);
str
->
set
(
sum_int
,
unsigned_flag
,
&
my_charset_bin
);
break
;
case
ROW_RESULT
:
default:
...
...
This diff is collapsed.
Click to expand it.
sql/sql_string.cc
View file @
99fd8f72
...
...
@@ -96,24 +96,14 @@ bool String::realloc(uint32 alloc_length)
return
FALSE
;
}
bool
String
::
set
(
longlong
num
,
CHARSET_INFO
*
cs
)
bool
String
::
set
(
longlong
num
,
bool
unsigned_flag
,
CHARSET_INFO
*
cs
)
{
uint
l
=
20
*
cs
->
mbmaxlen
+
1
;
int
base
=
unsigned_flag
?
10
:
-
10
;
if
(
alloc
(
l
))
return
TRUE
;
str_length
=
(
uint32
)
(
cs
->
cset
->
longlong10_to_str
)(
cs
,
Ptr
,
l
,
-
10
,
num
);
str_charset
=
cs
;
return
FALSE
;
}
bool
String
::
set
(
ulonglong
num
,
CHARSET_INFO
*
cs
)
{
uint
l
=
20
*
cs
->
mbmaxlen
+
1
;
if
(
alloc
(
l
))
return
TRUE
;
str_length
=
(
uint32
)
(
cs
->
cset
->
longlong10_to_str
)(
cs
,
Ptr
,
l
,
10
,
num
);
str_length
=
(
uint32
)
(
cs
->
cset
->
longlong10_to_str
)(
cs
,
Ptr
,
l
,
base
,
num
);
str_charset
=
cs
;
return
FALSE
;
}
...
...
This diff is collapsed.
Click to expand it.
sql/sql_string.h
View file @
99fd8f72
...
...
@@ -139,8 +139,11 @@ class String
}
str_charset
=
cs
;
}
bool
set
(
longlong
num
,
CHARSET_INFO
*
cs
);
bool
set
(
ulonglong
num
,
CHARSET_INFO
*
cs
);
bool
set
(
longlong
num
,
bool
unsigned_flag
,
CHARSET_INFO
*
cs
);
bool
set
(
longlong
num
,
CHARSET_INFO
*
cs
)
{
return
set
(
num
,
false
,
cs
);
}
bool
set
(
ulonglong
num
,
CHARSET_INFO
*
cs
)
{
return
set
((
longlong
)
num
,
true
,
cs
);
}
bool
set
(
double
num
,
uint
decimals
,
CHARSET_INFO
*
cs
);
/*
...
...
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