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
ad12db76
Commit
ad12db76
authored
Sep 11, 2004
by
ingo@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/mydev/mysql-4.1
into mysql.com:/home/mydev/mysql-4.1-bug4788
parents
c6634707
6c47f075
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
5 deletions
+67
-5
include/mysql_com.h
include/mysql_com.h
+5
-0
mysql-test/r/variables.result
mysql-test/r/variables.result
+26
-0
mysql-test/t/variables.test
mysql-test/t/variables.test
+19
-0
sql/item_func.cc
sql/item_func.cc
+12
-0
sql/sql_parse.cc
sql/sql_parse.cc
+5
-5
No files found.
include/mysql_com.h
View file @
ad12db76
...
...
@@ -136,6 +136,11 @@ enum enum_server_command
struct
st_vio
;
/* Only C */
typedef
struct
st_vio
Vio
;
#define MAX_TINYINT_WIDTH 3
/* Max width for a TINY w.o. sign */
#define MAX_SMALLINT_WIDTH 5
/* Max width for a SHORT w.o. sign */
#define MAX_MEDIUMINT_WIDTH 8
/* Max width for a INT24 w.o. sign */
#define MAX_INT_WIDTH 10
/* Max width for a LONG w.o. sign */
#define MAX_BIGINT_WIDTH 20
/* Max width for a LONGLONG */
#define MAX_CHAR_WIDTH 255
/* Max length for a CHAR colum */
#define MAX_BLOB_WIDTH 8192
/* Default width for blob */
...
...
mysql-test/r/variables.result
View file @
ad12db76
...
...
@@ -452,3 +452,29 @@ set global log_warnings = @tstlw;
show global variables like 'log_warnings';
Variable_name Value
log_warnings 1
create table t1 (
c1 tinyint,
c2 smallint,
c3 mediumint,
c4 int,
c5 bigint);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) default NULL,
`c2` smallint(6) default NULL,
`c3` mediumint(9) default NULL,
`c4` int(11) default NULL,
`c5` bigint(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @arg00= 8, @arg01= 8.8, @arg02= 'a string';
create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) default NULL,
`c2` double default NULL,
`c3` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
mysql-test/t/variables.test
View file @
ad12db76
...
...
@@ -335,3 +335,22 @@ show global variables like 'log_warnings';
set
global
log_warnings
=
@
tstlw
;
show
global
variables
like
'log_warnings'
;
#
# BUG#4788 show create table provides incorrect statement
#
# What default width have numeric types?
create
table
t1
(
c1
tinyint
,
c2
smallint
,
c3
mediumint
,
c4
int
,
c5
bigint
);
show
create
table
t1
;
drop
table
t1
;
#
# What types and widths have variables?
set
@
arg00
=
8
,
@
arg01
=
8.8
,
@
arg02
=
'a string'
;
create
table
t1
as
select
@
arg00
as
c1
,
@
arg01
as
c2
,
@
arg02
as
c3
;
show
create
table
t1
;
drop
table
t1
;
sql/item_func.cc
View file @
ad12db76
...
...
@@ -2724,7 +2724,19 @@ void Item_func_get_user_var::fix_length_and_dec()
error
=
get_var_with_binlog
(
thd
,
name
,
&
var_entry
);
if
(
var_entry
)
{
collation
.
set
(
var_entry
->
collation
);
switch
(
var_entry
->
type
)
{
case
REAL_RESULT
:
max_length
=
DBL_DIG
+
8
;
case
INT_RESULT
:
max_length
=
MAX_BIGINT_WIDTH
;
break
;
case
STRING_RESULT
:
max_length
=
MAX_BLOB_WIDTH
;
break
;
}
}
else
null_value
=
1
;
...
...
sql/sql_parse.cc
View file @
ad12db76
...
...
@@ -4208,23 +4208,23 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
switch
(
type
)
{
case
FIELD_TYPE_TINY
:
if
(
!
length
)
new_field
->
length
=
3
+
sign_len
;
if
(
!
length
)
new_field
->
length
=
MAX_TINYINT_WIDTH
+
sign_len
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
FIELD_TYPE_SHORT
:
if
(
!
length
)
new_field
->
length
=
5
+
sign_len
;
if
(
!
length
)
new_field
->
length
=
MAX_SMALLINT_WIDTH
+
sign_len
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
FIELD_TYPE_INT24
:
if
(
!
length
)
new_field
->
length
=
8
+
sign_len
;
if
(
!
length
)
new_field
->
length
=
MAX_MEDIUMINT_WIDTH
+
sign_len
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
FIELD_TYPE_LONG
:
if
(
!
length
)
new_field
->
length
=
10
+
sign_len
;
if
(
!
length
)
new_field
->
length
=
MAX_INT_WIDTH
+
sign_len
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
FIELD_TYPE_LONGLONG
:
if
(
!
length
)
new_field
->
length
=
20
;
if
(
!
length
)
new_field
->
length
=
MAX_BIGINT_WIDTH
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
FIELD_TYPE_NULL
:
...
...
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