mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Strict mode & better warnings
Under strict mode MySQL will generate an error message if there was any conversion when assigning data to a field. Added checking of date/datetime fields. If strict mode, give error if we have not given value to field without a default value (for INSERT)
This commit is contained in:
@@ -3363,6 +3363,7 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
|
||||
{
|
||||
uint maybe_null=(uint) field->real_maybe_null(), copies;
|
||||
uint field_length=field->pack_length()+maybe_null;
|
||||
bool optimize_range;
|
||||
SEL_ARG *tree;
|
||||
char *str, *str2;
|
||||
DBUG_ENTER("get_mm_leaf");
|
||||
@@ -3393,6 +3394,9 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
|
||||
((Field_str*)field)->charset() != conf_func->compare_collation())
|
||||
DBUG_RETURN(0);
|
||||
|
||||
optimize_range= field->optimize_range(param->real_keynr[key_part->key],
|
||||
key_part->part);
|
||||
|
||||
if (type == Item_func::LIKE_FUNC)
|
||||
{
|
||||
bool like_error;
|
||||
@@ -3400,8 +3404,7 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
|
||||
String tmp(buff1,sizeof(buff1),value->collation.collation),*res;
|
||||
uint length,offset,min_length,max_length;
|
||||
|
||||
if (!field->optimize_range(param->real_keynr[key_part->key],
|
||||
key_part->part))
|
||||
if (!optimize_range)
|
||||
DBUG_RETURN(0); // Can't optimize this
|
||||
if (!(res= value->val_str(&tmp)))
|
||||
DBUG_RETURN(&null_element);
|
||||
@@ -3466,8 +3469,7 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
|
||||
DBUG_RETURN(new SEL_ARG(field,min_str,max_str));
|
||||
}
|
||||
|
||||
if (!field->optimize_range(param->real_keynr[key_part->key],
|
||||
key_part->part) &&
|
||||
if (!optimize_range &&
|
||||
type != Item_func::EQ_FUNC &&
|
||||
type != Item_func::EQUAL_FUNC)
|
||||
DBUG_RETURN(0); // Can't optimize this
|
||||
|
||||
Reference in New Issue
Block a user