Merge bk-internal.mysql.com:/data0/bk/tmp_reg

into  bk-internal.mysql.com:/data0/bk/mysql-5.1


client/mysql.cc:
  Auto merged
mysql-test/r/ctype_utf8.result:
  Auto merged
mysql-test/r/gis.result:
  Auto merged
mysql-test/r/grant.result:
  Auto merged
mysql-test/r/im_life_cycle.result:
  Auto merged
mysql-test/r/information_schema_db.result:
  Auto merged
mysql-test/r/type_newdecimal.result:
  Auto merged
mysql-test/r/type_ranges.result:
  Auto merged
mysql-test/r/type_timestamp.result:
  Auto merged
mysql-test/t/ctype_utf8.test:
  Auto merged
mysql-test/t/gis.test:
  Auto merged
mysql-test/t/im_life_cycle.imtest:
  Auto merged
mysql-test/t/type_newdecimal.test:
  Auto merged
mysql-test/t/type_timestamp.test:
  Auto merged
server-tools/instance-manager/messages.cc:
  Auto merged
sql/item_geofunc.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
This commit is contained in:
unknown 2006-08-17 17:19:41 +02:00
commit b32b2ce7af
29 changed files with 355 additions and 104 deletions

View file

@ -3665,12 +3665,14 @@ static const char* construct_prompt()
case 'U':
if (!full_username)
init_username();
processed_prompt.append(full_username);
processed_prompt.append(full_username ? full_username :
(current_user ? current_user : "(unknown)"));
break;
case 'u':
if (!full_username)
init_username();
processed_prompt.append(part_username);
processed_prompt.append(part_username ? part_username :
(current_user ? current_user : "(unknown)"));
break;
case PROMPT_CHAR:
processed_prompt.append(PROMPT_CHAR);

View file

@ -17,6 +17,14 @@
#include "client_priv.h"
#include <my_dir.h>
#ifdef __WIN__
const char *mysqlcheck_name= "mysqlcheck.exe";
const char *mysql_name= "mysql.exe";
#else
const char *mysqlcheck_name= "mysqlcheck";
const char *mysql_name= "mysql";
#endif /*__WIN__*/
static my_bool opt_force= 0, opt_verbose= 0, tty_password= 0;
static char *user= (char*) "root", *basedir= 0, *datadir= 0, *opt_password= 0;
static my_bool upgrade_defaults_created= 0;
@ -65,7 +73,7 @@ static struct my_option my_long_options[]=
};
static const char *load_default_groups[]=
{
"mysql_upgrade", "client", 0
"mysql_upgrade", 0
};
#include <help_end.h>
@ -272,7 +280,7 @@ int main(int argc, char **argv)
strmake(bindir_end, "/bin", sizeof(bindir) - (int) (bindir_end - bindir)-1);
if (!test_file_exists_res
(bindir, "mysqlcheck", mysqlcheck_line, &mysqlcheck_end))
(bindir, mysqlcheck_name, mysqlcheck_line, &mysqlcheck_end))
{
printf("Can't find program '%s'\n", mysqlcheck_line);
puts("Please restart with --basedir=mysql-install-directory");
@ -342,7 +350,8 @@ int main(int argc, char **argv)
goto err_exit;
fix_priv_tables:
if (!test_file_exists_res(bindir, "mysql", fix_priv_tables_cmd, &fix_cmd_end))
if (!test_file_exists_res(bindir, mysql_name,
fix_priv_tables_cmd, &fix_cmd_end))
{
puts("Could not find MySQL command-line client (mysql).");
puts

View file

@ -1066,6 +1066,18 @@ LENGTH(bug)
100
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 (item varchar(255)) default character set utf8;
INSERT INTO t1 VALUES (N'\\');
INSERT INTO t1 VALUES (_utf8'\\');
INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire');
SELECT item FROM t1 ORDER BY item;
item
Cote d'Ivoire
Cote d'Ivoire
\
\
DROP TABLE t1;
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
Warnings:

View file

@ -574,11 +574,11 @@ INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
drop table t1;
create table t1 select POINT(1,3);
create table t1 select GeomFromWKB(POINT(1,3));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`POINT(1,3)` longblob NOT NULL
`GeomFromWKB(POINT(1,3))` geometry NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
@ -706,3 +706,8 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def asbinary(g) 252 8192 0 Y 128 0 63
asbinary(g)
drop table t1;
create table t1 select GeomFromText('point(1 1)');
desc t1;
Field Type Null Key Default Extra
GeomFromText('point(1 1)') geometry NO
drop table t1;

View file

@ -528,7 +528,7 @@ Db char(64) NO PRI
User char(16) NO PRI
Table_name char(64) NO PRI
Grantor char(77) NO MUL
Timestamp timestamp YES CURRENT_TIMESTAMP
Timestamp timestamp NO CURRENT_TIMESTAMP
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') NO
Column_priv set('Select','Insert','Update','References') NO
use test;

View file

@ -69,3 +69,6 @@ START INSTANCE mysqld1,mysqld2,mysqld3;
ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
STOP INSTANCE mysqld1,mysqld2,mysqld3;
ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
STOP INSTANCE mysqld2;
ERROR HY000: Cannot stop instance. Perhaps the instance is not started, or was started manually, so IM cannot find the pidfile.
End of 5.0 tests

View file

@ -104,3 +104,50 @@ v2 VIEW View 'test.v2' references invalid table(s) or column(s) or function(s) o
drop function f1;
drop function f2;
drop view v1, v2;
create database testdb_1;
create user testdb_1@localhost;
grant all on testdb_1.* to testdb_1@localhost with grant option;
create user testdb_2@localhost;
grant all on test.* to testdb_2@localhost with grant option;
use testdb_1;
create table t1 (f1 char(4));
create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
create view v2 as select f1 from testdb_1.v1;
create view v4 as select f1,f2 from testdb_1.v3;
revoke insert(f1) on v3 from testdb_2@localhost;
show create view v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show fields from v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show fields from v2;
Field Type Null Key Default Extra
f1 char(4) YES NULL
show fields from testdb_1.v1;
Field Type Null Key Default Extra
f1 char(4) YES NULL
show create view v2;
View Create View
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
show create view testdb_1.v1;
ERROR 42000: SHOW VIEW command denied to user 'testdb_2'@'localhost' for table 'v1'
select table_name from information_schema.columns a
where a.table_name = 'v2';
table_name
v2
select view_definition from information_schema.views a
where a.table_name = 'v2';
view_definition
/* ALGORITHM=UNDEFINED */ select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
select view_definition from information_schema.views a
where a.table_name = 'testdb_1.v1';
view_definition
select * from v2;
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view testdb_1.v1,v2, testdb_1.v3, v4;
drop database testdb_1;
drop user testdb_1@localhost;
drop user testdb_2@localhost;

View file

@ -915,9 +915,13 @@ drop table t1;
select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15));
cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15))
0.000000000100000
select ln(14000) c1, convert(ln(14000),decimal(2,3)) c2, cast(ln(14000) as decimal(2,3)) c3;
select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3;
c1 c2 c3
9.5468126085974 9.547 9.547
select convert(ln(14000),decimal(2,3)) c1;
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
select cast(ln(14000) as decimal(2,3)) c1;
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
create table t1 (sl decimal(70,30));
ERROR 42000: Too big precision 70 specified for column 'sl'. Maximum is 65.
create table t1 (sl decimal(32,31));

View file

@ -57,7 +57,7 @@ ushort smallint(5) unsigned zerofill NULL NO MUL 00000 #
umedium mediumint(8) unsigned NULL NO MUL 0 #
ulong int(11) unsigned NULL NO MUL 0 #
ulonglong bigint(13) unsigned NULL NO MUL 0 #
time_stamp timestamp NULL YES CURRENT_TIMESTAMP #
time_stamp timestamp NULL NO CURRENT_TIMESTAMP #
date_field date NULL YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
@ -229,7 +229,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 #
umedium mediumint(8) unsigned NULL NO MUL 0 #
ulong int(11) unsigned NULL NO MUL 0 #
ulonglong bigint(13) unsigned NULL NO MUL 0 #
time_stamp timestamp NULL YES CURRENT_TIMESTAMP #
time_stamp timestamp NULL NO CURRENT_TIMESTAMP #
date_field char(10) latin1_swedish_ci YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
@ -255,7 +255,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 #
umedium mediumint(8) unsigned NULL NO 0 #
ulong int(11) unsigned NULL NO 0 #
ulonglong bigint(13) unsigned NULL NO 0 #
time_stamp timestamp NULL YES 0000-00-00 00:00:00 #
time_stamp timestamp NULL NO 0000-00-00 00:00:00 #
date_field char(10) latin1_swedish_ci YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #

View file

@ -201,9 +201,9 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES 2003-01-01 00:00:00
t1 timestamp NO 2003-01-01 00:00:00
t2 datetime YES NULL
t3 timestamp YES 0000-00-00 00:00:00
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp);
SET TIMESTAMP=1000000002;
@ -225,9 +225,9 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP
t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
t3 timestamp YES 0000-00-00 00:00:00
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime);
SET TIMESTAMP=1000000004;
@ -251,7 +251,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES 2003-01-01 00:00:00
t1 timestamp NO 2003-01-01 00:00:00
t2 datetime YES NULL
drop table t1;
create table t1 (t1 timestamp default now() on update now(), t2 datetime);
@ -276,7 +276,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP
t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
drop table t1;
create table t1 (t1 timestamp, t2 datetime, t3 timestamp);
@ -302,9 +302,9 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP
t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
t3 timestamp YES 0000-00-00 00:00:00
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime);
SET TIMESTAMP=1000000009;
@ -328,7 +328,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP
t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
truncate table t1;
insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00');
@ -493,3 +493,18 @@ a b c
6 NULL 2006-06-06 06:06:06
drop table t1;
set time_zone= @@global.time_zone;
CREATE TABLE t1 (
`id` int(11) NOT NULL auto_increment,
`username` varchar(80) NOT NULL default '',
`posted_on` timestamp NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
show fields from t1;
Field Type Null Key Default Extra
id int(11) NO PRI NULL auto_increment
username varchar(80) NO
posted_on timestamp NO 0000-00-00 00:00:00
select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on';
is_nullable
NO
drop table t1;

View file

@ -878,6 +878,17 @@ SELECT LENGTH(bug) FROM t2;
DROP TABLE t2;
DROP TABLE t1;
#
# Bug#17313: N'xxx' and _utf8'xxx' are not equivalent
#
CREATE TABLE t1 (item varchar(255)) default character set utf8;
INSERT INTO t1 VALUES (N'\\');
INSERT INTO t1 VALUES (_utf8'\\');
INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire');
SELECT item FROM t1 ORDER BY item;
DROP TABLE t1;
#
# Bug#17705: Corruption of compressed index when index length changes between
# 254 and 256

View file

@ -281,7 +281,7 @@ INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
drop table t1;
create table t1 select POINT(1,3);
create table t1 select GeomFromWKB(POINT(1,3));
show create table t1;
drop table t1;
@ -416,3 +416,9 @@ select * from t1;
select asbinary(g) from t1;
--disable_metadata
drop table t1;
create table t1 select GeomFromText('point(1 1)');
desc t1;
drop table t1;

View file

@ -194,3 +194,11 @@ START INSTANCE mysqld1,mysqld2,mysqld3;
--error ER_SYNTAX_ERROR
STOP INSTANCE mysqld1,mysqld2,mysqld3;
#
# Bug #12673: Instance Manager: allows to stop the instance many times
#
--error 3001
STOP INSTANCE mysqld2;
--echo End of 5.0 tests

View file

@ -98,3 +98,60 @@ where table_schema='test';
drop function f1;
drop function f2;
drop view v1, v2;
#
# Bug#20543: select on information_schema strange warnings, view, different
# schemas/users
#
#
create database testdb_1;
create user testdb_1@localhost;
grant all on testdb_1.* to testdb_1@localhost with grant option;
create user testdb_2@localhost;
grant all on test.* to testdb_2@localhost with grant option;
connect (testdb_1,localhost,testdb_1,,test);
use testdb_1;
create table t1 (f1 char(4));
create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
connect (testdb_2,localhost,testdb_2,,test);
create view v2 as select f1 from testdb_1.v1;
create view v4 as select f1,f2 from testdb_1.v3;
connection testdb_1;
revoke insert(f1) on v3 from testdb_2@localhost;
connection testdb_2;
--error 1345
show create view v4;
--error 1345
show fields from v4;
show fields from v2;
show fields from testdb_1.v1;
show create view v2;
--error 1142
show create view testdb_1.v1;
select table_name from information_schema.columns a
where a.table_name = 'v2';
select view_definition from information_schema.views a
where a.table_name = 'v2';
select view_definition from information_schema.views a
where a.table_name = 'testdb_1.v1';
--error 1356
select * from v2;
connection default;
drop view testdb_1.v1,v2, testdb_1.v3, v4;
drop database testdb_1;
drop user testdb_1@localhost;
drop user testdb_2@localhost;

View file

@ -947,8 +947,12 @@ select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(3
#
# Bug #11708 (conversion to decimal fails in decimal part)
#
select ln(14000) c1, convert(ln(14000),decimal(2,3)) c2, cast(ln(14000) as decimal(2,3)) c3;
select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3;
--error 1427
select convert(ln(14000),decimal(2,3)) c1;
--error 1427
select cast(ln(14000) as decimal(2,3)) c1;
#
# Bug #8449 (Silent column changes)
#

View file

@ -328,3 +328,14 @@ drop table t1;
# Restore timezone to default
set time_zone= @@global.time_zone;
CREATE TABLE t1 (
`id` int(11) NOT NULL auto_increment,
`username` varchar(80) NOT NULL default '',
`posted_on` timestamp NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
show fields from t1;
select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on';
drop table t1;

View file

@ -501,44 +501,46 @@ int Instance::stop()
struct timespec timeout;
uint waitchild= (uint) DEFAULT_SHUTDOWN_DELAY;
if (options.shutdown_delay)
if (is_running())
{
/*
NOTE: it is important to check shutdown_delay here, but use
shutdown_delay_val. The idea is that if the option is unset,
shutdown_delay will be NULL, but shutdown_delay_val will not be reset.
*/
waitchild= options.shutdown_delay_val;
if (options.shutdown_delay)
{
/*
NOTE: it is important to check shutdown_delay here, but use
shutdown_delay_val. The idea is that if the option is unset,
shutdown_delay will be NULL, but shutdown_delay_val will not be reset.
*/
waitchild= options.shutdown_delay_val;
}
}
kill_instance(SIGTERM);
/* sleep on condition to wait for SIGCHLD */
kill_instance(SIGTERM);
/* sleep on condition to wait for SIGCHLD */
timeout.tv_sec= time(NULL) + waitchild;
timeout.tv_nsec= 0;
if (pthread_mutex_lock(&LOCK_instance))
goto err;
timeout.tv_sec= time(NULL) + waitchild;
timeout.tv_nsec= 0;
if (pthread_mutex_lock(&LOCK_instance))
return ER_STOP_INSTANCE;
while (options.get_pid() != 0) /* while server isn't stopped */
{
int status;
while (options.get_pid() != 0) /* while server isn't stopped */
{
int status;
status= pthread_cond_timedwait(&COND_instance_stopped,
&LOCK_instance,
&timeout);
if (status == ETIMEDOUT || status == ETIME)
break;
status= pthread_cond_timedwait(&COND_instance_stopped,
&LOCK_instance,
&timeout);
if (status == ETIMEDOUT || status == ETIME)
break;
}
pthread_mutex_unlock(&LOCK_instance);
kill_instance(SIGKILL);
return 0;
}
pthread_mutex_unlock(&LOCK_instance);
kill_instance(SIGKILL);
return 0;
return ER_INSTANCE_IS_NOT_STARTED;
err:
return ER_STOP_INSTANCE;
}
#ifdef __WIN__

View file

@ -47,8 +47,8 @@ static const char *mysqld_error_message(unsigned sql_errno)
case ER_BAD_INSTANCE_NAME:
return "Bad instance name. Check that the instance with such a name exists";
case ER_INSTANCE_IS_NOT_STARTED:
return "Cannot stop instance. Perhaps the instance is not started, or was started"
"manually, so IM cannot find the pidfile.";
return "Cannot stop instance. Perhaps the instance is not started, or was"
" started manually, so IM cannot find the pidfile.";
case ER_INSTANCE_ALREADY_STARTED:
return "The instance is already started";
case ER_CANNOT_START_INSTANCE:
@ -66,7 +66,7 @@ static const char *mysqld_error_message(unsigned sql_errno)
return "Cannot open log file";
case ER_GUESS_LOGFILE:
return "Cannot guess the log filename. Try specifying full log name"
"in the instance options";
" in the instance options";
case ER_ACCESS_OPTION_FILE:
return "Cannot open the option file to edit. Check permissions";
case ER_DROP_ACTIVE_INSTANCE:

View file

@ -454,6 +454,8 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec,
CHARSET_INFO *cs)
{
Item *res;
int tmp_len;
LINT_INIT(res);
switch (cast_type) {
case ITEM_CAST_BINARY: res= new Item_func_binary(a); break;
@ -463,7 +465,13 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec,
case ITEM_CAST_TIME: res= new Item_time_typecast(a); break;
case ITEM_CAST_DATETIME: res= new Item_datetime_typecast(a); break;
case ITEM_CAST_DECIMAL:
res= new Item_decimal_typecast(a, (len>0) ? len : 10, dec ? dec : 2);
tmp_len= (len>0) ? len : 10;
if (tmp_len < dec)
{
my_error(ER_M_BIGGER_THAN_D, MYF(0), "");
return 0;
}
res= new Item_decimal_typecast(a, tmp_len, dec ? dec : 2);
break;
case ITEM_CAST_CHAR:
res= new Item_char_typecast(a, len, cs ? cs :

View file

@ -25,6 +25,12 @@
#ifdef HAVE_SPATIAL
#include <m_ctype.h>
Field *Item_geometry_func::tmp_table_field(TABLE *t_arg)
{
return new Field_geom(max_length, maybe_null, name, t_arg,
(Field::geometry_type) get_geometry_type());
}
void Item_geometry_func::fix_length_and_dec()
{
collation.set(&my_charset_bin);
@ -32,6 +38,10 @@ void Item_geometry_func::fix_length_and_dec()
max_length=MAX_BLOB_WIDTH;
}
int Item_geometry_func::get_geometry_type() const
{
return (int)Field::GEOM_GEOMETRY;
}
String *Item_func_geometry_from_text::val_str(String *str)
{
@ -152,6 +162,12 @@ String *Item_func_geometry_type::val_str(String *str)
}
int Item_func_envelope::get_geometry_type() const
{
return (int) Field::GEOM_POLYGON;
}
String *Item_func_envelope::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@ -176,6 +192,12 @@ String *Item_func_envelope::val_str(String *str)
}
int Item_func_centroid::get_geometry_type() const
{
return (int) Field::GEOM_POINT;
}
String *Item_func_centroid::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@ -310,6 +332,12 @@ err:
*/
int Item_func_point::get_geometry_type() const
{
return (int) Field::GEOM_POINT;
}
String *Item_func_point::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);

View file

@ -33,6 +33,8 @@ public:
Item_geometry_func(List<Item> &list) :Item_str_func(list) {}
void fix_length_and_dec();
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
Field *tmp_table_field(TABLE *t_arg);
virtual int get_geometry_type() const;
};
class Item_func_geometry_from_text: public Item_geometry_func
@ -89,6 +91,7 @@ public:
Item_func_centroid(Item *a): Item_geometry_func(a) {}
const char *func_name() const { return "centroid"; }
String *val_str(String *);
int get_geometry_type() const;
};
class Item_func_envelope: public Item_geometry_func
@ -97,6 +100,7 @@ public:
Item_func_envelope(Item *a): Item_geometry_func(a) {}
const char *func_name() const { return "envelope"; }
String *val_str(String *);
int get_geometry_type() const;
};
class Item_func_point: public Item_geometry_func
@ -106,6 +110,7 @@ public:
Item_func_point(Item *a, Item *b, Item *srid): Item_geometry_func(a, b, srid) {}
const char *func_name() const { return "point"; }
String *val_str(String *);
int get_geometry_type() const;
};
class Item_func_spatial_decomp: public Item_geometry_func

View file

@ -2785,9 +2785,8 @@ static int init_common_variables(const char *conf_file_name, int argc,
get corrupted if accesses with names of different case.
*/
DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names));
if (!lower_case_table_names &&
(lower_case_file_system=
(test_if_case_insensitive(mysql_real_data_home) == 1)))
lower_case_file_system= test_if_case_insensitive(mysql_real_data_home);
if (!lower_case_table_names && lower_case_file_system == 1)
{
if (lower_case_table_names_used)
{

View file

@ -3932,9 +3932,24 @@ bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
if (table_ref->view || table_ref->field_translation)
{
/* View or derived information schema table. */
ulong view_privs;
grant= &(table_ref->grant);
db_name= table_ref->view_db.str;
table_name= table_ref->view_name.str;
if (table_ref->belong_to_view &&
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS ||
thd->lex->sql_command == SQLCOM_SHOW_CREATE))
{
view_privs= get_column_grant(thd, grant, db_name, table_name, name);
if (view_privs & VIEW_ANY_ACL)
{
table_ref->belong_to_view->allowed_show= TRUE;
return FALSE;
}
table_ref->belong_to_view->allowed_show= FALSE;
my_message(ER_VIEW_NO_EXPLAIN, ER(ER_VIEW_NO_EXPLAIN), MYF(0));
return TRUE;
}
}
else
{

View file

@ -567,23 +567,20 @@ int MYSQLlex(void *arg, void *yythd)
case MY_LEX_IDENT_OR_NCHAR:
if (yyPeek() != '\'')
{ // Found x'hex-number'
{
state= MY_LEX_IDENT;
break;
}
yyGet(); // Skip '
while ((c = yyGet()) && (c !='\'')) ;
length=(lex->ptr - lex->tok_start); // Length of hexnum+3
if (c != '\'')
/* Found N'string' */
lex->tok_start++; // Skip N
yySkip(); // Skip '
if (!(yylval->lex_str.str = get_text(lex)))
{
return(ABORT_SYM); // Illegal hex constant
state= MY_LEX_CHAR; // Read char by char
break;
}
yyGet(); // get_token makes an unget
yylval->lex_str=get_token(lex,length);
yylval->lex_str.str+=2; // Skip x'
yylval->lex_str.length-=3; // Don't count x' and last '
lex->yytoklen-=3;
return (NCHAR_STRING);
yylval->lex_str.length= lex->yytoklen;
return(NCHAR_STRING);
case MY_LEX_IDENT_OR_HEX:
if (yyPeek() == '\'')

View file

@ -3070,9 +3070,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
table->field[5]->store("",0, cs);
table->field[5]->set_notnull();
}
pos=(byte*) ((flags & NOT_NULL_FLAG) &&
field->type() != FIELD_TYPE_TIMESTAMP ?
"NO" : "YES");
pos=(byte*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES");
table->field[6]->store((const char*) pos,
strlen((const char*) pos), cs);
is_blob= (field->type() == FIELD_TYPE_BLOB);
@ -3549,31 +3547,18 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
if (tables->view)
{
Security_context *sctx= thd->security_ctx;
ulong grant= SHOW_VIEW_ACL;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
char *save_table_name= tables->table_name;
if (!my_strcasecmp(system_charset_info, tables->definer.user.str,
sctx->priv_user) &&
!my_strcasecmp(system_charset_info, tables->definer.host.str,
sctx->priv_host))
grant= SHOW_VIEW_ACL;
else
if (!tables->allowed_show)
{
tables->table_name= tables->view_name.str;
if (check_access(thd, SHOW_VIEW_ACL , base_name,
&tables->grant.privilege, 0, 1,
test(tables->schema_table)))
grant= get_table_grant(thd, tables);
else
grant= tables->grant.privilege;
if (!my_strcasecmp(system_charset_info, tables->definer.user.str,
sctx->priv_user) &&
!my_strcasecmp(system_charset_info, tables->definer.host.str,
sctx->priv_host))
tables->allowed_show= TRUE;
}
tables->table_name= save_table_name;
#endif
restore_record(table, s->default_values);
table->field[1]->store(tables->view_db.str, tables->view_db.length, cs);
table->field[2]->store(tables->view_name.str, tables->view_name.length, cs);
if (grant & SHOW_VIEW_ACL)
if (tables->allowed_show)
{
char buff[2048];
String qwe_str(buff, sizeof(buff), cs);

View file

@ -1001,7 +1001,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
}
}
else if (!table->prelocking_placeholder &&
old_lex->sql_command == SQLCOM_SHOW_CREATE)
old_lex->sql_command == SQLCOM_SHOW_CREATE &&
!table->belong_to_view)
{
if (check_table_access(thd, SHOW_VIEW_ACL, table, 0))
goto err;

View file

@ -6075,6 +6075,8 @@ simple_expr:
lex->length ? atoi(lex->length) : -1,
lex->dec ? atoi(lex->dec) : 0,
lex->charset);
if (!$$)
YYABORT;
}
| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
{ $$= new Item_func_case(* $4, $2, $5 ); }
@ -6084,6 +6086,8 @@ simple_expr:
Lex->length ? atoi(Lex->length) : -1,
Lex->dec ? atoi(Lex->dec) : 0,
Lex->charset);
if (!$$)
YYABORT;
}
| CONVERT_SYM '(' expr USING charset_name ')'
{ $$= new Item_func_conv_charset($3,$5); }

View file

@ -686,6 +686,7 @@ typedef struct st_table_list
tables. Unlike 'next_local', this in this list views are *not*
leaves. Created in setup_tables() -> make_leaves_list().
*/
bool allowed_show;
st_table_list *next_leaf;
Item *where; /* VIEW WHERE clause condition */
Item *check_option; /* WITH CHECK OPTION condition */

View file

@ -3976,6 +3976,7 @@ static void test_fetch_date()
c7 timestamp(6))");
myquery(rc);
rc= mysql_query(mysql, "SET SQL_MODE=''");
rc= mysql_query(mysql, "INSERT INTO test_bind_result VALUES('2002-01-02', \
'12:49:00', \
'2002-01-02 17:46:59', \
@ -8350,6 +8351,7 @@ static void test_bug19671()
int rc;
myheader("test_bug19671");
mysql_query(mysql, "set sql_mode=''");
rc= mysql_query(mysql, "drop table if exists t1");
myquery(rc);
@ -8920,7 +8922,7 @@ static void test_bug1500()
rc= mysql_query(mysql, "DROP TABLE test_bg1500");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE test_bg1500 (s VARCHAR(25), FULLTEXT(s))");
rc= mysql_query(mysql, "CREATE TABLE test_bg1500 (s VARCHAR(25), FULLTEXT(s)) engine=MyISAM");
myquery(rc);
rc= mysql_query(mysql,
@ -10996,7 +10998,8 @@ static void test_view()
{
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(1 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(1 == rc);
}
mysql_stmt_close(stmt);
@ -11038,7 +11041,8 @@ static void test_view_where()
{
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(4 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(4 == rc);
}
mysql_stmt_close(stmt);
@ -11120,7 +11124,8 @@ static void test_view_2where()
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(0 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(0 == rc);
mysql_stmt_close(stmt);
@ -11172,7 +11177,8 @@ static void test_view_star()
{
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(0 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(0 == rc);
}
mysql_stmt_close(stmt);
@ -11226,6 +11232,7 @@ static void test_view_insert()
for (i= 0; i < 3; i++)
{
int rowcount= 0;
my_val= i;
rc= mysql_stmt_execute(insert_stmt);
@ -11233,7 +11240,8 @@ static void test_view_insert()
rc= mysql_stmt_execute(select_stmt);
check_execute(select_stmt, rc);
assert(i + 1 == (int) my_process_stmt_result(select_stmt));
rowcount= (int)my_process_stmt_result(select_stmt);
assert((i+1) == rowcount);
}
mysql_stmt_close(insert_stmt);
mysql_stmt_close(select_stmt);
@ -11273,7 +11281,8 @@ static void test_left_join_view()
{
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(3 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(3 == rc);
}
mysql_stmt_close(stmt);
@ -11348,7 +11357,8 @@ static void test_view_insert_fields()
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(1 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(1 == rc);
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "DROP VIEW v1");
@ -12012,6 +12022,7 @@ static void test_bug6096()
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
mysql_query(mysql, "set sql_mode=''");
stmt_text= "create table t1 (c_tinyint tinyint, c_smallint smallint, "
" c_mediumint mediumint, c_int int, "
" c_bigint bigint, c_float float, "
@ -12897,6 +12908,7 @@ static void test_bug8378()
DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0);
sprintf(buf, "SELECT '%s'", out);
rc=mysql_real_query(mysql, buf, strlen(buf));
myquery(rc);