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
96b470ae
Commit
96b470ae
authored
Jun 17, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
after review fix (BUG#4067)
parent
523dbb3e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
45 deletions
+43
-45
sql/field.cc
sql/field.cc
+27
-0
sql/field.h
sql/field.h
+14
-0
sql/item.cc
sql/item.cc
+1
-45
sql/item.h
sql/item.h
+1
-0
No files found.
sql/field.cc
View file @
96b470ae
...
...
@@ -5812,3 +5812,30 @@ void Field::set_warning(const uint level, const uint code)
code
,
ER
(
code
),
field_name
,
thd
->
row_count
);
}
}
/*
maximum possible display length for blob
SYNOPSIS
Field_blob::max_length()
RETURN
length
*/
uint32
Field_blob
::
max_length
()
{
switch
(
packlength
)
{
case
1
:
return
255
;
case
2
:
return
65535
;
case
3
:
return
16777215
;
case
4
:
return
(
uint32
)
4294967295
;
default:
DBUG_ASSERT
(
0
);
// we should never go here
return
0
;
}
}
sql/field.h
View file @
96b470ae
...
...
@@ -267,6 +267,8 @@ public:
void
set_warning
(
const
unsigned
int
level
,
const
unsigned
int
code
);
virtual
field_cast_enum
field_cast_type
()
=
0
;
bool
field_cast_compatible
(
field_cast_enum
type
);
/* maximum possible display length */
virtual
uint32
max_length
()
=
0
;
friend
bool
reopen_table
(
THD
*
,
struct
st_table
*
,
bool
);
friend
int
cre_myisam
(
my_string
name
,
register
TABLE
*
form
,
uint
options
,
ulonglong
auto_increment_value
);
...
...
@@ -336,6 +338,7 @@ public:
CHARSET_INFO
*
charset
(
void
)
const
{
return
field_charset
;
}
void
set_charset
(
CHARSET_INFO
*
charset
)
{
field_charset
=
charset
;
}
bool
binary
()
const
{
return
field_charset
->
state
&
MY_CS_BINSORT
?
1
:
0
;
}
uint32
max_length
()
{
return
field_length
;
}
friend
class
create_field
;
};
...
...
@@ -366,6 +369,7 @@ public:
void
overflow
(
bool
negative
);
bool
zero_pack
()
const
{
return
0
;
}
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
field_length
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_DECIMAL
;
}
};
...
...
@@ -397,6 +401,7 @@ public:
void
sort_string
(
char
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
1
;
}
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
4
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_TINY
;
}
};
...
...
@@ -433,6 +438,7 @@ public:
void
sort_string
(
char
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
2
;
}
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
6
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_SHORT
;
}
};
...
...
@@ -464,6 +470,7 @@ public:
void
sort_string
(
char
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
3
;
}
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
8
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_MEDIUM
;
}
};
...
...
@@ -500,6 +507,7 @@ public:
void
sort_string
(
char
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
4
;
}
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
11
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_LONG
;
}
};
...
...
@@ -539,6 +547,7 @@ public:
uint32
pack_length
()
const
{
return
8
;
}
void
sql_type
(
String
&
str
)
const
;
bool
store_for_compare
()
{
return
1
;
}
uint32
max_length
()
{
return
20
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_LONGLONG
;
}
};
#endif
...
...
@@ -573,6 +582,7 @@ public:
void
sort_string
(
char
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
sizeof
(
float
);
}
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
24
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_FLOAT
;
}
};
...
...
@@ -607,6 +617,7 @@ public:
void
sort_string
(
char
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
sizeof
(
double
);
}
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
53
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_DOUBLE
;
}
};
...
...
@@ -637,6 +648,7 @@ public:
uint32
pack_length
()
const
{
return
0
;
}
void
sql_type
(
String
&
str
)
const
;
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
uint32
max_length
()
{
return
4
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_NULL
;
}
};
...
...
@@ -1034,6 +1046,7 @@ public:
bool
has_charset
(
void
)
const
{
return
charset
()
==
&
my_charset_bin
?
FALSE
:
TRUE
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_BLOB
;
}
uint32
max_length
();
};
#ifdef HAVE_SPATIAL
...
...
@@ -1062,6 +1075,7 @@ public:
void
get_key_image
(
char
*
buff
,
uint
length
,
CHARSET_INFO
*
cs
,
imagetype
type
);
void
set_key_image
(
char
*
buff
,
uint
length
,
CHARSET_INFO
*
cs
);
uint32
max_length
()
{
return
field_length
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_GEOM
;
}
};
#endif
/*HAVE_SPATIAL*/
...
...
sql/item.cc
View file @
96b470ae
...
...
@@ -2514,53 +2514,9 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
uint32
Item_type_holder
::
real_length
(
Item
*
item
)
{
if
(
item
->
result_type
()
==
STRING_RESULT
)
return
item
->
max_length
;
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
)
{
switch
(((
Item_field
*
)
item
)
->
field_type
())
{
case
MYSQL_TYPE_TINY
:
return
4
;
case
MYSQL_TYPE_SHORT
:
return
6
;
case
MYSQL_TYPE_LONG
:
return
11
;
case
MYSQL_TYPE_FLOAT
:
return
24
;
case
MYSQL_TYPE_DOUBLE
:
return
53
;
case
MYSQL_TYPE_NULL
:
return
4
;
case
MYSQL_TYPE_LONGLONG
:
return
20
;
case
MYSQL_TYPE_INT24
:
return
8
;
case
MYSQL_TYPE_TINY_BLOB
:
return
256
;
case
MYSQL_TYPE_MEDIUM_BLOB
:
return
65535
;
case
MYSQL_TYPE_LONG_BLOB
:
return
(
uint32
)
4294967295
;
case
MYSQL_TYPE_BLOB
:
return
16777215
;
case
MYSQL_TYPE_SET
:
case
MYSQL_TYPE_ENUM
:
case
MYSQL_TYPE_NEWDATE
:
case
MYSQL_TYPE_YEAR
:
case
MYSQL_TYPE_DATETIME
:
case
MYSQL_TYPE_TIME
:
case
MYSQL_TYPE_DATE
:
case
MYSQL_TYPE_TIMESTAMP
:
case
MYSQL_TYPE_DECIMAL
:
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_STRING
:
case
MYSQL_TYPE_GEOMETRY
:
return
item
->
max_length
;
default:
DBUG_ASSERT
(
0
);
// we should never go there
return
0
;
}
return
((
Item_field
*
)
item
)
->
max_disp_length
();
}
switch
(
item
->
result_type
())
{
...
...
sql/item.h
View file @
96b470ae
...
...
@@ -382,6 +382,7 @@ public:
bool
is_null
()
{
return
field
->
is_null
();
}
Item
*
get_tmp_table_item
(
THD
*
thd
);
void
cleanup
();
inline
uint32
max_disp_length
()
{
return
field
->
max_length
();
}
friend
class
Item_default_value
;
friend
class
Item_insert_value
;
friend
class
st_select_lex_unit
;
...
...
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