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
e317de4d
Commit
e317de4d
authored
Dec 09, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More use of new str->num conversion routines
parent
e174f9d8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
15 deletions
+24
-15
sql/procedure.h
sql/procedure.h
+18
-9
sql/sql_analyse.cc
sql/sql_analyse.cc
+6
-6
No files found.
sql/procedure.h
View file @
e317de4d
...
...
@@ -35,10 +35,10 @@ class Item_proc :public Item
}
enum
Type
type
()
const
{
return
Item
::
PROC_ITEM
;
}
virtual
void
set
(
double
nr
)
=
0
;
virtual
void
set
(
const
char
*
str
,
uint
length
)
=
0
;
virtual
void
set
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
=
0
;
virtual
void
set
(
longlong
nr
)
=
0
;
virtual
enum_field_types
field_type
()
const
=
0
;
void
set
(
const
char
*
str
)
{
set
(
str
,(
uint
)
strlen
(
str
));
}
void
set
(
const
char
*
str
)
{
set
(
str
,(
uint
)
strlen
(
str
)
,
thd_charset
()
);
}
void
make_field
(
Send_field
*
tmp_field
)
{
init_make_field
(
tmp_field
,
field_type
());
...
...
@@ -58,8 +58,8 @@ class Item_proc_real :public Item_proc
enum_field_types
field_type
()
const
{
return
FIELD_TYPE_DOUBLE
;
}
void
set
(
double
nr
)
{
value
=
nr
;
}
void
set
(
longlong
nr
)
{
value
=
(
double
)
nr
;
}
void
set
(
const
char
*
str
,
uint
length
__attribute__
((
unused
))
)
{
value
=
atof
(
str
);
}
void
set
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
{
value
=
my_strntod
(
cs
,
str
,
length
,(
char
**
)
0
);
}
double
val
()
{
return
value
;
}
longlong
val_int
()
{
return
(
longlong
)
value
;
}
String
*
val_str
(
String
*
s
)
{
s
->
set
(
value
,
decimals
,
thd_charset
());
return
s
;
}
...
...
@@ -76,8 +76,8 @@ class Item_proc_int :public Item_proc
enum_field_types
field_type
()
const
{
return
FIELD_TYPE_LONG
;
}
void
set
(
double
nr
)
{
value
=
(
longlong
)
nr
;
}
void
set
(
longlong
nr
)
{
value
=
nr
;
}
void
set
(
const
char
*
str
,
uint
length
__attribute__
((
unused
))
)
{
value
=
strtoll
(
str
,
NULL
,
10
);
}
void
set
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
{
value
=
my_strntoll
(
cs
,
str
,
length
,
NULL
,
10
);
}
double
val
()
{
return
(
double
)
value
;
}
longlong
val_int
()
{
return
value
;
}
String
*
val_str
(
String
*
s
)
{
s
->
set
(
value
,
thd_charset
());
return
s
;
}
...
...
@@ -94,9 +94,18 @@ 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
,
thd_charset
());
}
void
set
(
longlong
nr
)
{
str_value
.
set
(
nr
,
thd_charset
());
}
void
set
(
const
char
*
str
,
uint
length
)
{
str_value
.
copy
(
str
,
length
,
thd_charset
());
}
double
val
()
{
return
atof
(
str_value
.
ptr
());
}
longlong
val_int
()
{
return
strtoll
(
str_value
.
ptr
(),
NULL
,
10
);
}
void
set
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
{
str_value
.
copy
(
str
,
length
,
cs
);
}
double
val
()
{
CHARSET_INFO
*
cs
=
str_value
.
charset
();
return
my_strntod
(
cs
,
str_value
.
ptr
(),
str_value
.
length
(),(
char
**
)
0
);
}
longlong
val_int
()
{
CHARSET_INFO
*
cs
=
str_value
.
charset
();
return
my_strntoll
(
cs
,
str_value
.
ptr
(),
str_value
.
length
(),
NULL
,
10
);
}
String
*
val_str
(
String
*
)
{
return
null_value
?
(
String
*
)
0
:
(
String
*
)
&
str_value
;
...
...
sql/sql_analyse.cc
View file @
e317de4d
...
...
@@ -593,23 +593,23 @@ bool analyse::end_of_records()
{
func_items
[
1
]
->
null_value
=
0
;
res
=
(
*
f
)
->
get_min_arg
(
&
s_min
);
func_items
[
1
]
->
set
(
res
->
ptr
(),
res
->
length
());
func_items
[
1
]
->
set
(
res
->
ptr
(),
res
->
length
()
,
res
->
charset
()
);
func_items
[
2
]
->
null_value
=
0
;
res
=
(
*
f
)
->
get_max_arg
(
&
s_max
);
func_items
[
2
]
->
set
(
res
->
ptr
(),
res
->
length
());
func_items
[
2
]
->
set
(
res
->
ptr
(),
res
->
length
()
,
res
->
charset
()
);
}
func_items
[
3
]
->
set
((
longlong
)
(
*
f
)
->
min_length
);
func_items
[
4
]
->
set
((
longlong
)
(
*
f
)
->
max_length
);
func_items
[
5
]
->
set
((
longlong
)
(
*
f
)
->
empty
);
func_items
[
6
]
->
set
((
longlong
)
(
*
f
)
->
nulls
);
res
=
(
*
f
)
->
avg
(
&
s_max
,
rows
);
func_items
[
7
]
->
set
(
res
->
ptr
(),
res
->
length
());
func_items
[
7
]
->
set
(
res
->
ptr
(),
res
->
length
()
,
res
->
charset
()
);
func_items
[
8
]
->
null_value
=
0
;
res
=
(
*
f
)
->
std
(
&
s_max
,
rows
);
if
(
!
res
)
func_items
[
8
]
->
null_value
=
1
;
else
func_items
[
8
]
->
set
(
res
->
ptr
(),
res
->
length
());
func_items
[
8
]
->
set
(
res
->
ptr
(),
res
->
length
()
,
res
->
charset
()
);
// count the dots, quotas, etc. in (ENUM("a","b","c"...))
// if tree has been removed, don't suggest ENUM.
// treemem is used to measure the size of tree for strings,
...
...
@@ -640,7 +640,7 @@ bool analyse::end_of_records()
if
(
!
(
*
f
)
->
nulls
)
tmp_str
.
append
(
" NOT NULL"
);
output_str_length
=
tmp_str
.
length
();
func_items
[
9
]
->
set
(
tmp_str
.
ptr
(),
tmp_str
.
length
());
func_items
[
9
]
->
set
(
tmp_str
.
ptr
(),
tmp_str
.
length
()
,
tmp_str
.
charset
()
);
if
(
result
->
send_data
(
result_fields
))
return
-
1
;
continue
;
...
...
@@ -687,7 +687,7 @@ bool analyse::end_of_records()
}
if
(
!
(
*
f
)
->
nulls
)
ans
.
append
(
" NOT NULL"
);
func_items
[
9
]
->
set
(
ans
.
ptr
(),
ans
.
length
());
func_items
[
9
]
->
set
(
ans
.
ptr
(),
ans
.
length
()
,
ans
.
charset
()
);
if
(
result
->
send_data
(
result_fields
))
return
-
1
;
}
...
...
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