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
072abca4
Commit
072abca4
authored
Dec 09, 2002
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use of new string->number conversion routines
parent
8762e834
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
29 deletions
+12
-29
sql/field.cc
sql/field.cc
+12
-29
No files found.
sql/field.cc
View file @
072abca4
...
@@ -806,14 +806,11 @@ double Field_decimal::val_real(void)
...
@@ -806,14 +806,11 @@ double Field_decimal::val_real(void)
longlong
Field_decimal
::
val_int
(
void
)
longlong
Field_decimal
::
val_int
(
void
)
{
{
char
temp
=
*
(
ptr
+
field_length
);
*
(
ptr
+
field_length
)
=
'\0'
;
CHARSET_INFO
*
cs
=
charset
();
longlong
nr
;
if
(
unsigned_flag
)
if
(
unsigned_flag
)
nr
=
(
longlong
)
strtoull
(
ptr
,
NULL
,
10
);
return
my_strntoull
(
cs
,
ptr
,
field_length
,
NULL
,
10
);
else
else
nr
=
strtoll
(
ptr
,
NULL
,
10
);
return
my_strntoll
(
cs
,
ptr
,
field_length
,
NULL
,
10
);
*
(
ptr
+
field_length
)
=
temp
;
return
(
nr
);
}
}
String
*
Field_decimal
::
val_str
(
String
*
val_buffer
__attribute__
((
unused
)),
String
*
Field_decimal
::
val_str
(
String
*
val_buffer
__attribute__
((
unused
)),
...
@@ -1100,8 +1097,7 @@ void Field_tiny::sql_type(String &res) const
...
@@ -1100,8 +1097,7 @@ void Field_tiny::sql_type(String &res) const
****************************************************************************/
****************************************************************************/
// Note: Sometimes this should be fixed to use one strtol() to use
// Note: Sometimes this should be fixed to check for garbage after number.
// len and check for garbage after number.
int
Field_short
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_short
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
...
@@ -1363,8 +1359,7 @@ void Field_short::sql_type(String &res) const
...
@@ -1363,8 +1359,7 @@ void Field_short::sql_type(String &res) const
** medium int
** medium int
****************************************************************************/
****************************************************************************/
// Note: Sometimes this should be fixed to use one strtol() to use
// Note: Sometimes this should be fixed to check for garbage after number.
// len and check for garbage after number.
int
Field_medium
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_medium
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
...
@@ -1571,8 +1566,7 @@ void Field_medium::sql_type(String &res) const
...
@@ -1571,8 +1566,7 @@ void Field_medium::sql_type(String &res) const
****************************************************************************/
****************************************************************************/
// Note: Sometimes this should be fixed to use one strtol() to use
// Note: Sometimes this should be fixed to check for garbage after number.
// len and check for garbage after number.
int
Field_long
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_long
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
...
@@ -3806,11 +3800,8 @@ double Field_string::val_real(void)
...
@@ -3806,11 +3800,8 @@ double Field_string::val_real(void)
longlong
Field_string
::
val_int
(
void
)
longlong
Field_string
::
val_int
(
void
)
{
{
longlong
value
;
longlong
value
;
char
save
=
ptr
[
field_length
];
// Ok to patch record
CHARSET_INFO
*
cs
=
charset
();
ptr
[
field_length
]
=
0
;
return
my_strntoll
(
cs
,
ptr
,
field_length
,
NULL
,
10
);
value
=
strtoll
(
ptr
,
NULL
,
10
);
ptr
[
field_length
]
=
save
;
return
value
;
}
}
...
@@ -4010,13 +4001,9 @@ double Field_varstring::val_real(void)
...
@@ -4010,13 +4001,9 @@ double Field_varstring::val_real(void)
longlong
Field_varstring
::
val_int
(
void
)
longlong
Field_varstring
::
val_int
(
void
)
{
{
longlong
value
;
uint
length
=
uint2korr
(
ptr
)
+
2
;
uint
length
=
uint2korr
(
ptr
)
+
2
;
char
save
=
ptr
[
length
];
// Ok to patch record
CHARSET_INFO
*
cs
=
charset
();
ptr
[
length
]
=
0
;
return
my_strntoll
(
cs
,
ptr
+
2
,
length
,
NULL
,
10
);
value
=
strtoll
(
ptr
+
2
,
NULL
,
10
);
ptr
[
length
]
=
save
;
return
value
;
}
}
...
@@ -4355,12 +4342,8 @@ longlong Field_blob::val_int(void)
...
@@ -4355,12 +4342,8 @@ longlong Field_blob::val_int(void)
if
(
!
blob
)
if
(
!
blob
)
return
0
;
return
0
;
uint32
length
=
get_length
(
ptr
);
uint32
length
=
get_length
(
ptr
);
CHARSET_INFO
*
cs
=
charset
();
char
save
=
blob
[
length
];
// Ok to patch blob in NISAM
return
my_strntoll
(
cs
,
blob
,
length
,
NULL
,
10
);
blob
[
length
]
=
0
;
longlong
nr
=
strtoll
(
blob
,
NULL
,
10
);
blob
[
length
]
=
save
;
return
nr
;
}
}
...
...
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