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
7c1748a1
Commit
7c1748a1
authored
Jun 14, 2006
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup String::set(integer)
parent
98b03424
Changes
6
Hide 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 @
7c1748a1
...
...
@@ -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
);
}
...
...
sql/item.cc
View file @
7c1748a1
...
...
@@ -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
;
}
...
...
sql/item_func.cc
View file @
7c1748a1
...
...
@@ -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
;
}
...
...
sql/item_sum.cc
View file @
7c1748a1
...
...
@@ -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:
...
...
sql/sql_string.cc
View file @
7c1748a1
...
...
@@ -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
;
}
...
...
sql/sql_string.h
View file @
7c1748a1
...
...
@@ -139,8 +139,11 @@ public:
}
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
);
/*
...
...
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