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
b7814086
Commit
b7814086
authored
Apr 22, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-9235 Add Type_handler::is_param_long_data_type()
parent
33b6a347
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
sql/sql_prepare.cc
sql/sql_prepare.cc
+2
-14
sql/sql_type.h
sql/sql_type.h
+22
-4
No files found.
sql/sql_prepare.cc
View file @
b7814086
...
...
@@ -818,18 +818,6 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
#ifndef EMBEDDED_LIBRARY
/**
Check whether this parameter data type is compatible with long data.
Used to detect whether a long data stream has been supplied to a
incompatible data type.
*/
inline
bool
is_param_long_data_type
(
Item_param
*
param
)
{
return
((
param
->
field_type
()
>=
MYSQL_TYPE_TINY_BLOB
)
&&
(
param
->
field_type
()
<=
MYSQL_TYPE_STRING
));
}
/**
Routines to assign parameters from data supplied by the client.
...
...
@@ -907,7 +895,7 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
type (the types are supplied at execute). Check that the
supplied type of placeholder can accept a data stream.
*/
else
if
(
!
is_param_long_data_type
(
param
))
else
if
(
!
param
->
type_handler
()
->
is_param_long_data_type
(
))
DBUG_RETURN
(
1
);
if
(
acc
.
append
(
param
))
...
...
@@ -954,7 +942,7 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array,
type (the types are supplied at execute). Check that the
supplied type of placeholder can accept a data stream.
*/
else
if
(
!
is_param_long_data_type
(
param
))
else
if
(
!
param
->
type_handler
()
->
is_param_long_data_type
(
))
DBUG_RETURN
(
1
);
if
(
param
->
convert_str_value
(
stmt
->
thd
))
DBUG_RETURN
(
1
);
/* out of memory */
...
...
sql/sql_type.h
View file @
b7814086
...
...
@@ -367,6 +367,13 @@ class Type_handler
virtual
enum_field_types
real_field_type
()
const
{
return
field_type
();
}
virtual
Item_result
result_type
()
const
=
0
;
virtual
Item_result
cmp_type
()
const
=
0
;
/**
Prepared statement long data:
Check whether this parameter data type is compatible with long data.
Used to detect whether a long data stream has been supplied to a
incompatible data type.
*/
virtual
bool
is_param_long_data_type
()
const
{
return
false
;
}
virtual
const
Type_handler
*
type_handler_for_comparison
()
const
=
0
;
virtual
CHARSET_INFO
*
charset_for_protocol
(
const
Item
*
item
)
const
;
virtual
const
Type_handler
*
...
...
@@ -1433,6 +1440,7 @@ class Type_handler_string: public Type_handler_string_result
virtual
~
Type_handler_string
()
{}
const
Name
name
()
const
{
return
m_name_char
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_STRING
;
}
bool
is_param_long_data_type
()
const
{
return
true
;
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
};
...
...
@@ -1445,12 +1453,21 @@ class Type_handler_varchar: public Type_handler_string_result
virtual
~
Type_handler_varchar
()
{}
const
Name
name
()
const
{
return
m_name_varchar
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_VARCHAR
;
}
bool
is_param_long_data_type
()
const
{
return
true
;
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
};
class
Type_handler_tiny_blob
:
public
Type_handler_string_result
class
Type_handler_blob_common
:
public
Type_handler_string_result
{
public:
virtual
~
Type_handler_blob_common
()
{
}
bool
is_param_long_data_type
()
const
{
return
true
;
}
};
class
Type_handler_tiny_blob
:
public
Type_handler_blob_common
{
static
const
Name
m_name_tinyblob
;
public:
...
...
@@ -1462,7 +1479,7 @@ class Type_handler_tiny_blob: public Type_handler_string_result
};
class
Type_handler_medium_blob
:
public
Type_handler_
string_result
class
Type_handler_medium_blob
:
public
Type_handler_
blob_common
{
static
const
Name
m_name_mediumblob
;
public:
...
...
@@ -1474,7 +1491,7 @@ class Type_handler_medium_blob: public Type_handler_string_result
};
class
Type_handler_long_blob
:
public
Type_handler_
string_result
class
Type_handler_long_blob
:
public
Type_handler_
blob_common
{
static
const
Name
m_name_longblob
;
public:
...
...
@@ -1486,7 +1503,7 @@ class Type_handler_long_blob: public Type_handler_string_result
};
class
Type_handler_blob
:
public
Type_handler_
string_result
class
Type_handler_blob
:
public
Type_handler_
blob_common
{
static
const
Name
m_name_blob
;
public:
...
...
@@ -1506,6 +1523,7 @@ class Type_handler_geometry: public Type_handler_string_result
virtual
~
Type_handler_geometry
()
{}
const
Name
name
()
const
{
return
m_name_geometry
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_GEOMETRY
;
}
bool
is_param_long_data_type
()
const
{
return
true
;
}
const
Type_handler
*
type_handler_for_comparison
()
const
;
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
...
...
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