Commit 8f705fbc authored by unknown's avatar unknown

Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1

into teton.kitebird.com:/home/paul/mysql-4.1

parents 5ffb903e 0de92f82
......@@ -458,3 +458,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select high_priority issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
ERROR HY000: Unknown error
insert IGNORE into t1 values ('Garbage');
ERROR HY000: Unknown error
alter table t1 add spatial index(a);
drop table t1;
......@@ -146,6 +146,37 @@ Grants for drop_user@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
set sql_mode=ansi_quotes;
show grants for drop_user@localhost;
Grants for drop_user@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
set sql_mode=default;
set sql_quote_show_create=0;
show grants for drop_user@localhost;
Grants for drop_user@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
set sql_mode="ansi_quotes";
show grants for drop_user@localhost;
Grants for drop_user@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
set sql_quote_show_create=1;
show grants for drop_user@localhost;
Grants for drop_user@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
set sql_mode="";
show grants for drop_user@localhost;
Grants for drop_user@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
revoke all privileges, grant option from drop_user@localhost;
show grants for drop_user@localhost;
Grants for drop_user@localhost
......
......@@ -160,3 +160,13 @@ SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
#select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6)),issimple(PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),issimple(GeometryFromText('POINT(1 4)')), issimple(AsWKB(GeometryFromText('POINT(1 4)')));
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
-- error 1105
insert into t1 values ('Garbage');
-- error 1105
insert IGNORE into t1 values ('Garbage');
alter table t1 add spatial index(a);
drop table t1;
......@@ -107,6 +107,23 @@ grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
grant select(a) on test.t1 to drop_user@localhost;
show grants for drop_user@localhost;
#
# Bug3086
#
set sql_mode=ansi_quotes;
show grants for drop_user@localhost;
set sql_mode=default;
set sql_quote_show_create=0;
show grants for drop_user@localhost;
set sql_mode="ansi_quotes";
show grants for drop_user@localhost;
set sql_quote_show_create=1;
show grants for drop_user@localhost;
set sql_mode="";
show grants for drop_user@localhost;
revoke all privileges, grant option from drop_user@localhost;
show grants for drop_user@localhost;
drop user drop_user@localhost;
......
......@@ -5081,7 +5081,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
wkb_type= uint4korr(from + WKB_HEADER_SIZE);
if (wkb_type < (uint32) Geometry::wkb_point ||
wkb_type > (uint32) Geometry::wkb_end)
return 1;
return -1;
Field_blob::store_length(length);
if (table->copy_blobs || length <= MAX_FIELD_WIDTH)
{ // Must make a copy
......@@ -5094,7 +5094,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
err:
bzero(ptr, Field_blob::pack_length());
return 1;
return -1;
}
#endif /*HAVE_SPATIAL*/
......
......@@ -1184,8 +1184,8 @@ Field *make_field(char *ptr, uint32 field_length,
struct st_table *table);
uint pack_length_to_packflag(uint type);
uint32 calc_pack_length(enum_field_types type,uint32 length);
bool set_field_to_null(Field *field);
bool set_field_to_null_with_conversions(Field *field, bool no_conversions);
int set_field_to_null(Field *field);
int set_field_to_null_with_conversions(Field *field, bool no_conversions);
bool test_if_int(const char *str, int length, const char *int_end,
CHARSET_INFO *cs);
......
......@@ -109,7 +109,7 @@ static void do_outer_field_to_null_str(Copy_field *copy)
}
bool
int
set_field_to_null(Field *field)
{
if (field->real_maybe_null())
......@@ -127,7 +127,7 @@ set_field_to_null(Field *field)
if (!current_thd->no_errors)
my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0),
field->field_name);
return 1;
return -1;
}
......@@ -145,11 +145,11 @@ set_field_to_null(Field *field)
RETURN VALUES
0 Field could take 0 or an automatic conversion was used
1 Field could not take NULL and no conversion was used.
-1 Field could not take NULL and no conversion was used.
If no_conversion was not set, an error message is printed
*/
bool
int
set_field_to_null_with_conversions(Field *field, bool no_conversions)
{
if (field->real_maybe_null())
......@@ -159,7 +159,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
return 0;
}
if (no_conversions)
return 1;
return -1;
/*
Check if this is a special type, which will get a special walue
......@@ -184,7 +184,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
if (!current_thd->no_errors)
my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0),
field->field_name);
return 1;
return -1;
}
......
......@@ -639,7 +639,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
return 0;
}
String *result=val_str(&str_value);
return (field->store(result->ptr(),result->length(),field->charset())) ? -1 : 0;
return field->store(result->ptr(),result->length(),field->charset());
}
bool Item_param::get_time(TIME *res)
......@@ -1244,7 +1244,7 @@ int Item::save_in_field(Field *field, bool no_conversions)
field->set_notnull();
error=field->store(nr);
}
return (error) ? -1 : 0;
return error;
}
......@@ -1255,8 +1255,7 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
if (null_value)
return set_field_to_null(field);
field->set_notnull();
return (field->store(result->ptr(),result->length(),collation.collation)) ?
-1 : 0;
return field->store(result->ptr(),result->length(),collation.collation);
}
int Item_uint::save_in_field(Field *field, bool no_conversions)
......@@ -1275,7 +1274,7 @@ int Item_int::save_in_field(Field *field, bool no_conversions)
if (null_value)
return set_field_to_null(field);
field->set_notnull();
return (field->store(nr)) ? -1 : 0;
return field->store(nr);
}
......@@ -1285,7 +1284,7 @@ int Item_real::save_in_field(Field *field, bool no_conversions)
if (null_value)
return set_field_to_null(field);
field->set_notnull();
return (field->store(nr)) ? -1 : 0;
return field->store(nr);
}
/****************************************************************************
......@@ -1347,7 +1346,7 @@ int Item_varbinary::save_in_field(Field *field, bool no_conversions)
longlong nr=val_int();
error=field->store(nr);
}
return (error) ? -1 : 0;
return error;
}
......
......@@ -1095,7 +1095,7 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
field->cmp_type() != value->result_type())
DBUG_RETURN(0);
if (value->save_in_field(field, 1) > 0)
if (value->save_in_field(field, 1) < 0)
{
/* This happens when we try to insert a NULL field in a not null column */
DBUG_RETURN(&null_element); // cmp with NULL is never true
......
......@@ -3170,9 +3170,9 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
}
}
db.append (" ON `",5);
db.append(acl_db->db);
db.append ("`.* TO '",8);
db.append (" ON ",4);
append_identifier(thd, &db, acl_db->db, strlen(acl_db->db));
db.append (".* TO '",7);
db.append(lex_user->user.str,lex_user->user.length);
db.append ("'@'",3);
db.append(lex_user->host.str, lex_user->host.length);
......@@ -3270,11 +3270,13 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
}
}
global.append(" ON `",5);
global.append(grant_table->db);
global.append("`.`",3);
global.append(grant_table->tname);
global.append("` TO '",6);
global.append(" ON ",4);
append_identifier(thd, &global, grant_table->db,
strlen(grant_table->db));
global.append('.');
append_identifier(thd, &global, grant_table->tname,
strlen(grant_table->tname));
global.append(" TO '",5);
global.append(lex_user->user.str,lex_user->user.length);
global.append("'@'",3);
global.append(lex_user->host.str,lex_user->host.length);
......
......@@ -2423,7 +2423,7 @@ fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors)
TABLE *table= rfield->table;
if (rfield == table->next_number_field)
table->auto_increment_field_not_null= true;
if (value->save_in_field(rfield, 0) > 0 && !ignore_errors)
if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors)
DBUG_RETURN(1);
}
DBUG_RETURN(0);
......@@ -2444,7 +2444,7 @@ fill_record(Field **ptr,List<Item> &values, bool ignore_errors)
TABLE *table= field->table;
if (field == table->next_number_field)
table->auto_increment_field_not_null= true;
if (value->save_in_field(field, 0) == 1 && !ignore_errors)
if ((value->save_in_field(field, 0) < 0) && !ignore_errors)
DBUG_RETURN(1);
}
DBUG_RETURN(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment