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
80a28d45
Commit
80a28d45
authored
Sep 01, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed printing of real constants (BUG#5160)
parent
56d8567a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
+32
-3
mysql-test/r/view.result
mysql-test/r/view.result
+5
-0
mysql-test/t/view.test
mysql-test/t/view.test
+7
-0
sql/item.cc
sql/item.cc
+15
-0
sql/item.h
sql/item.h
+5
-3
No files found.
mysql-test/r/view.result
View file @
80a28d45
...
...
@@ -1217,3 +1217,8 @@ t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
drop view v1;
drop table t1;
create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
show create view v1;
Table Create Table
v1 CREATE VIEW `test`.`v1` AS select 99999999999999999999999999999999999999999999999999999 AS `col1`
drop view v1;
mysql-test/t/view.test
View file @
80a28d45
...
...
@@ -1161,3 +1161,10 @@ show table status;
show
table
status
;
drop
view
v1
;
drop
table
t1
;
#
# VIEW with floating point (long bumber) as column
#
create
view
v1
as
select
99999999999999999999999999999999999999999999999999999
as
col1
;
show
create
view
v1
;
drop
view
v1
;
sql/item.cc
View file @
80a28d45
...
...
@@ -1756,6 +1756,21 @@ int Item_real::save_in_field(Field *field, bool no_conversions)
return
field
->
store
(
nr
);
}
void
Item_real
::
print
(
String
*
str
)
{
if
(
presentation
)
{
str
->
append
(
presentation
);
return
;
}
char
buffer
[
20
];
String
num
(
buffer
,
sizeof
(
buffer
),
&
my_charset_bin
);
num
.
set
(
value
,
decimals
,
&
my_charset_bin
);
str
->
append
(
num
);
}
/****************************************************************************
** varbinary item
** In string context this is a binary string
...
...
sql/item.h
View file @
80a28d45
...
...
@@ -698,12 +698,13 @@ public:
class
Item_real
:
public
Item_num
{
char
*
presentation
;
public:
double
value
;
// Item_real() :value(0) {}
Item_real
(
const
char
*
str_arg
,
uint
length
)
:
value
(
my_atof
(
str_arg
))
{
name
=
(
char
*
)
str_arg
;
presentation
=
name
=
(
char
*
)
str_arg
;
decimals
=
(
uint8
)
nr_of_decimals
(
str_arg
);
max_length
=
length
;
fixed
=
1
;
...
...
@@ -711,12 +712,12 @@ public:
Item_real
(
const
char
*
str
,
double
val_arg
,
uint
decimal_par
,
uint
length
)
:
value
(
val_arg
)
{
name
=
(
char
*
)
str
;
presentation
=
name
=
(
char
*
)
str
;
decimals
=
(
uint8
)
decimal_par
;
max_length
=
length
;
fixed
=
1
;
}
Item_real
(
double
value_par
)
:
value
(
value_par
)
{
fixed
=
1
;
}
Item_real
(
double
value_par
)
:
presentation
(
0
),
value
(
value_par
)
{
fixed
=
1
;
}
int
save_in_field
(
Field
*
field
,
bool
no_conversions
);
enum
Type
type
()
const
{
return
REAL_ITEM
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_DOUBLE
;
}
...
...
@@ -732,6 +733,7 @@ public:
void
cleanup
()
{}
Item
*
new_item
()
{
return
new
Item_real
(
name
,
value
,
decimals
,
max_length
);
}
Item_num
*
neg
()
{
value
=
-
value
;
return
this
;
}
void
print
(
String
*
str
);
};
...
...
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