mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
merge
include/mysqld_error.h: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/r/rpl_charset.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/rpl_charset.test: Auto merged mysql-test/t/sp.test: Auto merged sql/filesort.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/handler.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_row.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/item_uniq.h: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysqld.cc: Auto merged sql/parse_file.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol.h: Auto merged sql/protocol_cursor.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/repl_failsafe.h: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_help.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/share/czech/errmsg.txt: Auto merged sql/share/danish/errmsg.txt: Auto merged sql/share/dutch/errmsg.txt: Auto merged sql/share/english/errmsg.txt: Auto merged sql/share/estonian/errmsg.txt: Auto merged sql/share/french/errmsg.txt: Auto merged sql/share/german/errmsg.txt: Auto merged sql/share/greek/errmsg.txt: Auto merged sql/share/hungarian/errmsg.txt: Auto merged sql/share/italian/errmsg.txt: Auto merged sql/share/japanese/errmsg.txt: Auto merged sql/share/korean/errmsg.txt: Auto merged sql/share/norwegian-ny/errmsg.txt: Auto merged sql/share/norwegian/errmsg.txt: Auto merged sql/share/polish/errmsg.txt: Auto merged sql/share/portuguese/errmsg.txt: Auto merged sql/sql_udf.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.cc: Auto merged sql/unireg.cc: Auto merged sql/share/romanian/errmsg.txt: Auto merged sql/share/russian/errmsg.txt: Auto merged sql/share/serbian/errmsg.txt: Auto merged sql/share/slovak/errmsg.txt: Auto merged sql/share/spanish/errmsg.txt: Auto merged sql/share/swedish/errmsg.txt: Auto merged sql/share/ukrainian/errmsg.txt: Auto merged
This commit is contained in:
commit
067863e184
103 changed files with 2528 additions and 1884 deletions
|
@ -12,7 +12,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 59 Temple Placeo Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/* Definefile for error messagenumbers */
|
||||
|
||||
|
@ -387,4 +387,23 @@
|
|||
#define ER_VIEW_NONUPD_CHECK 1368
|
||||
#define ER_VIEW_CHECK_FAILED 1369
|
||||
#define ER_SP_ACCESS_DENIED_ERROR 1370
|
||||
#define ER_ERROR_MESSAGES 371
|
||||
#define ER_RELAY_LOG_FAIL 1371
|
||||
#define ER_PASSWD_LENGTH 1372
|
||||
#define ER_UNKNOWN_TARGET_BINLOG 1373
|
||||
#define ER_IO_ERR_LOG_INDEX_READ 1374
|
||||
#define ER_BINLOG_PURGE_PROHIBITED 1375
|
||||
#define ER_FSEEK_FAIL 1376
|
||||
#define ER_BINLOG_PURGE_FATAL_ERR 1377
|
||||
#define ER_LOG_IN_USE 1378
|
||||
#define ER_LOG_PURGE_UNKNOWN_ERR 1379
|
||||
#define ER_RELAY_LOG_INIT 1380
|
||||
#define ER_NO_BINARY_LOGGING 1381
|
||||
#define ER_RESERVED_SYNTAX 1382
|
||||
#define ER_WSAS_FAILED 1383
|
||||
#define ER_DIFF_GROUPS_PROC 1384
|
||||
#define ER_NO_GROUP_FOR_PROC 1385
|
||||
#define ER_ORDER_WITH_PROC 1386
|
||||
#define ER_LOGING_PROHIBIT_CHANGING_OF 1387
|
||||
#define ER_NO_FILE_MAPPING 1388
|
||||
#define ER_WRONG_MAGIC 1389
|
||||
#define ER_ERROR_MESSAGES 390
|
||||
|
|
|
@ -664,7 +664,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
|
|||
|
||||
DBUG_RETURN(prepare_for_send(list));
|
||||
err:
|
||||
send_error(thd, ER_OUT_OF_RESOURCES); /* purecov: inspected */
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(0)); /* purecov: inspected */
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
}
|
||||
|
||||
|
|
|
@ -162,9 +162,9 @@ master-bin.000001 # Query 1 # use `mysqltest2`; drop database mysqltest2
|
|||
master-bin.000001 # Query 1 # SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
|
||||
master-bin.000001 # Query 1 # drop database mysqltest3
|
||||
set global character_set_server=latin2;
|
||||
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
|
||||
ERROR HY000: Binary logging and replication forbid changing the global server character set, collation
|
||||
set global character_set_server=latin2;
|
||||
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
|
||||
ERROR HY000: Binary logging and replication forbid changing the global server character set, collation
|
||||
set one_shot @@character_set_server=latin5;
|
||||
set @@max_join_size=1000;
|
||||
select @@character_set_server;
|
||||
|
@ -181,7 +181,7 @@ select @@character_set_server;
|
|||
@@character_set_server
|
||||
latin5
|
||||
set one_shot max_join_size=10;
|
||||
ERROR HY000: The SET ONE_SHOT syntax is reserved for purposes internal to the MySQL server
|
||||
ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
|
||||
set character_set_client=9999999;
|
||||
ERROR 42000: Unknown character set: '9999999'
|
||||
set collation_server=9999998;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
drop table if exists t1, t2, t3, t4;
|
||||
drop table if exists t1, t2, t3, t4;
|
||||
start slave;
|
||||
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
|
||||
ERROR HY000: File 'TESTDIR/var/slave-data/master.info' not found (Errcode: 13)
|
||||
start slave;
|
||||
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
|
||||
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
|
||||
|
|
|
@ -73,5 +73,5 @@ t
|
|||
2001-09-09 03:46:40
|
||||
1000000000
|
||||
set global time_zone='MET';
|
||||
ERROR HY000: Binary logging and replication forbid changing of the global server time zone
|
||||
ERROR HY000: Binary logging and replication forbid changing the global server time zone
|
||||
drop table t1, t2;
|
||||
|
|
|
@ -30,7 +30,7 @@ db1_secret
|
|||
select * from db1_secret.t1;
|
||||
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
|
||||
create procedure db1_secret.dummy() begin end;
|
||||
ERROR 42000: Unknown database 'db1_secret'
|
||||
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
|
||||
drop procedure db1_secret.dummy;
|
||||
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
|
||||
call db1_secret.stamp(3);
|
||||
|
@ -40,7 +40,7 @@ db1_secret
|
|||
select * from db1_secret.t1;
|
||||
ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret'
|
||||
create procedure db1_secret.dummy() begin end;
|
||||
ERROR 42000: Unknown database 'db1_secret'
|
||||
ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret'
|
||||
drop procedure db1_secret.dummy;
|
||||
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
|
||||
select * from t1;
|
||||
|
|
|
@ -1746,10 +1746,20 @@ drop table if exists t3|
|
|||
create procedure bug4904()
|
||||
begin
|
||||
declare continue handler for sqlstate 'HY000' begin end;
|
||||
create table t2 as select * from t;
|
||||
create table t2 as select * from t3;
|
||||
end|
|
||||
call bug4904()|
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
drop procedure bug4904|
|
||||
create table t3 (s1 char character set latin1, s2 char character set latin2)|
|
||||
create procedure bug4904 ()
|
||||
begin
|
||||
declare continue handler for sqlstate 'HY000' begin end;
|
||||
select s1 from t3 union select s2 from t3;
|
||||
end|
|
||||
call bug4904()|
|
||||
drop procedure bug4904|
|
||||
drop table t3|
|
||||
create procedure bug336(out y int)
|
||||
begin
|
||||
declare x int;
|
||||
|
|
|
@ -49,7 +49,7 @@ flush privileges;
|
|||
#show tables;
|
||||
connect (con1,localhost,test,gambling2,mysql);
|
||||
set password="";
|
||||
--error 1105
|
||||
--error 1372
|
||||
set password='gambling3';
|
||||
set password=old_password('gambling3');
|
||||
show tables;
|
||||
|
|
|
@ -112,10 +112,10 @@ sync_slave_with_master;
|
|||
|
||||
# Check that we can't change global.collation_server
|
||||
|
||||
error 1105;
|
||||
error 1387;
|
||||
set global character_set_server=latin2;
|
||||
connection master;
|
||||
error 1105;
|
||||
error 1387;
|
||||
set global character_set_server=latin2;
|
||||
|
||||
# Check that SET ONE_SHOT is really one shot
|
||||
|
@ -129,7 +129,7 @@ select @@character_set_server;
|
|||
select @@character_set_server;
|
||||
|
||||
# ONE_SHOT on not charset/collation stuff is not allowed
|
||||
error 1105;
|
||||
error 1382;
|
||||
set one_shot max_join_size=10;
|
||||
|
||||
# Test of wrong character set numbers;
|
||||
|
|
|
@ -23,7 +23,8 @@ drop table if exists t1, t2, t3, t4;
|
|||
|
||||
# START SLAVE will fail because it can't read the file (mode 000)
|
||||
# (system error 13)
|
||||
--error 1201
|
||||
--replace_result $MYSQL_TEST_DIR TESTDIR
|
||||
--error 1105
|
||||
start slave;
|
||||
system chmod 600 var/slave-data/master.info;
|
||||
# It will fail again because the file is empty so the slave cannot get valuable
|
||||
|
|
|
@ -76,7 +76,7 @@ select * from t2;
|
|||
# replication
|
||||
#
|
||||
connection master;
|
||||
--error 1105
|
||||
--error 1387
|
||||
set global time_zone='MET';
|
||||
|
||||
# Clean up
|
||||
|
|
|
@ -58,7 +58,7 @@ select db1_secret.db();
|
|||
select * from db1_secret.t1;
|
||||
|
||||
# ...and not this
|
||||
--error 1049
|
||||
--error 1044
|
||||
create procedure db1_secret.dummy() begin end;
|
||||
--error 1305
|
||||
drop procedure db1_secret.dummy;
|
||||
|
@ -78,7 +78,7 @@ select db1_secret.db();
|
|||
select * from db1_secret.t1;
|
||||
|
||||
# ...and not this
|
||||
--error 1049
|
||||
--error 1044
|
||||
create procedure db1_secret.dummy() begin end;
|
||||
--error 1305
|
||||
drop procedure db1_secret.dummy;
|
||||
|
|
|
@ -1870,12 +1870,27 @@ create procedure bug4904()
|
|||
begin
|
||||
declare continue handler for sqlstate 'HY000' begin end;
|
||||
|
||||
create table t2 as select * from t;
|
||||
create table t2 as select * from t3;
|
||||
end|
|
||||
|
||||
-- error 1146
|
||||
call bug4904()|
|
||||
|
||||
drop procedure bug4904|
|
||||
|
||||
create table t3 (s1 char character set latin1, s2 char character set latin2)|
|
||||
|
||||
create procedure bug4904 ()
|
||||
begin
|
||||
declare continue handler for sqlstate 'HY000' begin end;
|
||||
|
||||
select s1 from t3 union select s2 from t3;
|
||||
end|
|
||||
|
||||
call bug4904()|
|
||||
|
||||
drop procedure bug4904|
|
||||
drop table t3|
|
||||
|
||||
#
|
||||
# BUG#336
|
||||
|
|
|
@ -22,6 +22,18 @@
|
|||
|
||||
/* Define some external variables for error handling */
|
||||
|
||||
/*
|
||||
WARNING!
|
||||
my_error family functions have to be used according following rules:
|
||||
- if message have not parameters use my_message(ER_CODE, ER(ER_CODE), MYF(N))
|
||||
- if message have only integer parameters, string constants (created
|
||||
inside program) or string put (and cut if it is need) in some limited
|
||||
length buffer before passing it as parameter then you can use
|
||||
my_error(ER_CODE, MYF(N), ...). Never pass string get from user to
|
||||
my_error.
|
||||
- in all other cases use my_printf_error(ER_CODE, ER(ER_CODE), MYF(N), ...)
|
||||
*/
|
||||
|
||||
const char ** NEAR my_errmsg[MAXMAPS]={0,0,0,0};
|
||||
char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
|
||||
|
||||
|
|
|
@ -284,7 +284,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
|
|||
}
|
||||
}
|
||||
if (error)
|
||||
my_error(ER_FILSORT_ABORT,MYF(ME_ERROR+ME_WAITTANG));
|
||||
my_message(ER_FILSORT_ABORT, ER(ER_FILSORT_ABORT),
|
||||
MYF(ME_ERROR+ME_WAITTANG));
|
||||
else
|
||||
statistic_add(thd->status_var.filesort_rows,
|
||||
(ulong) records, &LOCK_status);
|
||||
|
|
|
@ -495,8 +495,10 @@ innobase_mysql_tmpfile(void)
|
|||
if (fd2 < 0) {
|
||||
DBUG_PRINT("error",("Got error %d on dup",fd2));
|
||||
my_errno=errno;
|
||||
my_error(EE_OUT_OF_FILERESOURCES,
|
||||
MYF(ME_BELL+ME_WAITTANG), filename, my_errno);
|
||||
my_printf_error(EE_OUT_OF_FILERESOURCES,
|
||||
ER(EE_OUT_OF_FILERESOURCES),
|
||||
MYF(ME_BELL+ME_WAITTANG),
|
||||
filename, my_errno);
|
||||
}
|
||||
my_close(fd, MYF(MY_WME));
|
||||
}
|
||||
|
@ -5028,7 +5030,7 @@ ha_innobase::external_lock(
|
|||
Implements the SHOW INNODB STATUS command. Sends the output of the InnoDB
|
||||
Monitor to the client. */
|
||||
|
||||
int
|
||||
bool
|
||||
innodb_show_status(
|
||||
/*===============*/
|
||||
THD* thd) /* in: the MySQL query thread of the caller */
|
||||
|
@ -5042,7 +5044,7 @@ innodb_show_status(
|
|||
my_message(ER_NOT_SUPPORTED_YET,
|
||||
"Cannot call SHOW INNODB STATUS because skip-innodb is defined",
|
||||
MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
trx = check_trx_exists(thd);
|
||||
|
@ -5071,7 +5073,7 @@ innodb_show_status(
|
|||
if (!(str = my_malloc(flen + 1, MYF(0))))
|
||||
{
|
||||
mutex_exit_noninline(&srv_monitor_file_mutex);
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
rewind(srv_monitor_file);
|
||||
|
@ -5088,7 +5090,7 @@ innodb_show_status(
|
|||
|
||||
my_free(str, MYF(0));
|
||||
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
|
@ -5096,10 +5098,10 @@ innodb_show_status(
|
|||
my_free(str, MYF(0));
|
||||
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -233,7 +233,7 @@ int innobase_savepoint(
|
|||
my_off_t binlog_cache_pos);
|
||||
int innobase_close_connection(THD *thd);
|
||||
int innobase_drop_database(char *path);
|
||||
int innodb_show_status(THD* thd);
|
||||
bool innodb_show_status(THD* thd);
|
||||
|
||||
my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name,
|
||||
uint full_name_len);
|
||||
|
|
|
@ -517,7 +517,8 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
|
|||
if ((error=ndbcluster_commit(thd,trans->ndb_tid)))
|
||||
{
|
||||
if (error == -1)
|
||||
my_error(ER_ERROR_DURING_COMMIT, MYF(0));
|
||||
my_message_(ER_ERROR_DURING_COMMIT, ER(ER_ERROR_DURING_COMMIT),
|
||||
MYF(0));
|
||||
error=1;
|
||||
}
|
||||
if (trans == &thd->transaction.all)
|
||||
|
@ -592,7 +593,8 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
|
|||
if ((error=ndbcluster_rollback(thd, trans->ndb_tid)))
|
||||
{
|
||||
if (error == -1)
|
||||
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0));
|
||||
my_message(ER_ERROR_DURING_ROLLBACK, ER(ER_ERROR_DURING_ROLLBACK),
|
||||
MYF(0));
|
||||
error=1;
|
||||
}
|
||||
trans->ndb_tid = 0;
|
||||
|
@ -1198,7 +1200,8 @@ void handler::print_error(int error, myf errflag)
|
|||
str.length(max_length-4);
|
||||
str.append("...");
|
||||
}
|
||||
my_error(ER_DUP_ENTRY,MYF(0),str.c_ptr(),key_nr+1);
|
||||
my_printf_error(ER_DUP_ENTRY, ER(ER_DUP_ENTRY), MYF(0),
|
||||
str.c_ptr(), key_nr+1);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
textno=ER_DUP_KEY;
|
||||
|
@ -1220,7 +1223,7 @@ void handler::print_error(int error, myf errflag)
|
|||
textno=ER_CRASHED_ON_REPAIR;
|
||||
break;
|
||||
case HA_ERR_OUT_OF_MEM:
|
||||
my_error(ER_OUT_OF_RESOURCES,errflag);
|
||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), errflag);
|
||||
DBUG_VOID_RETURN;
|
||||
case HA_ERR_WRONG_COMMAND:
|
||||
textno=ER_ILLEGAL_HA;
|
||||
|
@ -1281,9 +1284,13 @@ void handler::print_error(int error, myf errflag)
|
|||
{
|
||||
const char* engine= table_type();
|
||||
if (temporary)
|
||||
my_error(ER_GET_TEMPORARY_ERRMSG,MYF(0),error,str.ptr(),engine);
|
||||
my_printf_error(ER_GET_TEMPORARY_ERRMSG,
|
||||
ER(ER_GET_TEMPORARY_ERRMSG), MYF(0),
|
||||
error, str.ptr(), engine);
|
||||
else
|
||||
my_error(ER_GET_ERRMSG,MYF(0),error,str.ptr(),engine);
|
||||
my_printf_error(ER_GET_ERRMSG,
|
||||
ER(ER_GET_ERRMSG), MYF(0),
|
||||
error, str.ptr(), engine);
|
||||
}
|
||||
else
|
||||
my_error(ER_GET_ERRNO,errflag,error);
|
||||
|
@ -1412,7 +1419,9 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
|
|||
error=table.file->create(name,&table,create_info);
|
||||
VOID(closefrm(&table));
|
||||
if (error)
|
||||
my_error(ER_CANT_CREATE_TABLE,MYF(ME_BELL+ME_WAITTANG),name,error);
|
||||
my_printf_error(ER_CANT_CREATE_TABLE, ER(ER_CANT_CREATE_TABLE),
|
||||
MYF(ME_BELL+ME_WAITTANG),
|
||||
name,error);
|
||||
DBUG_RETURN(error != 0);
|
||||
}
|
||||
|
||||
|
|
44
sql/item.cc
44
sql/item.cc
|
@ -1466,7 +1466,7 @@ bool Item::fix_fields(THD *thd,
|
|||
// We do not check fields which are fixed during construction
|
||||
DBUG_ASSERT(fixed == 0 || basic_const_item());
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
double Item_ref_null_helper::val_real()
|
||||
|
@ -2907,10 +2907,11 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
|
|||
current_sel->having_fix_field))) ||
|
||||
!(*ref)->fixed)
|
||||
{
|
||||
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name,
|
||||
((*ref)->with_sum_func?
|
||||
"reference to group function":
|
||||
"forward reference in item list"));
|
||||
my_printf_error(ER_ILLEGAL_REFERENCE, ER(ER_ILLEGAL_REFERENCE), MYF(0),
|
||||
name,
|
||||
((*ref)->with_sum_func?
|
||||
"reference to group function":
|
||||
"forward reference in item list"));
|
||||
return TRUE;
|
||||
}
|
||||
max_length= (*ref)->max_length;
|
||||
|
@ -2931,6 +2932,8 @@ void Item_ref::cleanup()
|
|||
DBUG_ENTER("Item_ref::cleanup");
|
||||
Item_ident::cleanup();
|
||||
result_field= 0;
|
||||
if (hook_ptr)
|
||||
*hook_ptr= orig_item;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -3026,17 +3029,17 @@ bool Item_default_value::fix_fields(THD *thd,
|
|||
if (!arg)
|
||||
{
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
if (arg->fix_fields(thd, table_list, &arg))
|
||||
return 1;
|
||||
return TRUE;
|
||||
|
||||
if (arg->type() == REF_ITEM)
|
||||
{
|
||||
Item_ref *ref= (Item_ref *)arg;
|
||||
if (ref->ref[0]->type() != FIELD_ITEM)
|
||||
{
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
arg= ref->ref[0];
|
||||
}
|
||||
|
@ -3045,15 +3048,15 @@ bool Item_default_value::fix_fields(THD *thd,
|
|||
{
|
||||
my_printf_error(ER_NO_DEFAULT_FOR_FIELD, ER(ER_NO_DEFAULT_FOR_FIELD),
|
||||
MYF(0), field_arg->field->field_name);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of())))
|
||||
return 1;
|
||||
return TRUE;
|
||||
memcpy(def_field, field_arg->field, field_arg->field->size_of());
|
||||
def_field->move_field(def_field->table->default_values -
|
||||
def_field->table->record[0]);
|
||||
set_field(def_field);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Item_default_value::print(String *str)
|
||||
|
@ -3081,14 +3084,14 @@ bool Item_insert_value::fix_fields(THD *thd,
|
|||
{
|
||||
DBUG_ASSERT(fixed == 0);
|
||||
if (arg->fix_fields(thd, table_list, &arg))
|
||||
return 1;
|
||||
return TRUE;
|
||||
|
||||
if (arg->type() == REF_ITEM)
|
||||
{
|
||||
Item_ref *ref= (Item_ref *)arg;
|
||||
if (ref->ref[0]->type() != FIELD_ITEM)
|
||||
{
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
arg= ref->ref[0];
|
||||
}
|
||||
|
@ -3097,7 +3100,7 @@ bool Item_insert_value::fix_fields(THD *thd,
|
|||
{
|
||||
Field *def_field= (Field*) sql_alloc(field_arg->field->size_of());
|
||||
if (!def_field)
|
||||
return 1;
|
||||
return TRUE;
|
||||
memcpy(def_field, field_arg->field, field_arg->field->size_of());
|
||||
def_field->move_field(def_field->table->insert_values -
|
||||
def_field->table->record[0]);
|
||||
|
@ -3110,7 +3113,7 @@ bool Item_insert_value::fix_fields(THD *thd,
|
|||
set_field(new Field_null(0, 0, Field::NONE, tmp_field->field_name,
|
||||
tmp_field->table, &my_charset_bin));
|
||||
}
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Item_insert_value::print(String *str)
|
||||
|
@ -3600,11 +3603,12 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
|
|||
old_derivation= collation.derivation_name();
|
||||
if (item_type == STRING_RESULT && collation.aggregate(item->collation))
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
|
||||
old_cs, old_derivation,
|
||||
item->collation.collation->name,
|
||||
item->collation.derivation_name(),
|
||||
"UNION");
|
||||
my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
|
||||
ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
|
||||
old_cs, old_derivation,
|
||||
item->collation.collation->name,
|
||||
item->collation.derivation_name(),
|
||||
"UNION");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,10 +53,11 @@ static void agg_cmp_type(Item_result *type, Item **items, uint nitems)
|
|||
|
||||
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname)
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0),
|
||||
c1.collation->name,c1.derivation_name(),
|
||||
c2.collation->name,c2.derivation_name(),
|
||||
fname);
|
||||
my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
|
||||
ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
|
||||
c1.collation->name,c1.derivation_name(),
|
||||
c2.collation->name,c2.derivation_name(),
|
||||
fname);
|
||||
}
|
||||
|
||||
|
||||
|
@ -600,17 +601,17 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
|
|||
{
|
||||
DBUG_ASSERT(fixed == 0);
|
||||
if (fix_left(thd, tables, ref))
|
||||
return 1;
|
||||
return TRUE;
|
||||
if (args[0]->maybe_null)
|
||||
maybe_null=1;
|
||||
|
||||
if (!args[1]->fixed && args[1]->fix_fields(thd, tables, args+1))
|
||||
return 1;
|
||||
return TRUE;
|
||||
Item_in_subselect * sub= (Item_in_subselect *)args[1];
|
||||
if (args[0]->cols() != sub->engine->cols())
|
||||
{
|
||||
my_error(ER_OPERAND_COLUMNS, MYF(0), args[0]->cols());
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
if (args[1]->maybe_null)
|
||||
maybe_null=1;
|
||||
|
@ -619,7 +620,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
|
|||
not_null_tables_cache|= args[1]->not_null_tables();
|
||||
const_item_cache&= args[1]->const_item();
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1956,7 +1957,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
and_tables_cache= ~(table_map) 0;
|
||||
|
||||
if (check_stack_overrun(thd, buff))
|
||||
return 1; // Fatal error flag is set!
|
||||
return TRUE; // Fatal error flag is set!
|
||||
while ((item=li++))
|
||||
{
|
||||
table_map tmp_table_map;
|
||||
|
@ -1974,7 +1975,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
if ((!item->fixed &&
|
||||
item->fix_fields(thd, tables, li.ref())) ||
|
||||
(item= *li.ref())->check_cols(1))
|
||||
return 1; /* purecov: inspected */
|
||||
return TRUE; /* purecov: inspected */
|
||||
used_tables_cache|= item->used_tables();
|
||||
tmp_table_map= item->not_null_tables();
|
||||
not_null_tables_cache|= tmp_table_map;
|
||||
|
@ -1987,7 +1988,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
thd->lex->current_select->cond_count+= list.elements;
|
||||
fix_length_and_dec();
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool Item_cond::walk(Item_processor processor, byte *arg)
|
||||
|
@ -2339,12 +2340,12 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
|
|||
DBUG_ASSERT(fixed == 0);
|
||||
if (Item_bool_func2::fix_fields(thd, tlist, ref) ||
|
||||
escape_item->fix_fields(thd, tlist, &escape_item))
|
||||
return 1;
|
||||
return TRUE;
|
||||
|
||||
if (!escape_item->const_during_execution())
|
||||
{
|
||||
my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE");
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (escape_item->const_item())
|
||||
|
@ -2362,7 +2363,7 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
|
|||
{
|
||||
String* res2 = args[1]->val_str(&tmp_value2);
|
||||
if (!res2)
|
||||
return 0; // Null argument
|
||||
return FALSE; // Null argument
|
||||
|
||||
const size_t len = res2->length();
|
||||
const char* first = res2->ptr();
|
||||
|
@ -2395,7 +2396,7 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
|
|||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef USE_REGEX
|
||||
|
@ -2406,13 +2407,13 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
DBUG_ASSERT(fixed == 0);
|
||||
if (args[0]->fix_fields(thd, tables, args) || args[0]->check_cols(1) ||
|
||||
args[1]->fix_fields(thd,tables, args + 1) || args[1]->check_cols(1))
|
||||
return 1; /* purecov: inspected */
|
||||
return TRUE; /* purecov: inspected */
|
||||
with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
|
||||
max_length= 1;
|
||||
decimals= 0;
|
||||
|
||||
if (agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV))
|
||||
return 1;
|
||||
return TRUE;
|
||||
|
||||
used_tables_cache=args[0]->used_tables() | args[1]->used_tables();
|
||||
not_null_tables_cache= (args[0]->not_null_tables() |
|
||||
|
@ -2426,7 +2427,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
if (args[1]->null_value)
|
||||
{ // Will always return NULL
|
||||
maybe_null=1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
int error;
|
||||
if ((error=regcomp(&preg,res->c_ptr(),
|
||||
|
@ -2437,7 +2438,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
{
|
||||
(void) regerror(error,&preg,buff,sizeof(buff));
|
||||
my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
regex_compiled=regex_is_const=1;
|
||||
maybe_null=args[0]->maybe_null;
|
||||
|
@ -2445,7 +2446,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
else
|
||||
maybe_null=1;
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,10 +45,11 @@ bool check_reserved_words(LEX_STRING *name)
|
|||
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
|
||||
const char *fname)
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0),
|
||||
c1.collation->name,c1.derivation_name(),
|
||||
c2.collation->name,c2.derivation_name(),
|
||||
fname);
|
||||
my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
|
||||
ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
|
||||
c1.collation->name, c1.derivation_name(),
|
||||
c2.collation->name, c2.derivation_name(),
|
||||
fname);
|
||||
}
|
||||
|
||||
static void my_coll_agg_error(DTCollation &c1,
|
||||
|
@ -56,11 +57,12 @@ static void my_coll_agg_error(DTCollation &c1,
|
|||
DTCollation &c3,
|
||||
const char *fname)
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_3COLLATIONS,MYF(0),
|
||||
c1.collation->name,c1.derivation_name(),
|
||||
c2.collation->name,c2.derivation_name(),
|
||||
c3.collation->name,c3.derivation_name(),
|
||||
fname);
|
||||
my_printf_error(ER_CANT_AGGREGATE_3COLLATIONS,
|
||||
ER(ER_CANT_AGGREGATE_3COLLATIONS), MYF(0),
|
||||
c1.collation->name, c1.derivation_name(),
|
||||
c2.collation->name, c2.derivation_name(),
|
||||
c3.collation->name, c3.derivation_name(),
|
||||
fname);
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +76,8 @@ static void my_coll_agg_error(Item** args, uint count, const char *fname)
|
|||
args[2]->collation,
|
||||
fname);
|
||||
else
|
||||
my_error(ER_CANT_AGGREGATE_NCOLLATIONS,MYF(0),fname);
|
||||
my_printf_error(ER_CANT_AGGREGATE_NCOLLATIONS,
|
||||
ER(ER_CANT_AGGREGATE_NCOLLATIONS), MYF(0),fname);
|
||||
}
|
||||
|
||||
|
||||
|
@ -281,8 +284,8 @@ Item_func::Item_func(THD *thd, Item_func *item)
|
|||
item.
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
1 Got error. Stored with my_error().
|
||||
FALSE ok
|
||||
TRUE Got error. Stored with my_error().
|
||||
*/
|
||||
|
||||
bool
|
||||
|
@ -298,7 +301,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
const_item_cache=1;
|
||||
|
||||
if (check_stack_overrun(thd, buff))
|
||||
return 1; // Fatal error if flag is set!
|
||||
return TRUE; // Fatal error if flag is set!
|
||||
if (arg_count)
|
||||
{ // Print purify happy
|
||||
for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
|
||||
|
@ -310,7 +313,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
*/
|
||||
if ((!(*arg)->fixed && (*arg)->fix_fields(thd, tables, arg)) ||
|
||||
(*arg)->check_cols(allowed_arg_cols))
|
||||
return 1; /* purecov: inspected */
|
||||
return TRUE; /* purecov: inspected */
|
||||
item= *arg;
|
||||
if (item->maybe_null)
|
||||
maybe_null=1;
|
||||
|
@ -322,10 +325,10 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
}
|
||||
}
|
||||
fix_length_and_dec();
|
||||
if (thd->net.last_errno) // An error inside fix_length_and_dec occured
|
||||
return 1;
|
||||
if (thd->net.report_error) // An error inside fix_length_and_dec occured
|
||||
return TRUE;
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool Item_func::walk (Item_processor processor, byte *argument)
|
||||
|
@ -1708,7 +1711,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
DBUG_ENTER("Item_udf_func::fix_fields");
|
||||
|
||||
if (check_stack_overrun(thd, buff))
|
||||
DBUG_RETURN(1); // Fatal error flag is set!
|
||||
DBUG_RETURN(TRUE); // Fatal error flag is set!
|
||||
|
||||
udf_func *tmp_udf=find_udf(u_d->name.str,(uint) u_d->name.length,1);
|
||||
|
||||
|
@ -1716,7 +1719,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
{
|
||||
my_printf_error(ER_CANT_FIND_UDF,ER(ER_CANT_FIND_UDF),MYF(0),u_d->name.str,
|
||||
errno);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
u_d=tmp_udf;
|
||||
args=arguments;
|
||||
|
@ -1733,7 +1736,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
|
||||
{
|
||||
free_udf(u_d);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
uint i;
|
||||
Item **arg,**arg_end;
|
||||
|
@ -1746,7 +1749,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
// we can't assign 'item' before, because fix_fields() can change arg
|
||||
Item *item= *arg;
|
||||
if (item->check_cols(1))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
/*
|
||||
TODO: We should think about this. It is not always
|
||||
right way just to set an UDF result to return my_charset_bin
|
||||
|
@ -1779,7 +1782,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
sizeof(long))))
|
||||
{
|
||||
free_udf(u_d);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
func->fix_length_and_dec();
|
||||
|
@ -1838,7 +1841,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0),
|
||||
u_d->name.str, thd->net.last_error);
|
||||
free_udf(u_d);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
func->max_length=min(initid.max_length,MAX_BLOB_WIDTH);
|
||||
func->maybe_null=initid.maybe_null;
|
||||
|
@ -1850,9 +1853,9 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
{
|
||||
my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0),
|
||||
u_d->name.str, ER(ER_UNKNOWN_ERROR));
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2463,7 +2466,7 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
|
|||
/* fix_fields will call Item_func_set_user_var::fix_length_and_dec */
|
||||
if (Item_func::fix_fields(thd, tables, ref) ||
|
||||
!(entry= get_variable(&thd->user_vars, name, 1)))
|
||||
return 1;
|
||||
return TRUE;
|
||||
/*
|
||||
Remember the last query which updated it, this way a query can later know
|
||||
if this variable is a constant item in the query (it is if update_query_id
|
||||
|
@ -2489,7 +2492,7 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
|
|||
entry->collation.set(args[0]->collation);
|
||||
collation.set(entry->collation);
|
||||
cached_result_type= args[0]->result_type();
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2647,7 +2650,7 @@ String *user_var_entry::val_str(my_bool *null_value, String *str,
|
|||
will be catched by thd->net.report_error check in sql_set_variables().
|
||||
|
||||
RETURN
|
||||
0 - OK.
|
||||
FALSE OK.
|
||||
*/
|
||||
|
||||
bool
|
||||
|
@ -2677,7 +2680,7 @@ Item_func_set_user_var::check()
|
|||
DBUG_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3140,7 +3143,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
|
|||
!args[0]->const_during_execution())
|
||||
{
|
||||
my_error(ER_WRONG_ARGUMENTS,MYF(0),"AGAINST");
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const_item_cache=0;
|
||||
|
@ -3163,7 +3166,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
|
|||
if (key == NO_SUCH_KEY && !(flags & FT_BOOL))
|
||||
{
|
||||
my_error(ER_WRONG_ARGUMENTS,MYF(0),"MATCH");
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
table=((Item_field *)item)->field->table;
|
||||
table->fulltext_searched=1;
|
||||
|
@ -3245,7 +3248,8 @@ err:
|
|||
key=NO_SUCH_KEY;
|
||||
return 0;
|
||||
}
|
||||
my_error(ER_FT_MATCHING_KEY_NOT_FOUND,MYF(0));
|
||||
my_message(ER_FT_MATCHING_KEY_NOT_FOUND,
|
||||
ER(ER_FT_MATCHING_KEY_NOT_FOUND), MYF(0));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3374,7 +3378,8 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
|
|||
{
|
||||
if (!var->is_struct())
|
||||
{
|
||||
net_printf(thd, ER_VARIABLE_IS_NOT_STRUCT, base_name->str);
|
||||
my_printf_error(ER_VARIABLE_IS_NOT_STRUCT, ER(ER_VARIABLE_IS_NOT_STRUCT),
|
||||
MYF(0), base_name->str);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref)
|
|||
for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++)
|
||||
{
|
||||
if ((*arg)->fix_fields(thd, tabl, arg))
|
||||
return 1;
|
||||
return TRUE;
|
||||
// we can't assign 'item' before, because fix_fields() can change arg
|
||||
Item *item= *arg;
|
||||
used_tables_cache |= item->used_tables();
|
||||
|
@ -81,7 +81,7 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref)
|
|||
with_sum_func= with_sum_func || item->with_sum_func;
|
||||
}
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Item_row::split_sum_func(THD *thd, Item **ref_pointer_array,
|
||||
|
|
|
@ -42,10 +42,11 @@ String my_empty_string("",default_charset_info);
|
|||
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
|
||||
const char *fname)
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0),
|
||||
c1.collation->name,c1.derivation_name(),
|
||||
c2.collation->name,c2.derivation_name(),
|
||||
fname);
|
||||
my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
|
||||
ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
|
||||
c1.collation->name, c1.derivation_name(),
|
||||
c2.collation->name, c2.derivation_name(),
|
||||
fname);
|
||||
}
|
||||
|
||||
uint nr_of_decimals(const char *str)
|
||||
|
@ -2218,7 +2219,8 @@ void Item_func_set_collation::fix_length_and_dec()
|
|||
{
|
||||
if (!(set_collation= get_charset_by_name(colname,MYF(0))))
|
||||
{
|
||||
my_error(ER_UNKNOWN_COLLATION, MYF(0), colname);
|
||||
my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
|
||||
colname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2226,8 +2228,9 @@ void Item_func_set_collation::fix_length_and_dec()
|
|||
if (!set_collation ||
|
||||
!my_charset_same(args[0]->collation.collation,set_collation))
|
||||
{
|
||||
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
|
||||
colname,args[0]->collation.collation->csname);
|
||||
my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
|
||||
ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
|
||||
colname, args[0]->collation.collation->csname);
|
||||
return;
|
||||
}
|
||||
collation.set(set_collation, DERIVATION_EXPLICIT);
|
||||
|
|
|
@ -66,7 +66,7 @@ void Item_subselect::init(st_select_lex *select_lex,
|
|||
parsing_place= unit->item->parsing_place;
|
||||
unit->item->engine= 0;
|
||||
unit->item= this;
|
||||
engine->change_item(this, result);
|
||||
engine->change_result(this, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -133,13 +133,13 @@ Item_subselect::select_transformer(JOIN *join)
|
|||
bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
|
||||
{
|
||||
char const *save_where= thd_param->where;
|
||||
int res;
|
||||
bool res;
|
||||
|
||||
DBUG_ASSERT(fixed == 0);
|
||||
engine->set_thd((thd= thd_param));
|
||||
|
||||
if (check_stack_overrun(thd, (gptr)&res))
|
||||
return 1;
|
||||
return TRUE;
|
||||
|
||||
res= engine->prepare();
|
||||
|
||||
|
@ -171,7 +171,7 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
|
|||
if (engine->cols() > max_columns)
|
||||
{
|
||||
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
fix_length_and_dec();
|
||||
}
|
||||
|
@ -1504,12 +1504,12 @@ void subselect_indexsubquery_engine::print(String *str)
|
|||
res new select_result object
|
||||
|
||||
RETURN
|
||||
0 OK
|
||||
-1 error
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int subselect_single_select_engine::change_item(Item_subselect *si,
|
||||
select_subselect *res)
|
||||
bool subselect_single_select_engine::change_result(Item_subselect *si,
|
||||
select_subselect *res)
|
||||
{
|
||||
item= si;
|
||||
result= res;
|
||||
|
@ -1526,12 +1526,12 @@ int subselect_single_select_engine::change_item(Item_subselect *si,
|
|||
res new select_result object
|
||||
|
||||
RETURN
|
||||
0 OK
|
||||
-1 error
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int subselect_union_engine::change_item(Item_subselect *si,
|
||||
select_subselect *res)
|
||||
bool subselect_union_engine::change_result(Item_subselect *si,
|
||||
select_subselect *res)
|
||||
{
|
||||
item= si;
|
||||
int rc= unit->change_result(res, result);
|
||||
|
@ -1549,14 +1549,15 @@ int subselect_union_engine::change_item(Item_subselect *si,
|
|||
res new select_result object
|
||||
|
||||
RETURN
|
||||
-1 error
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int subselect_uniquesubquery_engine::change_item(Item_subselect *si,
|
||||
select_subselect *res)
|
||||
bool subselect_uniquesubquery_engine::change_result(Item_subselect *si,
|
||||
select_subselect *res)
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return -1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ public:
|
|||
virtual table_map upper_select_const_tables()= 0;
|
||||
static table_map calc_const_tables(TABLE_LIST *);
|
||||
virtual void print(String *str)= 0;
|
||||
virtual int change_item(Item_subselect *si, select_subselect *result)= 0;
|
||||
virtual bool change_result(Item_subselect *si, select_subselect *result)= 0;
|
||||
virtual bool no_tables()= 0;
|
||||
};
|
||||
|
||||
|
@ -315,7 +315,7 @@ public:
|
|||
void exclude();
|
||||
table_map upper_select_const_tables();
|
||||
void print (String *str);
|
||||
int change_item(Item_subselect *si, select_subselect *result);
|
||||
bool change_result(Item_subselect *si, select_subselect *result);
|
||||
bool no_tables();
|
||||
};
|
||||
|
||||
|
@ -336,7 +336,7 @@ public:
|
|||
void exclude();
|
||||
table_map upper_select_const_tables();
|
||||
void print (String *str);
|
||||
int change_item(Item_subselect *si, select_subselect *result);
|
||||
bool change_result(Item_subselect *si, select_subselect *result);
|
||||
bool no_tables();
|
||||
};
|
||||
|
||||
|
@ -366,7 +366,7 @@ public:
|
|||
void exclude();
|
||||
table_map upper_select_const_tables() { return 0; }
|
||||
void print (String *str);
|
||||
int change_item(Item_subselect *si, select_subselect *result);
|
||||
bool change_result(Item_subselect *si, select_subselect *result);
|
||||
bool no_tables();
|
||||
};
|
||||
|
||||
|
|
|
@ -173,8 +173,9 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
|
||||
if (!thd->allow_sum_func)
|
||||
{
|
||||
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
|
||||
return 1;
|
||||
my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
|
||||
MYF(0));
|
||||
return TRUE;
|
||||
}
|
||||
thd->allow_sum_func=0; // No included group funcs
|
||||
decimals=0;
|
||||
|
@ -182,7 +183,7 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
for (uint i=0 ; i < arg_count ; i++)
|
||||
{
|
||||
if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
|
||||
return 1;
|
||||
return TRUE;
|
||||
if (decimals < args[i]->decimals)
|
||||
decimals=args[i]->decimals;
|
||||
maybe_null |= args[i]->maybe_null;
|
||||
|
@ -193,7 +194,7 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
fix_length_and_dec();
|
||||
thd->allow_sum_func=1; // Allow group functions
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,8 +206,9 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
Item *item= args[0];
|
||||
if (!thd->allow_sum_func)
|
||||
{
|
||||
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
|
||||
return 1;
|
||||
my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
|
||||
MYF(0));
|
||||
return TRUE;
|
||||
}
|
||||
thd->allow_sum_func=0; // No included group funcs
|
||||
|
||||
|
@ -214,7 +216,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
if (!item->fixed &&
|
||||
item->fix_fields(thd, tables, args) ||
|
||||
(item= args[0])->check_cols(1))
|
||||
return 1;
|
||||
return TRUE;
|
||||
|
||||
hybrid_type= item->result_type();
|
||||
if (hybrid_type == INT_RESULT)
|
||||
|
@ -245,7 +247,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
else
|
||||
hybrid_field_type= Item::field_type();
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2004,8 +2006,9 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
|
||||
if (!thd->allow_sum_func)
|
||||
{
|
||||
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
|
||||
return 1;
|
||||
my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
|
||||
MYF(0));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
thd->allow_sum_func= 0;
|
||||
|
@ -2019,7 +2022,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
for (i=0 ; i < arg_count ; i++)
|
||||
{
|
||||
if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
|
||||
return 1;
|
||||
return TRUE;
|
||||
if (i < arg_count_field)
|
||||
maybe_null|= args[i]->maybe_null;
|
||||
}
|
||||
|
@ -2029,12 +2032,12 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
max_length= group_concat_max_len;
|
||||
thd->allow_sum_func= 1;
|
||||
if (!(tmp_table_param= new TMP_TABLE_PARAM))
|
||||
return 1;
|
||||
return TRUE;
|
||||
/* We'll convert all blobs to varchar fields in the temporary table */
|
||||
tmp_table_param->convert_blob_length= group_concat_max_len;
|
||||
tables_list= tables;
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1669,7 +1669,7 @@ Item_func_convert_tz::fix_fields(THD *thd_arg, TABLE_LIST *tables_arg, Item **re
|
|||
{
|
||||
String str;
|
||||
if (Item_date_func::fix_fields(thd_arg, tables_arg, ref))
|
||||
return 1;
|
||||
return TRUE;
|
||||
|
||||
tz_tables= thd_arg->lex->time_zone_tables_used;
|
||||
|
||||
|
@ -1679,7 +1679,7 @@ Item_func_convert_tz::fix_fields(THD *thd_arg, TABLE_LIST *tables_arg, Item **re
|
|||
if (args[2]->const_item())
|
||||
to_tz= my_tz_find(args[2]->val_str(&str), tz_tables);
|
||||
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
{
|
||||
DBUG_ASSERT(fixed == 0);
|
||||
fixed= 1;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
Item *copy_or_same(THD* thd)
|
||||
{
|
||||
|
|
|
@ -430,7 +430,8 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
|
|||
*write_lock_used=table;
|
||||
if (table->db_stat & HA_READ_ONLY)
|
||||
{
|
||||
my_error(ER_OPEN_AS_READONLY,MYF(0),table->table_name);
|
||||
my_printf_error(ER_OPEN_AS_READONLY, ER(ER_OPEN_AS_READONLY), MYF(0),
|
||||
table->table_name);
|
||||
my_free((gptr) sql_lock,MYF(0));
|
||||
return 0;
|
||||
}
|
||||
|
@ -795,7 +796,8 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
|
|||
if (thd->global_read_lock) // This thread had the read locks
|
||||
{
|
||||
if (is_not_commit)
|
||||
my_error(ER_CANT_UPDATE_WITH_READLOCK,MYF(0));
|
||||
my_message(ER_CANT_UPDATE_WITH_READLOCK,
|
||||
ER(ER_CANT_UPDATE_WITH_READLOCK), MYF(0));
|
||||
(void) pthread_mutex_unlock(&LOCK_open);
|
||||
/*
|
||||
We allow FLUSHer to COMMIT; we assume FLUSHer knows what it does.
|
||||
|
|
|
@ -1515,9 +1515,10 @@ err:
|
|||
if (error)
|
||||
{
|
||||
if (my_errno == EFBIG)
|
||||
my_error(ER_TRANS_CACHE_FULL, MYF(0));
|
||||
my_message(ER_TRANS_CACHE_FULL, ER(ER_TRANS_CACHE_FULL), MYF(0));
|
||||
else
|
||||
my_error(ER_ERROR_ON_WRITE, MYF(0), name, errno);
|
||||
my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0),
|
||||
name, errno);
|
||||
write_error=1;
|
||||
}
|
||||
if (file == &log_file)
|
||||
|
|
|
@ -2598,7 +2598,7 @@ Slave: load data infile on table '%s' at log position %s in log \
|
|||
my_afree(load_data_query);
|
||||
if (thd->query_error)
|
||||
{
|
||||
/* this err/sql_errno code is copy-paste from send_error() */
|
||||
/* this err/sql_errno code is copy-paste from net_send_error() */
|
||||
const char *err;
|
||||
int sql_errno;
|
||||
if ((err=thd->net.last_error)[0])
|
||||
|
|
246
sql/mysql_priv.h
246
sql/mysql_priv.h
|
@ -411,17 +411,17 @@ bool check_one_table_access(THD *thd, ulong privilege,
|
|||
bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
|
||||
bool check_merge_table_access(THD *thd, char *db,
|
||||
TABLE_LIST *table_list);
|
||||
int multi_update_precheck(THD *thd, TABLE_LIST *tables);
|
||||
int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count);
|
||||
int mysql_multi_update_prepare(THD *thd);
|
||||
int mysql_multi_delete_prepare(THD *thd);
|
||||
int mysql_insert_select_prepare(THD *thd);
|
||||
int insert_select_precheck(THD *thd, TABLE_LIST *tables);
|
||||
int update_precheck(THD *thd, TABLE_LIST *tables);
|
||||
int delete_precheck(THD *thd, TABLE_LIST *tables);
|
||||
int insert_precheck(THD *thd, TABLE_LIST *tables);
|
||||
int create_table_precheck(THD *thd, TABLE_LIST *tables,
|
||||
TABLE_LIST *create_table);
|
||||
bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
|
||||
bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count);
|
||||
bool mysql_multi_update_prepare(THD *thd);
|
||||
bool mysql_multi_delete_prepare(THD *thd);
|
||||
bool mysql_insert_select_prepare(THD *thd);
|
||||
bool insert_select_precheck(THD *thd, TABLE_LIST *tables);
|
||||
bool update_precheck(THD *thd, TABLE_LIST *tables);
|
||||
bool delete_precheck(THD *thd, TABLE_LIST *tables);
|
||||
bool insert_precheck(THD *thd, TABLE_LIST *tables);
|
||||
bool create_table_precheck(THD *thd, TABLE_LIST *tables,
|
||||
TABLE_LIST *create_table);
|
||||
Item *negate_expression(THD *thd, Item *expr);
|
||||
#include "sql_class.h"
|
||||
#include "opt_range.h"
|
||||
|
@ -471,12 +471,12 @@ struct Query_cache_query_flags
|
|||
|
||||
#define prepare_execute(A) ((A)->command == COM_EXECUTE)
|
||||
|
||||
int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
|
||||
int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
|
||||
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
|
||||
bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
|
||||
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
|
||||
bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
|
||||
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
|
||||
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
||||
my_bool drop_temporary);
|
||||
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
||||
my_bool drop_temporary);
|
||||
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
bool drop_temporary, bool drop_view, bool log_query);
|
||||
int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables,
|
||||
|
@ -504,7 +504,7 @@ extern "C" pthread_handler_decl(handle_one_connection,arg);
|
|||
extern "C" pthread_handler_decl(handle_bootstrap,arg);
|
||||
void end_thread(THD *thd,bool put_in_cache);
|
||||
void flush_thread_cache();
|
||||
int mysql_execute_command(THD *thd);
|
||||
bool mysql_execute_command(THD *thd);
|
||||
bool do_command(THD *thd);
|
||||
bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
char* packet, uint packet_length);
|
||||
|
@ -523,22 +523,22 @@ bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
|
|||
bool no_errors);
|
||||
bool check_global_access(THD *thd, ulong want_access);
|
||||
|
||||
int mysql_backup_table(THD* thd, TABLE_LIST* table_list);
|
||||
int mysql_restore_table(THD* thd, TABLE_LIST* table_list);
|
||||
bool mysql_backup_table(THD* thd, TABLE_LIST* table_list);
|
||||
bool mysql_restore_table(THD* thd, TABLE_LIST* table_list);
|
||||
|
||||
int mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
int mysql_check_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
int mysql_repair_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
int mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
int mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
int mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
|
||||
LEX_STRING *key_cache_name);
|
||||
int mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
|
||||
bool mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
bool mysql_check_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
bool mysql_repair_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
bool mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
bool mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
|
||||
HA_CHECK_OPT* check_opt);
|
||||
bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
|
||||
LEX_STRING *key_cache_name);
|
||||
bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
|
||||
int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
|
||||
KEY_CACHE *dst_cache);
|
||||
|
||||
|
@ -551,20 +551,20 @@ int setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
|
|||
List<Item> &fields, List<Item> &all_fields, ORDER *order,
|
||||
bool *hidden_group_fields);
|
||||
|
||||
int handle_select(THD *thd, LEX *lex, select_result *result);
|
||||
int mysql_select(THD *thd, Item ***rref_pointer_array,
|
||||
TABLE_LIST *tables, uint wild_num, List<Item> &list,
|
||||
COND *conds, uint og_num, ORDER *order, ORDER *group,
|
||||
Item *having, ORDER *proc_param, ulong select_type,
|
||||
select_result *result, SELECT_LEX_UNIT *unit,
|
||||
SELECT_LEX *select_lex);
|
||||
bool handle_select(THD *thd, LEX *lex, select_result *result);
|
||||
bool mysql_select(THD *thd, Item ***rref_pointer_array,
|
||||
TABLE_LIST *tables, uint wild_num, List<Item> &list,
|
||||
COND *conds, uint og_num, ORDER *order, ORDER *group,
|
||||
Item *having, ORDER *proc_param, ulong select_type,
|
||||
select_result *result, SELECT_LEX_UNIT *unit,
|
||||
SELECT_LEX *select_lex);
|
||||
void free_underlaid_joins(THD *thd, SELECT_LEX *select);
|
||||
int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit,
|
||||
select_result *result);
|
||||
bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit,
|
||||
select_result *result);
|
||||
int mysql_explain_select(THD *thd, SELECT_LEX *sl, char const *type,
|
||||
select_result *result);
|
||||
int mysql_union(THD *thd, LEX *lex, select_result *result,
|
||||
SELECT_LEX_UNIT *unit);
|
||||
bool mysql_union(THD *thd, LEX *lex, select_result *result,
|
||||
SELECT_LEX_UNIT *unit);
|
||||
int mysql_handle_derived(LEX *lex, int (*processor)(THD *thd,
|
||||
LEX *lex,
|
||||
TABLE_LIST *table));
|
||||
|
@ -578,61 +578,61 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
List<Key> &keys, uint &db_options,
|
||||
handler *file, KEY *&key_info_buffer,
|
||||
uint &key_count, int select_field_count);
|
||||
int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
List<create_field> &fields, List<Key> &keys,
|
||||
bool tmp_table, uint select_field_count);
|
||||
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
List<create_field> &fields, List<Key> &keys,
|
||||
bool tmp_table, uint select_field_count);
|
||||
|
||||
TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
||||
TABLE_LIST *create_table,
|
||||
List<create_field> *extra_fields,
|
||||
List<Key> *keys,
|
||||
List<Item> *items,
|
||||
MYSQL_LOCK **lock);
|
||||
int mysql_alter_table(THD *thd, char *new_db, char *new_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
TABLE_LIST *table_list,
|
||||
List<create_field> &fields,
|
||||
List<Key> &keys,
|
||||
uint order_num, ORDER *order,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
ALTER_INFO *alter_info, bool do_send_ok=1);
|
||||
int mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok);
|
||||
int mysql_create_like_table(THD *thd, TABLE_LIST *table,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Table_ident *src_table);
|
||||
MYSQL_LOCK **lock);
|
||||
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
TABLE_LIST *table_list,
|
||||
List<create_field> &fields,
|
||||
List<Key> &keys,
|
||||
uint order_num, ORDER *order,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
ALTER_INFO *alter_info, bool do_send_ok=1);
|
||||
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok);
|
||||
bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Table_ident *src_table);
|
||||
bool mysql_rename_table(enum db_type base,
|
||||
const char *old_db,
|
||||
const char * old_name,
|
||||
const char *new_db,
|
||||
const char * new_name);
|
||||
int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
|
||||
int mysql_drop_index(THD *thd, TABLE_LIST *table_list,
|
||||
ALTER_INFO *alter_info);
|
||||
int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
||||
Item **conds, uint order_num, ORDER *order);
|
||||
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
|
||||
List<Item> &values,COND *conds,
|
||||
uint order_num, ORDER *order, ha_rows limit,
|
||||
enum enum_duplicates handle_duplicates);
|
||||
int mysql_multi_update(THD *thd, TABLE_LIST *table_list,
|
||||
List<Item> *fields, List<Item> *values,
|
||||
COND *conds, ulong options,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
|
||||
int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
||||
List<Item> &fields, List_item *values,
|
||||
List<Item> &update_fields,
|
||||
List<Item> &update_values, enum_duplicates duplic);
|
||||
int mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
|
||||
List<List_item> &values, List<Item> &update_fields,
|
||||
List<Item> &update_values, enum_duplicates flag);
|
||||
bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
|
||||
bool mysql_drop_index(THD *thd, TABLE_LIST *table_list,
|
||||
ALTER_INFO *alter_info);
|
||||
bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
||||
Item **conds, uint order_num, ORDER *order);
|
||||
bool mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
|
||||
List<Item> &values,COND *conds,
|
||||
uint order_num, ORDER *order, ha_rows limit,
|
||||
enum enum_duplicates handle_duplicates);
|
||||
bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
|
||||
List<Item> *fields, List<Item> *values,
|
||||
COND *conds, ulong options,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
|
||||
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
||||
List<Item> &fields, List_item *values,
|
||||
List<Item> &update_fields,
|
||||
List<Item> &update_values, enum_duplicates duplic);
|
||||
bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
|
||||
List<List_item> &values, List<Item> &update_fields,
|
||||
List<Item> &update_values, enum_duplicates flag);
|
||||
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry);
|
||||
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
|
||||
int mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order,
|
||||
ha_rows rows, ulong options);
|
||||
int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
|
||||
int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
|
||||
bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
|
||||
bool mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order,
|
||||
ha_rows rows, ulong options);
|
||||
bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
|
||||
bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
|
||||
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update);
|
||||
TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem,
|
||||
bool *refresh);
|
||||
|
@ -689,46 +689,46 @@ void free_des_key_file();
|
|||
#endif /* HAVE_OPENSSL */
|
||||
|
||||
/* sql_do.cc */
|
||||
int mysql_do(THD *thd, List<Item> &values);
|
||||
bool mysql_do(THD *thd, List<Item> &values);
|
||||
|
||||
/* sql_show.cc */
|
||||
int mysqld_show_dbs(THD *thd,const char *wild);
|
||||
int mysqld_show_open_tables(THD *thd,const char *wild);
|
||||
int mysqld_show_tables(THD *thd, const char *db, const char *wild,
|
||||
bool verbose);
|
||||
int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild);
|
||||
int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
|
||||
bool verbose);
|
||||
int mysqld_show_keys(THD *thd, TABLE_LIST *table);
|
||||
int mysqld_show_logs(THD *thd);
|
||||
bool mysqld_show_dbs(THD *thd,const char *wild);
|
||||
bool mysqld_show_open_tables(THD *thd,const char *wild);
|
||||
bool mysqld_show_tables(THD *thd, const char *db, const char *wild,
|
||||
bool verbose);
|
||||
bool mysqld_extend_show_tables(THD *thd,const char *db,const char *wild);
|
||||
bool mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
|
||||
bool verbose);
|
||||
bool mysqld_show_keys(THD *thd, TABLE_LIST *table);
|
||||
bool mysqld_show_logs(THD *thd);
|
||||
void append_identifier(THD *thd, String *packet, const char *name,
|
||||
uint length);
|
||||
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
|
||||
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
|
||||
int mysqld_dump_create_info(THD *thd, TABLE *table, int fd = -1);
|
||||
int mysqld_show_create(THD *thd, TABLE_LIST *table_list);
|
||||
int mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
|
||||
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
|
||||
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
|
||||
|
||||
void mysqld_list_processes(THD *thd,const char *user,bool verbose);
|
||||
int mysqld_show_status(THD *thd);
|
||||
int mysqld_show_variables(THD *thd,const char *wild);
|
||||
int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
||||
bool mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
||||
enum enum_var_type value_type,
|
||||
pthread_mutex_t *mutex,
|
||||
struct system_status_var *status_var);
|
||||
int mysql_find_files(THD *thd,List<char> *files, const char *db,
|
||||
const char *path, const char *wild, bool dir);
|
||||
int mysqld_show_charsets(THD *thd,const char *wild);
|
||||
int mysqld_show_collations(THD *thd,const char *wild);
|
||||
int mysqld_show_storage_engines(THD *thd);
|
||||
int mysqld_show_privileges(THD *thd);
|
||||
int mysqld_show_column_types(THD *thd);
|
||||
int mysqld_help (THD *thd, const char *text);
|
||||
bool mysqld_show_charsets(THD *thd,const char *wild);
|
||||
bool mysqld_show_collations(THD *thd,const char *wild);
|
||||
bool mysqld_show_storage_engines(THD *thd);
|
||||
bool mysqld_show_privileges(THD *thd);
|
||||
bool mysqld_show_column_types(THD *thd);
|
||||
bool mysqld_help (THD *thd, const char *text);
|
||||
void calc_sum_of_all_status(STATUS_VAR *to);
|
||||
|
||||
/* sql_prepare.cc */
|
||||
int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
|
||||
LEX_STRING *name=NULL);
|
||||
bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
|
||||
LEX_STRING *name=NULL);
|
||||
void mysql_stmt_execute(THD *thd, char *packet, uint packet_length);
|
||||
void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name);
|
||||
void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length);
|
||||
|
@ -743,13 +743,13 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint
|
|||
void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
|
||||
uint code, const char *format, ...);
|
||||
void mysql_reset_errors(THD *thd);
|
||||
my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
|
||||
bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
|
||||
|
||||
/* sql_handler.cc */
|
||||
int mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen= 0);
|
||||
int mysql_ha_close(THD *thd, TABLE_LIST *tables);
|
||||
int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
|
||||
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
|
||||
bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen= 0);
|
||||
bool mysql_ha_close(THD *thd, TABLE_LIST *tables);
|
||||
bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
|
||||
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
|
||||
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags);
|
||||
/* mysql_ha_flush mode_flags bits */
|
||||
#define MYSQL_HA_CLOSE_FINAL 0x00
|
||||
|
@ -789,16 +789,16 @@ bool insert_fields(THD *thd,TABLE_LIST *tables,
|
|||
bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds);
|
||||
int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
|
||||
List<Item> *sum_func_list, uint wild_num);
|
||||
int setup_fields(THD *thd, Item** ref_pointer_array, TABLE_LIST *tables,
|
||||
List<Item> &item, bool set_query_id,
|
||||
List<Item> *sum_func_list, bool allow_sum_func);
|
||||
bool setup_fields(THD *thd, Item** ref_pointer_array, TABLE_LIST *tables,
|
||||
List<Item> &item, bool set_query_id,
|
||||
List<Item> *sum_func_list, bool allow_sum_func);
|
||||
int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds);
|
||||
int setup_ftfuncs(SELECT_LEX* select);
|
||||
int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
|
||||
void wait_for_refresh(THD *thd);
|
||||
int open_tables(THD *thd, TABLE_LIST *tables, uint *counter);
|
||||
int simple_open_n_lock_tables(THD *thd,TABLE_LIST *tables);
|
||||
int open_and_lock_tables(THD *thd,TABLE_LIST *tables);
|
||||
bool open_and_lock_tables(THD *thd,TABLE_LIST *tables);
|
||||
int lock_tables(THD *thd, TABLE_LIST *tables, uint counter);
|
||||
TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
|
||||
const char *table_name, bool link_in_list);
|
||||
|
@ -823,8 +823,10 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table,
|
|||
bool return_if_owned_by_thd=0);
|
||||
bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
|
||||
void copy_field_from_tmp_record(Field *field,int offset);
|
||||
int fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors);
|
||||
int fill_record(Field **field,List<Item> &values, bool ignore_errors);
|
||||
bool fill_record(THD *thd, List<Item> &fields, List<Item> &values,
|
||||
bool ignore_errors);
|
||||
bool fill_record(THD *thd, Field **field, List<Item> &values,
|
||||
bool ignore_errors);
|
||||
OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild);
|
||||
|
||||
inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table,
|
||||
|
@ -848,10 +850,10 @@ inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table,
|
|||
bool eval_const_cond(COND *cond);
|
||||
|
||||
/* sql_load.cc */
|
||||
int mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
|
||||
List<Item> &fields, enum enum_duplicates handle_duplicates,
|
||||
bool local_file, thr_lock_type lock_type,
|
||||
bool ignore_check_option_errors);
|
||||
bool mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
|
||||
List<Item> &fields, enum enum_duplicates handle_duplicates,
|
||||
bool local_file, thr_lock_type lock_type,
|
||||
bool ignore_check_option_errors);
|
||||
int write_record(THD *thd, TABLE *table, COPY_INFO *info);
|
||||
|
||||
/* sql_manager.cc */
|
||||
|
|
|
@ -1172,7 +1172,8 @@ static void server_init(void)
|
|||
WSADATA WsaData;
|
||||
if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData))
|
||||
{
|
||||
my_message(0,"WSAStartup Failed\n",MYF(0));
|
||||
/* errors are not read yet, so we use test here */
|
||||
my_message(ER_WSAS_FAILED, "WSAStartup Failed", MYF(0));
|
||||
unireg_abort(1);
|
||||
}
|
||||
}
|
||||
|
@ -1334,8 +1335,9 @@ void yyerror(const char *s)
|
|||
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
|
||||
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
|
||||
s=ER(ER_SYNTAX_ERROR);
|
||||
net_printf(thd,ER_PARSE_ERROR, s, yytext ? (char*) yytext : "",
|
||||
thd->lex->yylineno);
|
||||
my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
|
||||
(yytext ? (char*) yytext : ""),
|
||||
thd->lex->yylineno);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1366,7 +1368,7 @@ void close_connection(THD *thd, uint errcode, bool lock)
|
|||
if ((vio=thd->net.vio) != 0)
|
||||
{
|
||||
if (errcode)
|
||||
send_error(thd, errcode, ER(errcode)); /* purecov: inspected */
|
||||
net_send_error(thd, errcode, ER(errcode)); /* purecov: inspected */
|
||||
vio_close(vio); /* vio is freed in delete thd */
|
||||
}
|
||||
if (lock)
|
||||
|
@ -2130,6 +2132,11 @@ extern "C" int my_message_sql(uint error, const char *str, myf MyFlags)
|
|||
THD *thd;
|
||||
DBUG_ENTER("my_message_sql");
|
||||
DBUG_PRINT("error", ("error: %u message: '%s'", error, str));
|
||||
/*
|
||||
Put here following assertion when situation with EE_* error codes
|
||||
will be fixed
|
||||
DBUG_ASSERT(error != 0);
|
||||
*/
|
||||
if ((thd= current_thd))
|
||||
{
|
||||
if (thd->spcont &&
|
||||
|
@ -2137,6 +2144,9 @@ extern "C" int my_message_sql(uint error, const char *str, myf MyFlags)
|
|||
{
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
thd->query_error= 1; // needed to catch query errors during replication
|
||||
|
||||
/*
|
||||
thd->lex->current_select == 0 if lex structure is not inited
|
||||
(not query command (COM_QUERY))
|
||||
|
@ -2155,6 +2165,9 @@ extern "C" int my_message_sql(uint error, const char *str, myf MyFlags)
|
|||
{
|
||||
NET *net= &thd->net;
|
||||
net->report_error= 1;
|
||||
#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
|
||||
query_cache_abort(net);
|
||||
#endif
|
||||
if (!net->last_error[0]) // Return only first message
|
||||
{
|
||||
strmake(net->last_error, str, sizeof(net->last_error)-1);
|
||||
|
@ -3430,10 +3443,10 @@ static void create_new_thread(THD *thd)
|
|||
("Can't create thread to handle request (error %d)",
|
||||
error));
|
||||
thread_count--;
|
||||
thd->killed= THD::KILL_CONNECTION; // Safety
|
||||
thd->killed= THD::KILL_CONNECTION; // Safety
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
net_printf(thd,ER_CANT_CREATE_THREAD,error);
|
||||
net_printf_error(thd, ER_CANT_CREATE_THREAD, error);
|
||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||
close_connection(thd,0,0);
|
||||
delete thd;
|
||||
|
|
|
@ -350,7 +350,8 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
|
|||
|
||||
if (stat_info.st_size > INT_MAX-1)
|
||||
{
|
||||
my_error(ER_FPARSER_TOO_BIG_FILE, MYF(0), file_name->str);
|
||||
my_printf_error(ER_FPARSER_TOO_BIG_FILE,
|
||||
ER(ER_FPARSER_TOO_BIG_FILE), MYF(0), file_name->str);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -412,7 +413,8 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
|
|||
frm_error:
|
||||
if (bad_format_errors)
|
||||
{
|
||||
my_error(ER_FPARSER_BAD_HEADER, MYF(0), file_name->str);
|
||||
my_printf_error(ER_FPARSER_BAD_HEADER, ER(ER_FPARSER_BAD_HEADER), MYF(0),
|
||||
file_name->str);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
else
|
||||
|
@ -625,7 +627,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
|
|||
// it is comment
|
||||
if (!(ptr= strchr(ptr, '\n')))
|
||||
{
|
||||
my_error(ER_FPARSER_EOF_IN_COMMENT, MYF(0), line);
|
||||
my_printf_error(ER_FPARSER_EOF_IN_COMMENT,
|
||||
ER(ER_FPARSER_EOF_IN_COMMENT), MYF(0), line);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
ptr++;
|
||||
|
@ -667,8 +670,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
|
|||
(LEX_STRING *)(base +
|
||||
parameter->offset))))
|
||||
{
|
||||
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
|
||||
parameter->name.str, line);
|
||||
my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
|
||||
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
|
||||
parameter->name.str, line);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
break;
|
||||
|
@ -679,8 +683,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
|
|||
(LEX_STRING *)
|
||||
(base + parameter->offset))))
|
||||
{
|
||||
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
|
||||
parameter->name.str, line);
|
||||
my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
|
||||
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
|
||||
parameter->name.str, line);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
break;
|
||||
|
@ -689,8 +694,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
|
|||
case FILE_OPTIONS_REV:
|
||||
if (!(eol= strchr(ptr, '\n')))
|
||||
{
|
||||
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
|
||||
parameter->name.str, line);
|
||||
my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
|
||||
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
|
||||
parameter->name.str, line);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
{
|
||||
|
@ -707,8 +713,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
|
|||
/* yyyy-mm-dd HH:MM:SS = 19(PARSE_FILE_TIMESTAMPLENGTH) characters */
|
||||
if (ptr[PARSE_FILE_TIMESTAMPLENGTH] != '\n')
|
||||
{
|
||||
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
|
||||
parameter->name.str, line);
|
||||
my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
|
||||
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
|
||||
parameter->name.str, line);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
memcpy(val->str, ptr, PARSE_FILE_TIMESTAMPLENGTH);
|
||||
|
@ -747,8 +754,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
|
|||
break;
|
||||
|
||||
list_err_w_message:
|
||||
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
|
||||
parameter->name.str, line);
|
||||
my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
|
||||
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
|
||||
parameter->name.str, line);
|
||||
list_err:
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
@ -761,8 +769,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
|
|||
// skip unknown parameter
|
||||
if (!(ptr= strchr(ptr, '\n')))
|
||||
{
|
||||
my_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER, MYF(0),
|
||||
line);
|
||||
my_printf_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER,
|
||||
ER(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER), MYF(0),
|
||||
line);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
ptr++;
|
||||
|
|
|
@ -53,14 +53,14 @@ bool Protocol_prep::net_store_data(const char *from, uint length)
|
|||
|
||||
/* Send a error string to client */
|
||||
|
||||
void send_error(THD *thd, uint sql_errno, const char *err)
|
||||
void net_send_error(THD *thd, uint sql_errno, const char *err)
|
||||
{
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
uint length;
|
||||
char buff[MYSQL_ERRMSG_SIZE+2], *pos;
|
||||
#endif
|
||||
NET *net= &thd->net;
|
||||
DBUG_ENTER("send_error");
|
||||
DBUG_ENTER("net_send_error");
|
||||
DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno,
|
||||
err ? err : net->last_error[0] ?
|
||||
net->last_error : "NULL"));
|
||||
|
@ -70,9 +70,6 @@ void send_error(THD *thd, uint sql_errno, const char *err)
|
|||
{
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
|
||||
query_cache_abort(net);
|
||||
#endif
|
||||
thd->query_error= 1; // needed to catch query errors during replication
|
||||
if (!err)
|
||||
{
|
||||
|
@ -172,7 +169,7 @@ void send_warning(THD *thd, uint sql_errno, const char *err)
|
|||
*/
|
||||
|
||||
void
|
||||
net_printf(THD *thd, uint errcode, ...)
|
||||
net_printf_error(THD *thd, uint errcode, ...)
|
||||
{
|
||||
va_list args;
|
||||
uint length,offset;
|
||||
|
@ -185,7 +182,7 @@ net_printf(THD *thd, uint errcode, ...)
|
|||
#endif
|
||||
NET *net= &thd->net;
|
||||
|
||||
DBUG_ENTER("net_printf");
|
||||
DBUG_ENTER("net_printf_error");
|
||||
DBUG_PRINT("enter",("message: %u",errcode));
|
||||
|
||||
if (thd->spcont && thd->spcont->find_handler(errcode,
|
||||
|
@ -199,8 +196,8 @@ net_printf(THD *thd, uint errcode, ...)
|
|||
#endif
|
||||
va_start(args,errcode);
|
||||
/*
|
||||
The following is needed to make net_printf() work with 0 argument for
|
||||
errorcode and use the argument after that as the format string. This
|
||||
The following is needed to make net_printf_error() work with 0 argument
|
||||
for errorcode and use the argument after that as the format string. This
|
||||
is useful for rare errors that are not worth the hassle to put in
|
||||
errmsg.sys, but at the same time, the message is not fixed text
|
||||
*/
|
||||
|
@ -627,7 +624,8 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
|
|||
DBUG_RETURN(prepare_for_send(list));
|
||||
|
||||
err:
|
||||
send_error(thd,ER_OUT_OF_RESOURCES); /* purecov: inspected */
|
||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES),
|
||||
MYF(0)); /* purecov: inspected */
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,8 @@ public:
|
|||
};
|
||||
|
||||
void send_warning(THD *thd, uint sql_errno, const char *err=0);
|
||||
void net_printf(THD *thd,uint sql_errno, ...);
|
||||
void net_printf_error(THD *thd, uint sql_errno, ...);
|
||||
void net_send_error(THD *thd, uint sql_errno=0, const char *err=0);
|
||||
void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L,
|
||||
const char *info=0);
|
||||
void send_eof(THD *thd, bool no_flush=0);
|
||||
|
|
|
@ -84,7 +84,8 @@ bool Protocol_cursor::send_fields(List<Item> *list, uint flags)
|
|||
DBUG_RETURN(FALSE);
|
||||
|
||||
err:
|
||||
send_error(thd, ER_OUT_OF_RESOURCES); /* purecov: inspected */
|
||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES),
|
||||
MYF(0)); /* purecov: inspected */
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,6 @@ err:
|
|||
my_message(ER_UNKNOWN_ERROR, "Wrong parameters to function register_slave",
|
||||
MYF(0));
|
||||
err2:
|
||||
send_error(thd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -438,7 +437,7 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
|
|||
This function is broken now. See comment for translate_master().
|
||||
*/
|
||||
|
||||
int show_new_master(THD* thd)
|
||||
bool show_new_master(THD* thd)
|
||||
{
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("show_new_master");
|
||||
|
@ -450,9 +449,10 @@ int show_new_master(THD* thd)
|
|||
if (translate_master(thd, lex_mi, errmsg))
|
||||
{
|
||||
if (errmsg[0])
|
||||
my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
|
||||
"SHOW NEW MASTER", errmsg);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_ERROR_WHEN_EXECUTING_COMMAND,
|
||||
ER(ER_ERROR_WHEN_EXECUTING_COMMAND), MYF(0),
|
||||
"SHOW NEW MASTER", errmsg);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -461,14 +461,14 @@ int show_new_master(THD* thd)
|
|||
MYSQL_TYPE_LONGLONG));
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(lex_mi->log_file_name, &my_charset_bin);
|
||||
protocol->store((ulonglong) lex_mi->pos);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -631,7 +631,7 @@ err:
|
|||
}
|
||||
|
||||
|
||||
int show_slave_hosts(THD* thd)
|
||||
bool show_slave_hosts(THD* thd)
|
||||
{
|
||||
List<Item> field_list;
|
||||
Protocol *protocol= thd->protocol;
|
||||
|
@ -653,7 +653,7 @@ int show_slave_hosts(THD* thd)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
pthread_mutex_lock(&LOCK_slave_list);
|
||||
|
||||
|
@ -674,12 +674,12 @@ int show_slave_hosts(THD* thd)
|
|||
if (protocol->write())
|
||||
{
|
||||
pthread_mutex_unlock(&LOCK_slave_list);
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_slave_list);
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -760,7 +760,7 @@ static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
|
|||
- No active transaction (flush_relay_log_info would not work in this case)
|
||||
*/
|
||||
|
||||
int load_master_data(THD* thd)
|
||||
bool load_master_data(THD* thd)
|
||||
{
|
||||
MYSQL mysql;
|
||||
MYSQL_RES* master_status_res = 0;
|
||||
|
@ -782,16 +782,16 @@ int load_master_data(THD* thd)
|
|||
(error=terminate_slave_threads(active_mi,restart_thread_mask,
|
||||
1 /*skip lock*/)))
|
||||
{
|
||||
send_error(thd,error);
|
||||
my_message(error, ER(error), MYF(0));
|
||||
unlock_slave_threads(active_mi);
|
||||
pthread_mutex_unlock(&LOCK_active_mi);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (connect_to_master(thd, &mysql, active_mi))
|
||||
{
|
||||
net_printf(thd, error= ER_CONNECT_TO_MASTER,
|
||||
mysql_error(&mysql));
|
||||
my_printf_error(error= ER_CONNECT_TO_MASTER,
|
||||
ER(ER_CONNECT_TO_MASTER), MYF(0), mysql_error(&mysql));
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -803,8 +803,8 @@ int load_master_data(THD* thd)
|
|||
if (mysql_real_query(&mysql, "SHOW DATABASES", 14) ||
|
||||
!(db_res = mysql_store_result(&mysql)))
|
||||
{
|
||||
net_printf(thd, error = ER_QUERY_ON_MASTER,
|
||||
mysql_error(&mysql));
|
||||
my_printf_error(error = ER_QUERY_ON_MASTER,
|
||||
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -817,7 +817,7 @@ int load_master_data(THD* thd)
|
|||
|
||||
if (!(table_res = (MYSQL_RES**)thd->alloc(num_dbs * sizeof(MYSQL_RES*))))
|
||||
{
|
||||
net_printf(thd, error = ER_OUTOFMEMORY);
|
||||
my_message(error = ER_OUTOFMEMORY, ER(ER_OUTOFMEMORY), MYF(0));
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -831,8 +831,8 @@ int load_master_data(THD* thd)
|
|||
mysql_real_query(&mysql, "SHOW MASTER STATUS",18) ||
|
||||
!(master_status_res = mysql_store_result(&mysql)))
|
||||
{
|
||||
net_printf(thd, error = ER_QUERY_ON_MASTER,
|
||||
mysql_error(&mysql));
|
||||
my_printf_error(error = ER_QUERY_ON_MASTER,
|
||||
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -877,7 +877,6 @@ int load_master_data(THD* thd)
|
|||
|
||||
if (mysql_create_db(thd, db, &create_info, 1))
|
||||
{
|
||||
send_error(thd, 0, 0);
|
||||
cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
|
||||
goto err;
|
||||
}
|
||||
|
@ -886,8 +885,8 @@ int load_master_data(THD* thd)
|
|||
mysql_real_query(&mysql, "SHOW TABLES", 11) ||
|
||||
!(*cur_table_res = mysql_store_result(&mysql)))
|
||||
{
|
||||
net_printf(thd, error = ER_QUERY_ON_MASTER,
|
||||
mysql_error(&mysql));
|
||||
my_printf_error(error = ER_QUERY_ON_MASTER,
|
||||
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
|
||||
cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
|
||||
goto err;
|
||||
}
|
||||
|
@ -925,7 +924,7 @@ int load_master_data(THD* thd)
|
|||
|
||||
if (init_master_info(active_mi, master_info_file, relay_log_info_file,
|
||||
0))
|
||||
send_error(thd, ER_MASTER_INFO);
|
||||
my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
|
||||
strmake(active_mi->master_log_name, row[0],
|
||||
sizeof(active_mi->master_log_name));
|
||||
active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error);
|
||||
|
@ -944,8 +943,8 @@ int load_master_data(THD* thd)
|
|||
|
||||
if (mysql_real_query(&mysql, "UNLOCK TABLES", 13))
|
||||
{
|
||||
net_printf(thd, error = ER_QUERY_ON_MASTER,
|
||||
mysql_error(&mysql));
|
||||
my_printf_error(error = ER_QUERY_ON_MASTER,
|
||||
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -954,10 +953,10 @@ int load_master_data(THD* thd)
|
|||
0 /* not only reset, but also reinit */,
|
||||
&errmsg))
|
||||
{
|
||||
send_error(thd, 0, "Failed purging old relay logs");
|
||||
my_printf_error(ER_RELAY_LOG_FAIL, ER(ER_RELAY_LOG_FAIL), MYF(0), errmsg);
|
||||
unlock_slave_threads(active_mi);
|
||||
pthread_mutex_unlock(&LOCK_active_mi);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
pthread_mutex_lock(&active_mi->rli.data_lock);
|
||||
active_mi->rli.group_master_log_pos = active_mi->master_log_pos;
|
||||
|
|
|
@ -38,11 +38,11 @@ int update_slave_list(MYSQL* mysql, MASTER_INFO* mi);
|
|||
|
||||
extern HASH slave_list;
|
||||
|
||||
int load_master_data(THD* thd);
|
||||
bool load_master_data(THD* thd);
|
||||
int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi);
|
||||
|
||||
int show_new_master(THD* thd);
|
||||
int show_slave_hosts(THD* thd);
|
||||
bool show_new_master(THD* thd);
|
||||
bool show_slave_hosts(THD* thd);
|
||||
int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg);
|
||||
void init_slave_list();
|
||||
void end_slave_list();
|
||||
|
|
|
@ -899,8 +899,8 @@ bool sys_var_str::check(THD *thd, set_var *var)
|
|||
return 0;
|
||||
|
||||
if ((res=(*check_func)(thd, var)) < 0)
|
||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name,
|
||||
var->value->str_value.ptr());
|
||||
my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
|
||||
name, var->value->str_value.ptr());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1174,7 +1174,8 @@ static int check_max_delayed_threads(THD *thd, set_var *var)
|
|||
val != (longlong) global_system_variables.max_insert_delayed_threads)
|
||||
{
|
||||
char buf[64];
|
||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, llstr(val, buf));
|
||||
my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
|
||||
MYF(0), var->var->name, llstr(val, buf));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1472,7 +1473,8 @@ bool sys_var::check_enum(THD *thd, set_var *var, TYPELIB *enum_names)
|
|||
return 0;
|
||||
|
||||
err:
|
||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, value);
|
||||
my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
|
||||
name, value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1513,7 +1515,8 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
|
|||
return 0;
|
||||
|
||||
err:
|
||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buff);
|
||||
my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
|
||||
MYF(0), name, buff);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1537,8 +1540,9 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
|
|||
{
|
||||
if (var_type != OPT_DEFAULT)
|
||||
{
|
||||
net_printf(thd, ER_INCORRECT_GLOBAL_LOCAL_VAR,
|
||||
name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
|
||||
my_printf_error(ER_INCORRECT_GLOBAL_LOCAL_VAR,
|
||||
ER(ER_INCORRECT_GLOBAL_LOCAL_VAR), MYF(0),
|
||||
name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
|
||||
return 0;
|
||||
}
|
||||
/* As there was no local variable, return the global value */
|
||||
|
@ -1581,7 +1585,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
|
|||
return tmp;
|
||||
}
|
||||
default:
|
||||
net_printf(thd, ER_VAR_CANT_BE_READ, name);
|
||||
my_printf_error(ER_VAR_CANT_BE_READ, ER(ER_VAR_CANT_BE_READ), MYF(0),
|
||||
name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1693,7 +1698,8 @@ bool sys_var_thd_date_time_format::check(THD *thd, set_var *var)
|
|||
if (!(format= date_time_format_make(date_time_type,
|
||||
res->ptr(), res->length())))
|
||||
{
|
||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr());
|
||||
my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
|
||||
name, res->c_ptr());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1791,12 +1797,14 @@ bool sys_var_collation::check(THD *thd, set_var *var)
|
|||
String str(buff,sizeof(buff), system_charset_info), *res;
|
||||
if (!(res=var->value->val_str(&str)))
|
||||
{
|
||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
|
||||
my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
|
||||
MYF(0), name, "NULL");
|
||||
return 1;
|
||||
}
|
||||
if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0))))
|
||||
{
|
||||
my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr());
|
||||
my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
|
||||
res->c_ptr());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1806,7 +1814,8 @@ bool sys_var_collation::check(THD *thd, set_var *var)
|
|||
{
|
||||
char buf[20];
|
||||
int10_to_str((int) var->value->val_int(), buf, -10);
|
||||
my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
|
||||
my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
|
||||
buf);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1827,7 +1836,8 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
|
|||
{
|
||||
if (!nullable)
|
||||
{
|
||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
|
||||
my_printf_error(ER_WRONG_VALUE_FOR_VAR,
|
||||
ER(ER_WRONG_VALUE_FOR_VAR), MYF(0), name, "NULL");
|
||||
return 1;
|
||||
}
|
||||
tmp= NULL;
|
||||
|
@ -1835,7 +1845,8 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
|
|||
else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) &&
|
||||
!(tmp=get_old_charset_by_name(res->c_ptr())))
|
||||
{
|
||||
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr());
|
||||
my_printf_error(ER_UNKNOWN_CHARACTER_SET, ER(ER_UNKNOWN_CHARACTER_SET),
|
||||
MYF(0), res->c_ptr());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1967,8 +1978,8 @@ bool sys_var_character_set_server::check(THD *thd, set_var *var)
|
|||
(mysql_bin_log.is_open() ||
|
||||
active_mi->slave_running || active_mi->rli.slave_running))
|
||||
{
|
||||
my_printf_error(0, "Binary logging and replication forbid changing \
|
||||
the global server character set or collation", MYF(0));
|
||||
my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0),
|
||||
"character set, collation");
|
||||
return 1;
|
||||
}
|
||||
return sys_var_character_set::check(thd,var);
|
||||
|
@ -2074,8 +2085,8 @@ bool sys_var_collation_server::check(THD *thd, set_var *var)
|
|||
(mysql_bin_log.is_open() ||
|
||||
active_mi->slave_running || active_mi->rli.slave_running))
|
||||
{
|
||||
my_printf_error(0, "Binary logging and replication forbid changing \
|
||||
the global server character set or collation", MYF(0));
|
||||
my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0),
|
||||
"character set, collation");
|
||||
return 1;
|
||||
}
|
||||
return sys_var_collation::check(thd,var);
|
||||
|
@ -2353,7 +2364,7 @@ bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
|
|||
pthread_mutex_lock(&active_mi->rli.run_lock);
|
||||
if (active_mi->rli.slave_running)
|
||||
{
|
||||
my_error(ER_SLAVE_MUST_STOP, MYF(0));
|
||||
my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
|
||||
result=1;
|
||||
}
|
||||
pthread_mutex_unlock(&active_mi->rli.run_lock);
|
||||
|
@ -2424,8 +2435,7 @@ bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
|
|||
(mysql_bin_log.is_open() ||
|
||||
active_mi->slave_running || active_mi->rli.slave_running))
|
||||
{
|
||||
my_printf_error(0, "Binary logging and replication forbid changing "
|
||||
"of the global server time zone", MYF(0));
|
||||
my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0), "time zone");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
@ -2433,7 +2443,8 @@ bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
|
|||
if (!(var->save_result.time_zone=
|
||||
my_tz_find(res, thd->lex->time_zone_tables_used)))
|
||||
{
|
||||
my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), res ? res->c_ptr() : "NULL");
|
||||
my_printf_error(ER_UNKNOWN_TIME_ZONE, ER(ER_UNKNOWN_TIME_ZONE), MYF(0),
|
||||
res ? res->c_ptr() : "NULL");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -2703,9 +2714,6 @@ void set_var_free()
|
|||
length Length of variable. zero means that we should use strlen()
|
||||
on the variable
|
||||
|
||||
NOTE
|
||||
We have to use net_printf() as this is called during the parsing stage
|
||||
|
||||
RETURN VALUES
|
||||
pointer pointer to variable definitions
|
||||
0 Unknown variable (error message is given)
|
||||
|
@ -2718,7 +2726,8 @@ sys_var *find_sys_var(const char *str, uint length)
|
|||
length ? length :
|
||||
strlen(str));
|
||||
if (!var)
|
||||
net_printf(current_thd, ER_UNKNOWN_SYSTEM_VARIABLE, (char*) str);
|
||||
my_printf_error(ER_UNKNOWN_SYSTEM_VARIABLE, ER(ER_UNKNOWN_SYSTEM_VARIABLE),
|
||||
MYF(0), (char*) str);
|
||||
return var;
|
||||
}
|
||||
|
||||
|
@ -2804,9 +2813,8 @@ int set_var::check(THD *thd)
|
|||
{
|
||||
if (var->check_type(type))
|
||||
{
|
||||
my_error(type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE,
|
||||
MYF(0),
|
||||
var->name);
|
||||
int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;
|
||||
my_printf_error(err, ER(err), MYF(0), var->name);
|
||||
return -1;
|
||||
}
|
||||
if ((type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL)))
|
||||
|
@ -2816,7 +2824,7 @@ int set_var::check(THD *thd)
|
|||
{
|
||||
if (var->check_default(type))
|
||||
{
|
||||
my_error(ER_NO_DEFAULT, MYF(0), var->name);
|
||||
my_printf_error(ER_NO_DEFAULT, ER(ER_NO_DEFAULT), MYF(0), var->name);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -2826,7 +2834,8 @@ int set_var::check(THD *thd)
|
|||
return -1;
|
||||
if (var->check_update_type(value->result_type()))
|
||||
{
|
||||
my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name);
|
||||
my_printf_error(ER_WRONG_TYPE_FOR_VAR, ER(ER_WRONG_TYPE_FOR_VAR), MYF(0),
|
||||
var->name);
|
||||
return -1;
|
||||
}
|
||||
return var->check(thd, this) ? -1 : 0;
|
||||
|
@ -2849,9 +2858,8 @@ int set_var::light_check(THD *thd)
|
|||
{
|
||||
if (var->check_type(type))
|
||||
{
|
||||
my_error(type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE,
|
||||
MYF(0),
|
||||
var->name);
|
||||
int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;
|
||||
my_printf_error(err, ER(err), MYF(0), var->name);
|
||||
return -1;
|
||||
}
|
||||
if (type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL))
|
||||
|
@ -2917,7 +2925,7 @@ int set_var_user::update(THD *thd)
|
|||
if (user_var_item->update())
|
||||
{
|
||||
/* Give an error if it's not given already */
|
||||
my_error(ER_SET_CONSTANTS_ONLY, MYF(0));
|
||||
my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY), MYF(0));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -2978,8 +2986,9 @@ bool sys_var_thd_storage_engine::check(THD *thd, set_var *var)
|
|||
value= "unknown";
|
||||
|
||||
err:
|
||||
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), value);
|
||||
return 1;
|
||||
my_printf_error(ER_UNKNOWN_STORAGE_ENGINE, ER(ER_UNKNOWN_STORAGE_ENGINE),
|
||||
MYF(0), value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -399,3 +399,22 @@ character-set=latin2
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -390,3 +390,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -399,3 +399,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -387,3 +387,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -392,3 +392,22 @@ character-set=latin7
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -387,3 +387,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -400,3 +400,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -387,3 +387,22 @@ character-set=greek
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -392,3 +392,22 @@ character-set=latin2
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -387,3 +387,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -391,3 +391,22 @@ character-set=ujis
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -387,3 +387,22 @@ character-set=euckr
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -389,3 +389,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -389,3 +389,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -392,3 +392,22 @@ character-set=latin2
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -389,3 +389,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -392,3 +392,22 @@ character-set=latin2
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -392,3 +392,22 @@ character-set=koi8r
|
|||
"CHECK OPTION ÄÌÑ ÎÅÏÂÎÏ×ÌÑÅÍÏÇÏ VIEW '%-.64s.%-.64s'"
|
||||
"ÐÒÏ×ÅÒËÁ CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÐÒÏ×ÁÌÉÌÁÓØ"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -380,3 +380,22 @@ character-set=cp1250
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -395,3 +395,22 @@ character-set=latin2
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -391,3 +391,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -387,3 +387,22 @@ character-set=latin1
|
|||
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
|
||||
"CHECK OPTION failed '%-.64s.%-.64s'"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
|
@ -393,3 +393,22 @@ character-set=koi8u
|
|||
"CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÝÏ ÎÅ ÍÏÖÅ ÂÕÔÉ ÏÎÏ×ÌÅÎÎÉÍ"
|
||||
"ÐÅÒÅצÒËÁ CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÎÅ ÐÒÏÊÛÌÁ"
|
||||
"Access denied; you are not the procedure/function definer of '%s'"
|
||||
"Failed purging old relay logs: %s"
|
||||
"Password hash should be a %d-digit hexadecimal number"
|
||||
"Target log not found in binlog index"
|
||||
"I/O error reading log index file"
|
||||
"Server configuration does not permit binlog purge"
|
||||
"Failed on fseek()"
|
||||
"Fatal error during log purge"
|
||||
"A purgeable log is in use, will not purge"
|
||||
"Unknown error during log purge"
|
||||
"Failed initializing relay log position: %s"
|
||||
"You are not using binary logging"
|
||||
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
|
||||
"WSAStartup Failed"
|
||||
"Can't handle procedures with differents groups yet"
|
||||
"Select must have a group with this procedure"
|
||||
"Can't use ORDER clause with this procedure"
|
||||
"Binary logging and replication forbid changing the global server %s"
|
||||
"Can't map file: %-.64s, errno: %d"
|
||||
"Wrong magic in %-.64s"
|
||||
|
|
27
sql/slave.cc
27
sql/slave.cc
|
@ -1493,7 +1493,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
|
|||
packet_len= my_net_read(net); // read create table statement
|
||||
if (packet_len == packet_error)
|
||||
{
|
||||
send_error(thd, ER_MASTER_NET_READ);
|
||||
my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (net->read_pos[0] == 255) // error from master
|
||||
|
@ -1502,7 +1502,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
|
|||
err_msg= (char*) net->read_pos + ((mysql->server_capabilities &
|
||||
CLIENT_PROTOCOL_41) ?
|
||||
3+SQLSTATE_LENGTH+1 : 3);
|
||||
net_printf(thd, ER_MASTER, err_msg);
|
||||
my_printf_error(ER_MASTER, ER(ER_MASTER), MYF(0), err_msg);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
thd->command = COM_TABLE_DUMP;
|
||||
|
@ -1511,7 +1511,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
|
|||
if (!(query = thd->strmake((char*) net->read_pos, packet_len)))
|
||||
{
|
||||
sql_print_error("create_table_from_dump: out of memory");
|
||||
net_printf(thd, ER_GET_ERRNO, "Out of memory");
|
||||
my_message(ER_GET_ERRNO, "Out of memory", MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
thd->query= query;
|
||||
|
@ -1525,7 +1525,6 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
|
|||
/* Drop the table if 'overwrite' is true */
|
||||
if (overwrite && mysql_rm_table(thd,&tables,1,0)) /* drop if exists */
|
||||
{
|
||||
send_error(thd);
|
||||
sql_print_error("create_table_from_dump: failed to drop the table");
|
||||
goto err;
|
||||
}
|
||||
|
@ -1552,7 +1551,6 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
|
|||
tables.lock_type = TL_WRITE;
|
||||
if (!open_ltable(thd, &tables, TL_WRITE))
|
||||
{
|
||||
send_error(thd,0,0); // Send error from open_ltable
|
||||
sql_print_error("create_table_from_dump: could not open created table");
|
||||
goto err;
|
||||
}
|
||||
|
@ -1562,7 +1560,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
|
|||
/* Copy the data file */
|
||||
if (file->net_read_dump(net))
|
||||
{
|
||||
net_printf(thd, ER_MASTER_NET_READ);
|
||||
my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0));
|
||||
sql_print_error("create_table_from_dump: failed in\
|
||||
handler::net_read_dump()");
|
||||
goto err;
|
||||
|
@ -1582,7 +1580,8 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
|
|||
error=file->repair(thd,&check_opt) != 0;
|
||||
thd->net.vio = save_vio;
|
||||
if (error)
|
||||
net_printf(thd, ER_INDEX_REBUILD,tables.table->real_name);
|
||||
my_printf_error(ER_INDEX_REBUILD, ER(ER_INDEX_REBUILD), MYF(0),
|
||||
tables.table->real_name);
|
||||
|
||||
err:
|
||||
close_thread_tables(thd);
|
||||
|
@ -1605,12 +1604,12 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
|
|||
{
|
||||
if (!(mysql = mysql_init(NULL)))
|
||||
{
|
||||
send_error(thd); // EOM
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (connect_to_master(thd, mysql, mi))
|
||||
{
|
||||
net_printf(thd, ER_CONNECT_TO_MASTER, mysql_error(mysql));
|
||||
my_printf_error(ER_CONNECT_TO_MASTER, ER(ER_CONNECT_TO_MASTER), MYF(0),
|
||||
mysql_error(mysql));
|
||||
mysql_close(mysql);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
@ -1634,7 +1633,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
|
|||
if (!called_connected)
|
||||
mysql_close(mysql);
|
||||
if (errmsg && thd->vio_ok())
|
||||
send_error(thd, error, errmsg);
|
||||
my_message(error, errmsg, MYF(0));
|
||||
DBUG_RETURN(test(error)); // Return 1 on error
|
||||
}
|
||||
|
||||
|
@ -2271,7 +2270,7 @@ void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a)
|
|||
}
|
||||
}
|
||||
|
||||
int show_master_info(THD* thd, MASTER_INFO* mi)
|
||||
bool show_master_info(THD* thd, MASTER_INFO* mi)
|
||||
{
|
||||
// TODO: fix this for multi-master
|
||||
List<Item> field_list;
|
||||
|
@ -2335,7 +2334,7 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (mi->host[0])
|
||||
{
|
||||
|
@ -2434,10 +2433,10 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
|
|||
pthread_mutex_unlock(&mi->data_lock);
|
||||
|
||||
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -490,8 +490,8 @@ int fetch_master_table(THD* thd, const char* db_name, const char* table_name,
|
|||
|
||||
void table_rule_ent_hash_to_str(String* s, HASH* h);
|
||||
void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a);
|
||||
int show_master_info(THD* thd, MASTER_INFO* mi);
|
||||
int show_binlog_info(THD* thd);
|
||||
bool show_master_info(THD* thd, MASTER_INFO* mi);
|
||||
bool show_binlog_info(THD* thd);
|
||||
|
||||
/* See if the query uses any tables that should not be replicated */
|
||||
int tables_ok(THD* thd, TABLE_LIST* tables);
|
||||
|
|
|
@ -1001,7 +1001,8 @@ sp_cache_functions(THD *thd, LEX *lex)
|
|||
{
|
||||
delete newlex;
|
||||
thd->lex= oldlex;
|
||||
net_printf(thd, ER_SP_DOES_NOT_EXIST, "FUNCTION", ls->str);
|
||||
my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
|
||||
"FUNCTION", ls->str);
|
||||
ret= 1;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -494,16 +494,17 @@ sp_head::execute(THD *thd)
|
|||
case SP_HANDLER_CONTINUE:
|
||||
ctx->save_variables(hf);
|
||||
ctx->push_hstack(ip);
|
||||
// Fall through
|
||||
// Fall through
|
||||
default:
|
||||
ip= hip;
|
||||
ret= 0;
|
||||
ctx->clear_handler();
|
||||
ctx->in_handler= TRUE;
|
||||
thd->clear_error();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} while (ret == 0 && !thd->killed && !thd->query_error);
|
||||
} while (ret == 0 && !thd->killed);
|
||||
|
||||
cleanup_items(thd->current_arena->free_list);
|
||||
thd->current_arena= old_arena;
|
||||
|
@ -512,7 +513,7 @@ sp_head::execute(THD *thd)
|
|||
DBUG_PRINT("info", ("ret=%d killed=%d query_error=%d",
|
||||
ret, thd->killed, thd->query_error));
|
||||
|
||||
if (thd->killed || thd->query_error)
|
||||
if (thd->killed)
|
||||
ret= -1;
|
||||
/* If the DB has changed, the pointer has changed too, but the
|
||||
original thd->db will then have been freed */
|
||||
|
@ -622,8 +623,8 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
|||
|
||||
if (args->elements != params)
|
||||
{
|
||||
net_printf(thd, ER_SP_WRONG_NO_OF_ARGS, "PROCEDURE", m_name.str,
|
||||
params, args->elements);
|
||||
my_printf_error(ER_SP_WRONG_NO_OF_ARGS, ER(ER_SP_WRONG_NO_OF_ARGS), MYF(0),
|
||||
"PROCEDURE", m_name.str, params, args->elements);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -694,13 +695,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
|||
if (! ret)
|
||||
ret= execute(thd);
|
||||
|
||||
// Don't copy back OUT values if we got an error
|
||||
if (ret)
|
||||
{
|
||||
if (thd->net.report_error)
|
||||
send_error(thd, 0, NullS);
|
||||
}
|
||||
else if (csize > 0)
|
||||
if (!ret && csize > 0)
|
||||
{
|
||||
List_iterator_fast<Item> li(*args);
|
||||
Item *it;
|
||||
|
@ -898,7 +893,8 @@ sp_head::check_backpatch(THD *thd)
|
|||
{
|
||||
if (bp->lab->type == SP_LAB_REF)
|
||||
{
|
||||
net_printf(thd, ER_SP_LILABEL_MISMATCH, "GOTO", bp->lab->name);
|
||||
my_printf_error(ER_SP_LILABEL_MISMATCH, ER(ER_SP_LILABEL_MISMATCH),
|
||||
MYF(0), "GOTO", bp->lab->name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1791,7 +1787,7 @@ sp_instr_error::execute(THD *thd, uint *nextp)
|
|||
{
|
||||
DBUG_ENTER("sp_instr_error::execute");
|
||||
|
||||
my_error(m_errcode, MYF(0));
|
||||
my_message(m_errcode, ER(m_errcode), MYF(0));
|
||||
*nextp= m_ip+1;
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
|
|
@ -153,7 +153,8 @@ sp_cursor::pre_open(THD *thd)
|
|||
{
|
||||
if (m_isopen)
|
||||
{
|
||||
send_error(thd, ER_SP_CURSOR_ALREADY_OPEN);
|
||||
my_message(ER_SP_CURSOR_ALREADY_OPEN, ER(ER_SP_CURSOR_ALREADY_OPEN),
|
||||
MYF(0));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -187,7 +188,7 @@ sp_cursor::close(THD *thd)
|
|||
{
|
||||
if (! m_isopen)
|
||||
{
|
||||
send_error(thd, ER_SP_CURSOR_NOT_OPEN);
|
||||
my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0));
|
||||
return -1;
|
||||
}
|
||||
destroy();
|
||||
|
@ -217,12 +218,12 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
|
|||
|
||||
if (! m_isopen)
|
||||
{
|
||||
send_error(thd, ER_SP_CURSOR_NOT_OPEN);
|
||||
my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0));
|
||||
return -1;
|
||||
}
|
||||
if (m_current_row == NULL)
|
||||
{
|
||||
send_error(thd, ER_SP_FETCH_NO_DATA);
|
||||
my_message(ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA), MYF(0));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -234,7 +235,8 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
|
|||
|
||||
if (fldcount >= m_prot->get_field_count())
|
||||
{
|
||||
send_error(thd, ER_SP_WRONG_NO_OF_FETCH_ARGS);
|
||||
my_message(ER_SP_WRONG_NO_OF_FETCH_ARGS,
|
||||
ER(ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0));
|
||||
return -1;
|
||||
}
|
||||
s= row[fldcount];
|
||||
|
@ -260,7 +262,8 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
|
|||
}
|
||||
if (fldcount < m_prot->get_field_count())
|
||||
{
|
||||
send_error(thd, ER_SP_WRONG_NO_OF_FETCH_ARGS);
|
||||
my_message(ER_SP_WRONG_NO_OF_FETCH_ARGS,
|
||||
ER(ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0));
|
||||
return -1;
|
||||
}
|
||||
m_current_row= m_current_row->next;
|
||||
|
|
157
sql/sql_acl.cc
157
sql/sql_acl.cc
|
@ -1225,8 +1225,7 @@ bool check_change_password(THD *thd, const char *host, const char *user,
|
|||
{
|
||||
if (!initialized)
|
||||
{
|
||||
net_printf(thd,ER_OPTION_PREVENTS_STATEMENT,
|
||||
"--skip-grant-tables");
|
||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
|
||||
return(1);
|
||||
}
|
||||
if (!thd->slave_thread &&
|
||||
|
@ -1238,16 +1237,15 @@ bool check_change_password(THD *thd, const char *host, const char *user,
|
|||
}
|
||||
if (!thd->slave_thread && !thd->user[0])
|
||||
{
|
||||
send_error(thd, ER_PASSWORD_ANONYMOUS_USER);
|
||||
my_message(ER_PASSWORD_ANONYMOUS_USER, ER(ER_PASSWORD_ANONYMOUS_USER),
|
||||
MYF(0));
|
||||
return(1);
|
||||
}
|
||||
uint len=strlen(new_password);
|
||||
if (len && len != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
|
||||
len != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
|
||||
{
|
||||
net_printf(thd, 0,
|
||||
"Password hash should be a %d-digit hexadecimal number",
|
||||
SCRAMBLED_PASSWORD_CHAR_LENGTH);
|
||||
my_error(ER_PASSWD_LENGTH, MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
|
@ -1285,7 +1283,7 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
if (!(acl_user= find_acl_user(host, user)))
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
send_error(thd, ER_PASSWORD_NO_MATCH);
|
||||
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
/* update loaded acl entry: */
|
||||
|
@ -1298,7 +1296,6 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
new_password, new_password_len))
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
|
||||
send_error(thd,0); /* purecov: deadcode */
|
||||
DBUG_RETURN(1); /* purecov: deadcode */
|
||||
}
|
||||
|
||||
|
@ -1471,7 +1468,8 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
|
|||
(byte*) table->field[0]->ptr,0,
|
||||
HA_READ_KEY_EXACT))
|
||||
{
|
||||
my_error(ER_PASSWORD_NO_MATCH,MYF(0)); /* purecov: deadcode */
|
||||
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
|
||||
MYF(0)); /* purecov: deadcode */
|
||||
DBUG_RETURN(1); /* purecov: deadcode */
|
||||
}
|
||||
store_record(table,record[1]);
|
||||
|
@ -1554,7 +1552,8 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
|||
/* what == 'N' means revoke */
|
||||
if (what == 'N')
|
||||
{
|
||||
my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
|
||||
my_printf_error(ER_NONEXISTING_GRANT, ER(ER_NONEXISTING_GRAN), MYF(0),
|
||||
combo.user.str, combo.host.str);
|
||||
goto end;
|
||||
}
|
||||
/*
|
||||
|
@ -1571,8 +1570,9 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
|||
else if (((thd->variables.sql_mode & MODE_NO_AUTO_CREATE_USER) &&
|
||||
!password_len) || !create_user)
|
||||
{
|
||||
my_error(ER_NO_PERMISSION_TO_CREATE_USER, MYF(0),
|
||||
thd->user, thd->host_or_ip);
|
||||
my_printf_error(ER_NO_PERMISSION_TO_CREATE_USER,
|
||||
ER(ER_NO_PERMISSION_TO_CREATE_USER), MYF(0),
|
||||
thd->user, thd->host_or_ip);
|
||||
goto end;
|
||||
}
|
||||
old_row_exists = 0;
|
||||
|
@ -1748,7 +1748,7 @@ static int replace_db_table(TABLE *table, const char *db,
|
|||
/* Check if there is such a user in user table in memory? */
|
||||
if (!find_acl_user(combo.host.str,combo.user.str))
|
||||
{
|
||||
my_error(ER_PASSWORD_NO_MATCH,MYF(0));
|
||||
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -1760,7 +1760,8 @@ static int replace_db_table(TABLE *table, const char *db,
|
|||
{
|
||||
if (what == 'N')
|
||||
{ // no row, no revoke
|
||||
my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
|
||||
my_printf_error(ER_NONEXISTING_GRANT, ER(ER_NONEXISTING_GRANT), MYF(0),
|
||||
combo.user.str, combo.host.str);
|
||||
goto abort;
|
||||
}
|
||||
old_row_exists = 0;
|
||||
|
@ -2067,8 +2068,10 @@ static int replace_column_table(GRANT_TABLE *g_t,
|
|||
{
|
||||
if (revoke_grant)
|
||||
{
|
||||
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
|
||||
combo.user.str, combo.host.str, table_name); /* purecov: inspected */
|
||||
my_printf_error(ER_NONEXISTING_TABLE_GRANT,
|
||||
ER(ER_NONEXISTING_TABLE_GRANT), MYF(0),
|
||||
combo.user.str, combo.host.str,
|
||||
table_name); /* purecov: inspected */
|
||||
result= -1; /* purecov: inspected */
|
||||
continue; /* purecov: inspected */
|
||||
}
|
||||
|
@ -2211,7 +2214,8 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
|
|||
*/
|
||||
if (!find_acl_user(combo.host.str,combo.user.str))
|
||||
{
|
||||
my_error(ER_PASSWORD_NO_MATCH,MYF(0)); /* purecov: deadcode */
|
||||
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
|
||||
MYF(0)); /* purecov: deadcode */
|
||||
DBUG_RETURN(-1); /* purecov: deadcode */
|
||||
}
|
||||
|
||||
|
@ -2233,9 +2237,10 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
|
|||
*/
|
||||
if (revoke_grant)
|
||||
{ // no row, no revoke
|
||||
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
|
||||
combo.user.str, combo.host.str,
|
||||
table_name); /* purecov: deadcode */
|
||||
my_printf_error(ER_NONEXISTING_TABLE_GRANT,
|
||||
ER(ER_NONEXISTING_TABLE_GRANT), MYF(0),
|
||||
combo.user.str, combo.host.str,
|
||||
table_name); /* purecov: deadcode */
|
||||
DBUG_RETURN(-1); /* purecov: deadcode */
|
||||
}
|
||||
old_row_exists = 0;
|
||||
|
@ -2317,11 +2322,11 @@ table_error:
|
|||
revoke_grant Set to 1 if this is a REVOKE command
|
||||
|
||||
RETURN
|
||||
0 ok
|
||||
1 error
|
||||
FALSE ok
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
List <LEX_USER> &user_list,
|
||||
List <LEX_COLUMN> &columns, ulong rights,
|
||||
bool revoke_grant)
|
||||
|
@ -2338,12 +2343,13 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
{
|
||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
|
||||
"--skip-grant-tables"); /* purecov: inspected */
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
}
|
||||
if (rights & ~TABLE_ACLS)
|
||||
{
|
||||
my_error(ER_ILLEGAL_GRANT_FOR_TABLE,MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
my_message(ER_ILLEGAL_GRANT_FOR_TABLE, ER(ER_ILLEGAL_GRANT_FOR_TABLE),
|
||||
MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if (columns.elements && !revoke_grant)
|
||||
|
@ -2352,8 +2358,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
List_iterator <LEX_COLUMN> column_iter(columns);
|
||||
int res;
|
||||
|
||||
if ((res= open_and_lock_tables(thd, table_list)))
|
||||
DBUG_RETURN(res);
|
||||
if (open_and_lock_tables(thd, table_list))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
while ((column = column_iter++))
|
||||
{
|
||||
|
@ -2363,9 +2369,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
column->column.length(), 0, 0, 0, 0,
|
||||
&unused_field_idx))
|
||||
{
|
||||
my_error(ER_BAD_FIELD_ERROR, MYF(0),
|
||||
column->column.c_ptr(), table_list->alias);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
|
||||
column->column.c_ptr(), table_list->alias);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
column_priv|= column->rights;
|
||||
}
|
||||
|
@ -2379,8 +2385,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
fn_format(buf,buf,"","",4+16+32);
|
||||
if (access(buf,F_OK))
|
||||
{
|
||||
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->alias);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
|
||||
table_list->db, table_list->alias);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2413,19 +2420,19 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
*/
|
||||
tables[0].updating= tables[1].updating= tables[2].updating= 1;
|
||||
if (!tables_ok(0, tables))
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (simple_open_n_lock_tables(thd,tables))
|
||||
{ // Should never happen
|
||||
close_thread_tables(thd); /* purecov: deadcode */
|
||||
DBUG_RETURN(-1); /* purecov: deadcode */
|
||||
DBUG_RETURN(TRUE); /* purecov: deadcode */
|
||||
}
|
||||
|
||||
if (!revoke_grant)
|
||||
create_new_users= test_if_create_new_users(thd);
|
||||
int result=0;
|
||||
bool result= FALSE;
|
||||
rw_wrlock(&LOCK_grant);
|
||||
MEM_ROOT *old_root= thd->mem_root;
|
||||
thd->mem_root= &memex;
|
||||
|
@ -2437,8 +2444,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
if (Str->host.length > HOSTNAME_LENGTH ||
|
||||
Str->user.length > USERNAME_LENGTH)
|
||||
{
|
||||
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
|
||||
result= -1;
|
||||
my_message(ER_GRANT_WRONG_HOST_OR_USER, ER(ER_GRANT_WRONG_HOST_OR_USER),
|
||||
MYF(0));
|
||||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
/* Create user if needed */
|
||||
|
@ -2448,7 +2456,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
pthread_mutex_unlock(&acl_cache->lock);
|
||||
if (error)
|
||||
{
|
||||
result= -1; // Remember error
|
||||
result= TRUE; // Remember error
|
||||
continue; // Add next user
|
||||
}
|
||||
|
||||
|
@ -2466,9 +2474,10 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
{
|
||||
if (revoke_grant)
|
||||
{
|
||||
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
|
||||
Str->user.str, Str->host.str, table_list->real_name);
|
||||
result= -1;
|
||||
my_printf_error(ER_NONEXISTING_TABLE_GRANT,
|
||||
ER(ER_NONEXISTING_TABLE_GRANT), MYF(0),
|
||||
Str->user.str, Str->host.str, table_list->real_name);
|
||||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
grant_table = new GRANT_TABLE (Str->host.str, db_name,
|
||||
|
@ -2477,7 +2486,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
column_priv);
|
||||
if (!grant_table) // end of memory
|
||||
{
|
||||
result= -1; /* purecov: deadcode */
|
||||
result= TRUE; /* purecov: deadcode */
|
||||
continue; /* purecov: deadcode */
|
||||
}
|
||||
my_hash_insert(&column_priv_hash,(byte*) grant_table);
|
||||
|
@ -2522,7 +2531,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
rights, column_priv, revoke_grant))
|
||||
{
|
||||
/* Should only happen if table is crashed */
|
||||
result= -1; /* purecov: deadcode */
|
||||
result= TRUE; /* purecov: deadcode */
|
||||
}
|
||||
else if (tables[2].table)
|
||||
{
|
||||
|
@ -2531,7 +2540,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
db_name, real_name,
|
||||
rights, revoke_grant)))
|
||||
{
|
||||
result= -1;
|
||||
result= TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2545,8 +2554,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
}
|
||||
|
||||
|
||||
int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
ulong rights, bool revoke_grant)
|
||||
bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
ulong rights, bool revoke_grant)
|
||||
{
|
||||
List_iterator <LEX_USER> str_list (list);
|
||||
LEX_USER *Str;
|
||||
|
@ -2558,7 +2567,7 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
|||
{
|
||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
|
||||
"--skip-grant-tables"); /* purecov: tested */
|
||||
DBUG_RETURN(-1); /* purecov: tested */
|
||||
DBUG_RETURN(TRUE); /* purecov: tested */
|
||||
}
|
||||
|
||||
if (lower_case_table_names && db)
|
||||
|
@ -2589,14 +2598,14 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
|||
*/
|
||||
tables[0].updating= tables[1].updating= 1;
|
||||
if (!tables_ok(0, tables))
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (simple_open_n_lock_tables(thd,tables))
|
||||
{ // This should never happen
|
||||
close_thread_tables(thd); /* purecov: deadcode */
|
||||
DBUG_RETURN(-1); /* purecov: deadcode */
|
||||
DBUG_RETURN(TRUE); /* purecov: deadcode */
|
||||
}
|
||||
|
||||
if (!revoke_grant)
|
||||
|
@ -2613,7 +2622,8 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
|||
if (Str->host.length > HOSTNAME_LENGTH ||
|
||||
Str->user.length > USERNAME_LENGTH)
|
||||
{
|
||||
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
|
||||
my_message(ER_GRANT_WRONG_HOST_OR_USER, ER(ER_GRANT_WRONG_HOST_OR_USER),
|
||||
MYF(0));
|
||||
result= -1;
|
||||
continue;
|
||||
}
|
||||
|
@ -2910,11 +2920,12 @@ err:
|
|||
command= "create view";
|
||||
else if (want_access & SHOW_VIEW_ACL)
|
||||
command= "show create view";
|
||||
net_printf(thd,ER_TABLEACCESS_DENIED_ERROR,
|
||||
command,
|
||||
thd->priv_user,
|
||||
thd->host_or_ip,
|
||||
table ? table->real_name : "unknown");
|
||||
my_printf_error(ER_TABLEACCESS_DENIED_ERROR,
|
||||
ER(ER_TABLEACCESS_DENIED_ERROR), MYF(0),
|
||||
command,
|
||||
thd->priv_user,
|
||||
thd->host_or_ip,
|
||||
table ? table->real_name : "unknown");
|
||||
}
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
@ -3176,7 +3187,7 @@ static uint command_lengths[]=
|
|||
Send to client grant-like strings depicting user@host privileges
|
||||
*/
|
||||
|
||||
int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
{
|
||||
ulong want_access;
|
||||
uint counter,index;
|
||||
|
@ -3191,7 +3202,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
|||
if (!initialized)
|
||||
{
|
||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if (!lex_user->host.str)
|
||||
|
@ -3202,8 +3213,9 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
|||
if (lex_user->host.length > HOSTNAME_LENGTH ||
|
||||
lex_user->user.length > USERNAME_LENGTH)
|
||||
{
|
||||
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
my_message(ER_GRANT_WRONG_HOST_OR_USER, ER(ER_GRANT_WRONG_HOST_OR_USER),
|
||||
MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
for (counter=0 ; counter < acl_users.elements ; counter++)
|
||||
|
@ -3220,9 +3232,10 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
|||
}
|
||||
if (counter == acl_users.elements)
|
||||
{
|
||||
my_error(ER_NONEXISTING_GRANT, MYF(0),
|
||||
lex_user->user.str, lex_user->host.str);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_NONEXISTING_GRANT,
|
||||
ER(ER_NONEXISTING_GRANT), MYF(0),
|
||||
lex_user->user.str, lex_user->host.str);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
Item_string *field=new Item_string("",0,&my_charset_latin1);
|
||||
|
@ -3234,7 +3247,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
|||
field_list.push_back(field);
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
rw_wrlock(&LOCK_grant);
|
||||
VOID(pthread_mutex_lock(&acl_cache->lock));
|
||||
|
@ -3556,7 +3569,7 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
|
|||
|
||||
if (!initialized)
|
||||
{
|
||||
net_printf(thd,ER_OPTION_PREVENTS_STATEMENT, "--skip-grant-tables");
|
||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -3625,7 +3638,7 @@ ACL_USER *check_acl_user(LEX_USER *user_name,
|
|||
}
|
||||
|
||||
|
||||
int mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
||||
bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
||||
{
|
||||
uint counter, acl_userd;
|
||||
int result;
|
||||
|
@ -3636,7 +3649,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
|||
DBUG_ENTER("mysql_drop_user");
|
||||
|
||||
if ((result= open_grant_tables(thd, tables)))
|
||||
DBUG_RETURN(result == 1 ? 0 : 1);
|
||||
DBUG_RETURN(result != 1);
|
||||
|
||||
rw_wrlock(&LOCK_grant);
|
||||
VOID(pthread_mutex_lock(&acl_cache->lock));
|
||||
|
@ -3724,7 +3737,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
|||
record[0])))
|
||||
{
|
||||
tables[0].table->file->print_error(error, MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
delete_dynamic_element(&acl_users, acl_userd);
|
||||
}
|
||||
|
@ -3734,11 +3747,11 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
|||
rw_unlock(&LOCK_grant);
|
||||
close_thread_tables(thd);
|
||||
if (result)
|
||||
my_error(ER_DROP_USER, MYF(0));
|
||||
my_message(ER_DROP_USER, ER(ER_DROP_USER), MYF(0));
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
{
|
||||
uint counter, revoked;
|
||||
int result;
|
||||
|
@ -3747,7 +3760,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
|||
DBUG_ENTER("mysql_revoke_all");
|
||||
|
||||
if ((result= open_grant_tables(thd, tables)))
|
||||
DBUG_RETURN(result == 1 ? 0 : 1);
|
||||
DBUG_RETURN(result != 1);
|
||||
|
||||
rw_wrlock(&LOCK_grant);
|
||||
VOID(pthread_mutex_lock(&acl_cache->lock));
|
||||
|
@ -3861,7 +3874,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
|||
close_thread_tables(thd);
|
||||
|
||||
if (result)
|
||||
my_error(ER_REVOKE_GRANTS, MYF(0));
|
||||
my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
|
||||
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
|
|
@ -158,11 +158,11 @@ bool check_change_password(THD *thd, const char *host, const char *user,
|
|||
char *password);
|
||||
bool change_password(THD *thd, const char *host, const char *user,
|
||||
char *password);
|
||||
int mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
|
||||
ulong rights, bool revoke);
|
||||
int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
|
||||
List <LEX_COLUMN> &column_list, ulong rights,
|
||||
bool revoke);
|
||||
bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
|
||||
ulong rights, bool revoke);
|
||||
bool mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
|
||||
List <LEX_COLUMN> &column_list, ulong rights,
|
||||
bool revoke);
|
||||
my_bool grant_init(THD *thd);
|
||||
void grant_free(void);
|
||||
void grant_reload(THD *thd);
|
||||
|
@ -179,11 +179,11 @@ ulong get_table_grant(THD *thd, TABLE_LIST *table);
|
|||
ulong get_column_grant(THD *thd, GRANT_INFO *grant,
|
||||
const char *db_name, const char *table_name,
|
||||
const char *field_name);
|
||||
int mysql_show_grants(THD *thd, LEX_USER *user);
|
||||
bool mysql_show_grants(THD *thd, LEX_USER *user);
|
||||
void get_privilege_desc(char *to, uint max_length, ulong access);
|
||||
void get_mqh(const char *user, const char *host, USER_CONN *uc);
|
||||
int mysql_drop_user(THD *thd, List <LEX_USER> &list);
|
||||
int mysql_revoke_all(THD *thd, List <LEX_USER> &list);
|
||||
bool mysql_drop_user(THD *thd, List <LEX_USER> &list);
|
||||
bool mysql_revoke_all(THD *thd, List <LEX_USER> &list);
|
||||
void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
|
||||
const char *db, const char *table);
|
||||
|
||||
|
|
|
@ -81,14 +81,18 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||
(*param->item)->val_real() < 0)
|
||||
{
|
||||
delete pc;
|
||||
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
|
||||
my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE,
|
||||
ER(ER_WRONG_PARAMETERS_TO_PROCEDURE), MYF(0),
|
||||
proc_name);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
pc->max_tree_elements = (uint) (*param->item)->val_int();
|
||||
param = param->next;
|
||||
if (param->next) // no third parameter possible
|
||||
{
|
||||
my_error(ER_WRONG_PARAMCOUNT_TO_PROCEDURE, MYF(0), proc_name);
|
||||
my_printf_error(ER_WRONG_PARAMCOUNT_TO_PROCEDURE,
|
||||
ER(ER_WRONG_PARAMCOUNT_TO_PROCEDURE), MYF(0),
|
||||
proc_name);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
// second parameter
|
||||
|
@ -96,7 +100,9 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||
(*param->item)->val_real() < 0)
|
||||
{
|
||||
delete pc;
|
||||
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
|
||||
my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE,
|
||||
ER(ER_WRONG_PARAMETERS_TO_PROCEDURE), MYF(0),
|
||||
proc_name);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
pc->max_treemem = (uint) (*param->item)->val_int();
|
||||
|
@ -105,7 +111,8 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||
(*param->item)->val_real() < 0)
|
||||
{
|
||||
delete pc;
|
||||
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
|
||||
my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE,
|
||||
ER(ER_WRONG_PARAMETERS_TO_PROCEDURE), MYF(0), proc_name);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
// if only one parameter was given, it will be the value of max_tree_elements
|
||||
|
|
|
@ -1262,7 +1262,8 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
|
|||
next=table->next;
|
||||
if (!tables || (!db_stat && reopen_table(table,1)))
|
||||
{
|
||||
my_error(ER_CANT_REOPEN_TABLE,MYF(0),table->table_name);
|
||||
my_printf_error(ER_CANT_REOPEN_TABLE, ER(ER_CANT_REOPEN_TABLE),
|
||||
MYF(0),table->table_name);
|
||||
VOID(hash_delete(&open_cache,(byte*) table));
|
||||
error=1;
|
||||
}
|
||||
|
@ -1547,7 +1548,8 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
|
|||
{
|
||||
/* Give right error message */
|
||||
thd->clear_error();
|
||||
my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno);
|
||||
my_printf_error(ER_NOT_KEYFILE, ER(ER_NOT_KEYFILE), MYF(0),
|
||||
name, my_errno);
|
||||
sql_print_error("Couldn't repair table: %s.%s",db,name);
|
||||
if (entry->file)
|
||||
closefrm(entry);
|
||||
|
@ -1612,7 +1614,8 @@ err:
|
|||
{
|
||||
TABLE_LIST * view= table_desc->belong_to_view;
|
||||
thd->clear_error();
|
||||
my_error(ER_VIEW_INVALID, MYF(0), view->view_db.str, view->view_name.str);
|
||||
my_printf_error(ER_VIEW_INVALID, ER(ER_VIEW_INVALID), MYF(0),
|
||||
view->view_db.str, view->view_name.str);
|
||||
}
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
@ -1853,15 +1856,14 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables)
|
|||
tables - list of tables for open&locking
|
||||
|
||||
RETURN
|
||||
0 - ok
|
||||
-1 - error
|
||||
1 - error reported to user
|
||||
FALSE - ok
|
||||
TRUE - error
|
||||
|
||||
NOTE
|
||||
The lock will automaticly be freed by close_thread_tables()
|
||||
*/
|
||||
|
||||
int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
|
||||
bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
|
||||
{
|
||||
DBUG_ENTER("open_and_lock_tables");
|
||||
uint counter;
|
||||
|
@ -1870,7 +1872,7 @@ int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
|
|||
mysql_handle_derived(thd->lex, &mysql_derived_prepare) ||
|
||||
(thd->fill_derived_tables() &&
|
||||
mysql_handle_derived(thd->lex, &mysql_derived_filling)))
|
||||
DBUG_RETURN(thd->net.report_error ? -1 : 1); /* purecov: inspected */
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
relink_tables_for_multidelete(thd);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -2692,9 +2694,9 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
|
|||
** Check that all given fields exists and fill struct with current data
|
||||
****************************************************************************/
|
||||
|
||||
int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
|
||||
List<Item> &fields, bool set_query_id,
|
||||
List<Item> *sum_func_list, bool allow_sum_func)
|
||||
bool setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
|
||||
List<Item> &fields, bool set_query_id,
|
||||
List<Item> *sum_func_list, bool allow_sum_func)
|
||||
{
|
||||
reg2 Item *item;
|
||||
List_iterator<Item> it(fields);
|
||||
|
@ -2712,7 +2714,7 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
|
|||
(item= *(it.ref()))->check_cols(1))
|
||||
{
|
||||
select_lex->no_wrap_view_item= 0;
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
}
|
||||
if (ref)
|
||||
*(ref++)= item;
|
||||
|
@ -2820,8 +2822,9 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table,
|
|||
(pos= find_type(&table->keynames, name->ptr(), name->length(), 1)) <=
|
||||
0)
|
||||
{
|
||||
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr(),
|
||||
table->real_name);
|
||||
my_printf_error(ER_KEY_COLUMN_DOES_NOT_EXITS,
|
||||
ER(ER_KEY_COLUMN_DOES_NOT_EXITS), MYF(0),
|
||||
name->c_ptr(), table->real_name);
|
||||
map->set_all();
|
||||
return 1;
|
||||
}
|
||||
|
@ -3037,9 +3040,10 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
|
|||
DBUG_RETURN(0);
|
||||
|
||||
if (!table_name)
|
||||
my_error(ER_NO_TABLES_USED, MYF(0));
|
||||
my_message(ER_NO_TABLES_USED, ER(ER_NO_TABLES_USED), MYF(0));
|
||||
else
|
||||
my_error(ER_BAD_TABLE_ERROR, MYF(0), table_name);
|
||||
my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
|
||||
table_name);
|
||||
|
||||
err:
|
||||
DBUG_RETURN(1);
|
||||
|
@ -3261,8 +3265,25 @@ err_no_arena:
|
|||
** Returns : 1 if some field has wrong type
|
||||
******************************************************************************/
|
||||
|
||||
int
|
||||
fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors)
|
||||
|
||||
/*
|
||||
Fill fields with given items.
|
||||
|
||||
SYNOPSIS
|
||||
fill_record()
|
||||
thd thread handler
|
||||
fields Item_fields list to be filled
|
||||
values values to fill with
|
||||
ignore_errors TRUE if we should ignore errors
|
||||
|
||||
RETURN
|
||||
FALSE OK
|
||||
TRUE error occured
|
||||
*/
|
||||
|
||||
bool
|
||||
fill_record(THD * thd, List<Item> &fields, List<Item> &values,
|
||||
bool ignore_errors)
|
||||
{
|
||||
List_iterator_fast<Item> f(fields),v(values);
|
||||
Item *value;
|
||||
|
@ -3277,14 +3298,32 @@ fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors)
|
|||
if (rfield == table->next_number_field)
|
||||
table->auto_increment_field_not_null= TRUE;
|
||||
if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors)
|
||||
DBUG_RETURN(1);
|
||||
{
|
||||
my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(thd->net.report_error);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fill_record(Field **ptr,List<Item> &values, bool ignore_errors)
|
||||
/*
|
||||
Fill field buffer with values from Field list
|
||||
|
||||
SYNOPSIS
|
||||
fill_record()
|
||||
thd thread handler
|
||||
ptr pointer on pointer to record
|
||||
values list of fields
|
||||
ignore_errors TRUE if we should ignore errors
|
||||
|
||||
RETURN
|
||||
FALSE OK
|
||||
TRUE error occured
|
||||
*/
|
||||
|
||||
bool
|
||||
fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
|
||||
{
|
||||
List_iterator_fast<Item> v(values);
|
||||
Item *value;
|
||||
|
@ -3298,9 +3337,12 @@ fill_record(Field **ptr,List<Item> &values, bool ignore_errors)
|
|||
if (field == table->next_number_field)
|
||||
table->auto_increment_field_not_null= TRUE;
|
||||
if ((value->save_in_field(field, 0) < 0) && !ignore_errors)
|
||||
DBUG_RETURN(1);
|
||||
{
|
||||
my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(thd->net.report_error);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3531,7 +3573,8 @@ open_new_frm(const char *path, const char *alias,
|
|||
{
|
||||
if (table_desc == 0 || table_desc->required_type == FRMTYPE_TABLE)
|
||||
{
|
||||
my_error(ER_WRONG_OBJECT, MYF(0), db, table_name, "BASE TABLE");
|
||||
my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
|
||||
db, table_name, "BASE TABLE");
|
||||
goto err;
|
||||
}
|
||||
if (mysql_make_view(parser, table_desc))
|
||||
|
@ -3540,7 +3583,8 @@ open_new_frm(const char *path, const char *alias,
|
|||
else
|
||||
{
|
||||
/* only VIEWs are supported now */
|
||||
my_error(ER_FRM_UNKNOWN_TYPE, MYF(0), path, parser->type()->str);
|
||||
my_printf_error(ER_FRM_UNKNOWN_TYPE, ER(ER_FRM_UNKNOWN_TYPE), MYF(0),
|
||||
path, parser->type()->str);
|
||||
goto err;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
|
|
@ -701,8 +701,8 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
|
|||
key_length + 1);
|
||||
if (!new_table)
|
||||
{
|
||||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL),
|
||||
ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1);
|
||||
my_printf_error(EE_OUTOFMEMORY, ER(EE_OUTOFMEMORY), MYF(ME_BELL),
|
||||
ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1);
|
||||
killed= KILL_CONNECTION;
|
||||
return 0;
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ select_result::select_result()
|
|||
|
||||
void select_result::send_error(uint errcode,const char *err)
|
||||
{
|
||||
::send_error(thd, errcode, err);
|
||||
my_message(errcode, err, MYF(0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -925,7 +925,7 @@ bool select_send::send_eof()
|
|||
|
||||
void select_to_file::send_error(uint errcode,const char *err)
|
||||
{
|
||||
::send_error(thd,errcode,err);
|
||||
my_message(errcode, err, MYF(0));
|
||||
if (file > 0)
|
||||
{
|
||||
(void) end_io_cache(&cache);
|
||||
|
@ -1018,7 +1018,8 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
|
|||
|
||||
if (!access(path, F_OK))
|
||||
{
|
||||
my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
|
||||
my_printf_error(ER_FILE_EXISTS_ERROR, ER(ER_FILE_EXISTS_ERROR), MYF(0),
|
||||
exchange->file_name);
|
||||
return -1;
|
||||
}
|
||||
/* Create the file world readable */
|
||||
|
@ -1249,7 +1250,7 @@ bool select_dump::send_data(List<Item> &items)
|
|||
}
|
||||
if (row_count++ > 1)
|
||||
{
|
||||
my_error(ER_TOO_MANY_ROWS, MYF(0));
|
||||
my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
|
||||
goto err;
|
||||
}
|
||||
while ((item=li++))
|
||||
|
@ -1262,7 +1263,8 @@ bool select_dump::send_data(List<Item> &items)
|
|||
}
|
||||
else if (my_b_write(&cache,(byte*) res->ptr(),res->length()))
|
||||
{
|
||||
my_error(ER_ERROR_ON_WRITE,MYF(0), path, my_errno);
|
||||
my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0),
|
||||
path, my_errno);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -1421,7 +1423,8 @@ int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
|
|||
|
||||
if (var_list.elements != list.elements)
|
||||
{
|
||||
my_error(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT, MYF(0));
|
||||
my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
|
||||
ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
|
||||
return 1;
|
||||
}
|
||||
while ((item=li++))
|
||||
|
@ -1722,7 +1725,7 @@ bool select_dumpvar::send_data(List<Item> &items)
|
|||
}
|
||||
if (row_count++)
|
||||
{
|
||||
my_error(ER_TOO_MANY_ROWS, MYF(0));
|
||||
my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
while ((zz=my_li++) && (item=it++))
|
||||
|
|
|
@ -41,6 +41,7 @@ enum enum_check_fields { CHECK_FIELD_IGNORE, CHECK_FIELD_WARN,
|
|||
CHECK_FIELD_ERROR_FOR_NULL };
|
||||
|
||||
extern char internal_table_name[2];
|
||||
extern const char **errmesg;
|
||||
|
||||
/* log info errors */
|
||||
#define LOG_INFO_EOF -1
|
||||
|
@ -1157,6 +1158,7 @@ public:
|
|||
net.last_error[0]= 0;
|
||||
net.last_errno= 0;
|
||||
net.report_error= 0;
|
||||
query_error= 0;
|
||||
}
|
||||
inline bool vio_ok() const { return net.vio != 0; }
|
||||
#else
|
||||
|
@ -1209,7 +1211,8 @@ public:
|
|||
}
|
||||
inline void send_kill_message() const
|
||||
{
|
||||
my_error(killed_errno(), MYF(0));
|
||||
int err= killed_errno();
|
||||
my_message(err, ER(err), MYF(0));
|
||||
}
|
||||
/* return TRUE if we will abort query if we make a warning now */
|
||||
inline bool really_abort_on_warning()
|
||||
|
@ -1251,8 +1254,6 @@ public:
|
|||
|
||||
class JOIN;
|
||||
|
||||
void send_error(THD *thd, uint sql_errno=0, const char *err=0);
|
||||
|
||||
class select_result :public Sql_alloc {
|
||||
protected:
|
||||
THD *thd;
|
||||
|
|
|
@ -374,13 +374,13 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
|
|||
In this case the entry should not be logged.
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
-1 Error
|
||||
FALSE ok
|
||||
TRUE Error
|
||||
|
||||
*/
|
||||
|
||||
int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
|
||||
bool silent)
|
||||
bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
|
||||
bool silent)
|
||||
{
|
||||
char path[FN_REFLEN+16];
|
||||
long result= 1;
|
||||
|
@ -408,7 +408,8 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
|
|||
{
|
||||
if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS))
|
||||
{
|
||||
my_error(ER_DB_CREATE_EXISTS,MYF(0),db);
|
||||
my_printf_error(ER_DB_CREATE_EXISTS, ER(ER_DB_CREATE_EXISTS), MYF(0),
|
||||
db);
|
||||
error= -1;
|
||||
goto exit;
|
||||
}
|
||||
|
@ -418,12 +419,13 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
|
|||
{
|
||||
if (my_errno != ENOENT)
|
||||
{
|
||||
my_error(EE_STAT, MYF(0),path,my_errno);
|
||||
my_printf_error(EE_STAT, ER(EE_STAT), MYF(0), path, my_errno);
|
||||
goto exit;
|
||||
}
|
||||
if (my_mkdir(path,0777,MYF(0)) < 0)
|
||||
{
|
||||
my_error(ER_CANT_CREATE_DB,MYF(0),db,my_errno);
|
||||
my_printf_error(ER_CANT_CREATE_DB, ER(ER_CANT_CREATE_DB),
|
||||
MYF(0), db, my_errno);
|
||||
error= -1;
|
||||
goto exit;
|
||||
}
|
||||
|
@ -484,7 +486,7 @@ exit2:
|
|||
|
||||
/* db-name is already validated when we come here */
|
||||
|
||||
int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
|
||||
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
|
||||
{
|
||||
char path[FN_REFLEN+16];
|
||||
long result=1;
|
||||
|
@ -527,7 +529,7 @@ exit:
|
|||
start_waiting_global_read_lock(thd);
|
||||
exit2:
|
||||
VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
|
||||
DBUG_RETURN(error ? -1 : 0); /* -1 to delegate send_error() */
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
||||
|
@ -543,11 +545,11 @@ exit2:
|
|||
silent Don't generate errors
|
||||
|
||||
RETURN
|
||||
0 ok (Database dropped)
|
||||
-1 Error generated
|
||||
FALSE ok (Database dropped)
|
||||
ERROR Error
|
||||
*/
|
||||
|
||||
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
||||
bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
||||
{
|
||||
long deleted=0;
|
||||
int error= 0;
|
||||
|
@ -577,7 +579,7 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
|||
if (!if_exists)
|
||||
{
|
||||
error= -1;
|
||||
my_error(ER_DB_DROP_EXISTS,MYF(0),db);
|
||||
my_printf_error(ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), MYF(0), db);
|
||||
goto exit;
|
||||
}
|
||||
else
|
||||
|
@ -801,7 +803,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
|
|||
*/
|
||||
if (found_other_files)
|
||||
{
|
||||
my_error(ER_DB_DROP_RMDIR, MYF(0), org_path, EEXIST);
|
||||
my_printf_error(ER_DB_DROP_RMDIR, ER(ER_DB_DROP_RMDIR), MYF(0),
|
||||
org_path, EEXIST);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
else
|
||||
|
@ -864,7 +867,8 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error)
|
|||
*--pos=0;
|
||||
if (rmdir(path) < 0 && send_error)
|
||||
{
|
||||
my_error(ER_DB_DROP_RMDIR, MYF(0), path, errno);
|
||||
my_printf_error(ER_DB_DROP_RMDIR, ER(ER_DB_DROP_RMDIR), MYF(0),
|
||||
path, errno);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
@ -985,12 +989,13 @@ bool mysql_change_db(THD *thd, const char *name)
|
|||
if (!dbname || !(db_length= strlen(dbname)))
|
||||
{
|
||||
x_free(dbname); /* purecov: inspected */
|
||||
send_error(thd,ER_NO_DB_ERROR); /* purecov: inspected */
|
||||
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
|
||||
MYF(0)); /* purecov: inspected */
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
}
|
||||
if (check_db_name(dbname))
|
||||
{
|
||||
net_printf(thd, ER_WRONG_DB_NAME, dbname);
|
||||
my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), dbname);
|
||||
x_free(dbname);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
@ -1003,10 +1008,11 @@ bool mysql_change_db(THD *thd, const char *name)
|
|||
thd->master_access);
|
||||
if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
|
||||
{
|
||||
net_printf(thd,ER_DBACCESS_DENIED_ERROR,
|
||||
thd->priv_user,
|
||||
thd->priv_host,
|
||||
dbname);
|
||||
my_printf_error(ER_DBACCESS_DENIED_ERROR,
|
||||
ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
|
||||
thd->priv_user,
|
||||
thd->priv_host,
|
||||
dbname);
|
||||
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
|
||||
thd->priv_user,
|
||||
thd->priv_host,
|
||||
|
@ -1021,7 +1027,7 @@ bool mysql_change_db(THD *thd, const char *name)
|
|||
path[length-1]=0; // remove ending '\'
|
||||
if (access(path,F_OK))
|
||||
{
|
||||
net_printf(thd,ER_BAD_DB_ERROR,dbname);
|
||||
my_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0), dbname);
|
||||
my_free(dbname,MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#include "sp_head.h"
|
||||
#include "sql_trigger.h"
|
||||
|
||||
int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
|
||||
ha_rows limit, ulong options)
|
||||
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
SQL_LIST *order, ha_rows limit, ulong options)
|
||||
{
|
||||
int error;
|
||||
TABLE *table;
|
||||
|
@ -42,22 +42,23 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
|
|||
SELECT_LEX *select_lex= &thd->lex->select_lex;
|
||||
DBUG_ENTER("mysql_delete");
|
||||
|
||||
if ((error= open_and_lock_tables(thd, table_list)))
|
||||
DBUG_RETURN(error);
|
||||
if (open_and_lock_tables(thd, table_list))
|
||||
DBUG_RETURN(TRUE);
|
||||
table= table_list->table;
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
thd->proc_info="init";
|
||||
table->map=1;
|
||||
|
||||
if ((error= mysql_prepare_delete(thd, table_list, &conds)))
|
||||
DBUG_RETURN(error);
|
||||
if (mysql_prepare_delete(thd, table_list, &conds))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
const_cond= (!conds || conds->const_item());
|
||||
safe_update=test(thd->options & OPTION_SAFE_UPDATES);
|
||||
if (safe_update && const_cond)
|
||||
{
|
||||
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
|
||||
DBUG_RETURN(1);
|
||||
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
|
||||
ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if (thd->lex->duplicates == DUP_IGNORE)
|
||||
|
@ -86,7 +87,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
|
|||
table->quick_keys.clear_all(); // Can't use 'only index'
|
||||
select=make_select(table,0,0,conds,&error);
|
||||
if (error)
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
if ((select && select->check_quick(thd, safe_update, limit)) || !limit)
|
||||
{
|
||||
delete select;
|
||||
|
@ -104,8 +105,9 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
|
|||
{
|
||||
delete select;
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
|
||||
DBUG_RETURN(1);
|
||||
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
|
||||
ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
if (options & OPTION_QUICK)
|
||||
|
@ -136,7 +138,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
|
|||
{
|
||||
delete select;
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
DBUG_RETURN(-1); // This will force out message
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
/*
|
||||
Filesort has already found and selected the rows we want to delete,
|
||||
|
@ -151,7 +153,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
|
|||
{
|
||||
delete select;
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
DBUG_RETURN(-1); // This will force out message
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
init_read_record(&info,thd,table,select,1,1);
|
||||
deleted=0L;
|
||||
|
@ -254,15 +256,13 @@ cleanup:
|
|||
thd->lock=0;
|
||||
}
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
if (error >= 0 || thd->net.report_error)
|
||||
send_error(thd,thd->killed_errno());
|
||||
else
|
||||
if (error < 0)
|
||||
{
|
||||
thd->row_count_func= deleted;
|
||||
send_ok(thd,deleted);
|
||||
DBUG_PRINT("info",("%d records deleted",deleted));
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(error >= 0 || thd->net.report_error);
|
||||
}
|
||||
|
||||
|
||||
|
@ -276,11 +276,10 @@ cleanup:
|
|||
conds - conditions
|
||||
|
||||
RETURN VALUE
|
||||
0 - OK
|
||||
1 - error (message is sent to user)
|
||||
-1 - error (message is not sent to user)
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
|
||||
bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
|
||||
{
|
||||
SELECT_LEX *select_lex= &thd->lex->select_lex;
|
||||
DBUG_ENTER("mysql_prepare_delete");
|
||||
|
@ -288,19 +287,21 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
|
|||
if (setup_tables(thd, table_list, conds) ||
|
||||
setup_conds(thd, table_list, conds) ||
|
||||
setup_ftfuncs(select_lex))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
if (!table_list->updatable || check_key_in_view(thd, table_list))
|
||||
{
|
||||
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE");
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE), MYF(0),
|
||||
table_list->alias, "DELETE");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (unique_table(table_list, table_list->next_global))
|
||||
{
|
||||
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), MYF(0),
|
||||
table_list->real_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
select_lex->fix_prepare_information(thd, conds);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -324,16 +325,15 @@ extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b)
|
|||
thd thread handler
|
||||
|
||||
RETURN
|
||||
0 OK
|
||||
-1 Error
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
int mysql_multi_delete_prepare(THD *thd)
|
||||
bool mysql_multi_delete_prepare(THD *thd)
|
||||
{
|
||||
LEX *lex= thd->lex;
|
||||
TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxilliary_table_list.first;
|
||||
TABLE_LIST *target_tbl;
|
||||
int res= 0;
|
||||
DBUG_ENTER("mysql_multi_delete_prepare");
|
||||
|
||||
/*
|
||||
|
@ -343,7 +343,7 @@ int mysql_multi_delete_prepare(THD *thd)
|
|||
lex->query_tables also point on local list of DELETE SELECT_LEX
|
||||
*/
|
||||
if (setup_tables(thd, lex->query_tables, &lex->select_lex.where))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/* Fix tables-to-be-deleted-from list to point at opened tables */
|
||||
for (target_tbl= (TABLE_LIST*) aux_tables;
|
||||
|
@ -354,9 +354,9 @@ int mysql_multi_delete_prepare(THD *thd)
|
|||
if (!target_tbl->correspondent_table->updatable ||
|
||||
check_key_in_view(thd, target_tbl->correspondent_table))
|
||||
{
|
||||
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), target_tbl->real_name,
|
||||
"DELETE");
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
|
||||
MYF(0), target_tbl->real_name, "DELETE");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
/*
|
||||
Check are deleted table used somewhere inside subqueries.
|
||||
|
@ -372,14 +372,13 @@ int mysql_multi_delete_prepare(THD *thd)
|
|||
un->check_updateable(target_tbl->correspondent_table->db,
|
||||
target_tbl->correspondent_table->real_name))
|
||||
{
|
||||
my_error(ER_UPDATE_TABLE_USED, MYF(0),
|
||||
target_tbl->correspondent_table->real_name);
|
||||
res= -1;
|
||||
break;
|
||||
my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
|
||||
MYF(0), target_tbl->correspondent_table->real_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(res);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -525,7 +524,7 @@ void multi_delete::send_error(uint errcode,const char *err)
|
|||
DBUG_ENTER("multi_delete::send_error");
|
||||
|
||||
/* First send error what ever it is ... */
|
||||
::send_error(thd,errcode,err);
|
||||
my_message(errcode, err, MYF(0));
|
||||
|
||||
/* If nothing deleted return */
|
||||
if (!deleted)
|
||||
|
@ -671,9 +670,7 @@ bool multi_delete::send_eof()
|
|||
if (ha_autocommit_or_rollback(thd,local_error > 0))
|
||||
local_error=1;
|
||||
|
||||
if (local_error)
|
||||
::send_error(thd);
|
||||
else
|
||||
if (!local_error)
|
||||
{
|
||||
thd->row_count_func= deleted;
|
||||
::send_ok(thd, deleted);
|
||||
|
@ -698,12 +695,12 @@ bool multi_delete::send_eof()
|
|||
- If we want to have a name lock on the table on exit without errors.
|
||||
*/
|
||||
|
||||
int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
||||
bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
||||
{
|
||||
HA_CREATE_INFO create_info;
|
||||
char path[FN_REFLEN];
|
||||
TABLE **table_ptr;
|
||||
int error;
|
||||
bool error;
|
||||
DBUG_ENTER("mysql_truncate");
|
||||
|
||||
bzero((char*) &create_info,sizeof(create_info));
|
||||
|
@ -739,9 +736,9 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
|||
db_type table_type;
|
||||
if ((table_type=get_table_type(path)) == DB_TYPE_UNKNOWN)
|
||||
{
|
||||
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db,
|
||||
table_list->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
|
||||
table_list->db, table_list->real_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (!ha_supports_generate(table_type))
|
||||
{
|
||||
|
@ -754,11 +751,11 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
|||
DBUG_RETURN(error);
|
||||
}
|
||||
if (lock_and_wait_for_table_name(thd, table_list))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
*fn_ext(path)=0; // Remove the .frm extension
|
||||
error= ha_create_table(path,&create_info,1) ? -1 : 0;
|
||||
error= ha_create_table(path,&create_info,1);
|
||||
query_cache_invalidate3(thd, table_list, 0);
|
||||
|
||||
end:
|
||||
|
@ -785,5 +782,5 @@ end:
|
|||
unlock_table_name(thd, table_list);
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
}
|
||||
DBUG_RETURN(error ? -1 : 0);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
|
|
@ -20,16 +20,16 @@
|
|||
#include "mysql_priv.h"
|
||||
#include "sql_acl.h"
|
||||
|
||||
int mysql_do(THD *thd, List<Item> &values)
|
||||
bool mysql_do(THD *thd, List<Item> &values)
|
||||
{
|
||||
List_iterator<Item> li(values);
|
||||
Item *value;
|
||||
DBUG_ENTER("mysql_do");
|
||||
if (setup_fields(thd, 0, 0, values, 0, 0, 0))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
while ((value = li++))
|
||||
value->val_int();
|
||||
thd->clear_error(); // DO always is OK
|
||||
send_ok(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
|
|
@ -183,14 +183,14 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
|
|||
Takes into account the current LIMIT
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
1 Error sending data to client
|
||||
FALSE ok
|
||||
TRUE Error sending data to client
|
||||
*/
|
||||
|
||||
static const char *warning_level_names[]= {"Note", "Warning", "Error", "?"};
|
||||
static int warning_level_length[]= { 4, 7, 5, 1 };
|
||||
|
||||
my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
|
||||
bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
|
||||
{
|
||||
List<Item> field_list;
|
||||
DBUG_ENTER("mysqld_show_warnings");
|
||||
|
@ -201,7 +201,7 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
|
|||
|
||||
if (thd->protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
MYSQL_ERROR *err;
|
||||
SELECT_LEX *sel= &thd->lex->select_lex;
|
||||
|
@ -225,10 +225,10 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
|
|||
protocol->store((uint32) err->code);
|
||||
protocol->store(err->msg, strlen(err->msg), system_charset_info);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
if (!--limit)
|
||||
break;
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
|
|
@ -140,11 +140,11 @@ static void mysql_ha_hash_free(TABLE_LIST *tables)
|
|||
error messages.
|
||||
|
||||
RETURN
|
||||
0 ok
|
||||
!= 0 error
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
int mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
|
||||
bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
|
||||
{
|
||||
TABLE_LIST *hash_tables;
|
||||
char *db, *name, *alias;
|
||||
|
@ -236,11 +236,11 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
|
|||
if (! reopen)
|
||||
send_ok(thd);
|
||||
DBUG_PRINT("exit",("OK"));
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
err:
|
||||
DBUG_PRINT("exit",("ERROR"));
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -327,15 +327,15 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
|
|||
offset_limit
|
||||
|
||||
RETURN
|
||||
0 ok
|
||||
!= 0 error
|
||||
FALSE ok
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
enum enum_ha_read_modes mode, char *keyname,
|
||||
List<Item> *key_expr,
|
||||
enum ha_rkey_function ha_rkey_mode, Item *cond,
|
||||
ha_rows select_limit,ha_rows offset_limit)
|
||||
bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
enum enum_ha_read_modes mode, char *keyname,
|
||||
List<Item> *key_expr,
|
||||
enum ha_rkey_function ha_rkey_mode, Item *cond,
|
||||
ha_rows select_limit,ha_rows offset_limit)
|
||||
{
|
||||
TABLE_LIST *hash_tables;
|
||||
TABLE *table;
|
||||
|
@ -512,10 +512,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||
key_len+=key_part->store_length;
|
||||
}
|
||||
if (!(key= (byte*) thd->calloc(ALIGN_SIZE(key_len))))
|
||||
{
|
||||
send_error(thd,ER_OUTOFMEMORY);
|
||||
goto err;
|
||||
}
|
||||
key_copy(key, table->record[0], table->key_info + keyno, key_len);
|
||||
error= table->file->index_read(table->record[0],
|
||||
key,key_len,ha_rkey_mode);
|
||||
|
@ -523,7 +520,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||
break;
|
||||
}
|
||||
default:
|
||||
send_error(thd,ER_ILLEGAL_HA);
|
||||
my_message(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0));
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -552,7 +549,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||
if (item->send(thd->protocol, &buffer))
|
||||
{
|
||||
protocol->free(); // Free used
|
||||
my_error(ER_OUT_OF_RESOURCES,MYF(0));
|
||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -564,13 +561,13 @@ ok:
|
|||
mysql_unlock_tables(thd,lock);
|
||||
send_eof(thd);
|
||||
DBUG_PRINT("exit",("OK"));
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
err:
|
||||
mysql_unlock_tables(thd,lock);
|
||||
err0:
|
||||
DBUG_PRINT("exit",("ERROR"));
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
|
|||
(iindex_relations= find_type((char*) primary_key_name,
|
||||
&relations->keynames, 1+2)-1)<0)
|
||||
{
|
||||
send_error(thd,ER_CORRUPT_HELP_DB);
|
||||
my_message(ER_CORRUPT_HELP_DB, ER(ER_CORRUPT_HELP_DB), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
rtopic_id= find_fields[help_relation_help_topic_id].field;
|
||||
|
@ -607,12 +607,11 @@ SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, uint mlen,
|
|||
thd Thread handler
|
||||
|
||||
RETURN VALUES
|
||||
0 Success
|
||||
1 Error and send_error already commited
|
||||
-1 error && send_error should be issued (normal case)
|
||||
FALSE Success
|
||||
TRUE Error and send_error already commited
|
||||
*/
|
||||
|
||||
int mysqld_help(THD *thd, const char *mask)
|
||||
bool mysqld_help(THD *thd, const char *mask)
|
||||
{
|
||||
Protocol *protocol= thd->protocol;
|
||||
SQL_SELECT *select;
|
||||
|
@ -640,8 +639,8 @@ int mysqld_help(THD *thd, const char *mask)
|
|||
uint mlen= strlen(mask);
|
||||
MEM_ROOT *mem_root= thd->mem_root;
|
||||
|
||||
if ((res= open_and_lock_tables(thd, tables)))
|
||||
goto end;
|
||||
if (open_and_lock_tables(thd, tables))
|
||||
goto error;
|
||||
/*
|
||||
Init tables and fields to be usable from items
|
||||
|
||||
|
@ -650,10 +649,7 @@ int mysqld_help(THD *thd, const char *mask)
|
|||
setup_tables(thd, tables, 0);
|
||||
memcpy((char*) used_fields, (char*) init_used_fields, sizeof(used_fields));
|
||||
if (init_fields(thd, tables, used_fields, array_elements(used_fields)))
|
||||
{
|
||||
res= -1;
|
||||
goto end;
|
||||
}
|
||||
goto error;
|
||||
size_t i;
|
||||
for (i=0; i<sizeof(tables)/sizeof(TABLE_LIST); i++)
|
||||
tables[i].table->file->init_table_handle_for_HANDLER();
|
||||
|
@ -661,12 +657,8 @@ int mysqld_help(THD *thd, const char *mask)
|
|||
if (!(select=
|
||||
prepare_select_for_name(thd,mask,mlen,tables,tables[0].table,
|
||||
used_fields[help_topic_name].field,&error)))
|
||||
{
|
||||
res= -1;
|
||||
goto end;
|
||||
}
|
||||
goto error;
|
||||
|
||||
res= 1;
|
||||
count_topics= search_topics(thd,tables[0].table,used_fields,
|
||||
select,&topics_list,
|
||||
&name, &description, &example);
|
||||
|
@ -678,10 +670,8 @@ int mysqld_help(THD *thd, const char *mask)
|
|||
if (!(select=
|
||||
prepare_select_for_name(thd,mask,mlen,tables,tables[3].table,
|
||||
used_fields[help_keyword_name].field,&error)))
|
||||
{
|
||||
res= -1;
|
||||
goto end;
|
||||
}
|
||||
goto error;
|
||||
|
||||
count_topics=search_keyword(thd,tables[3].table,used_fields,select,&key_id);
|
||||
delete select;
|
||||
count_topics= (count_topics != 1) ? 0 :
|
||||
|
@ -697,10 +687,7 @@ int mysqld_help(THD *thd, const char *mask)
|
|||
if (!(select=
|
||||
prepare_select_for_name(thd,mask,mlen,tables,tables[1].table,
|
||||
used_fields[help_category_name].field,&error)))
|
||||
{
|
||||
res= -1;
|
||||
goto end;
|
||||
}
|
||||
goto error;
|
||||
|
||||
count_categories= search_categories(thd, tables[1].table, used_fields,
|
||||
select,
|
||||
|
@ -709,13 +696,13 @@ int mysqld_help(THD *thd, const char *mask)
|
|||
if (!count_categories)
|
||||
{
|
||||
if (send_header_2(protocol,FALSE))
|
||||
goto end;
|
||||
goto error;
|
||||
}
|
||||
else if (count_categories > 1)
|
||||
{
|
||||
if (send_header_2(protocol,FALSE) ||
|
||||
send_variant_2_list(mem_root,protocol,&categories_list,"Y",0))
|
||||
goto end;
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -728,20 +715,14 @@ int mysqld_help(THD *thd, const char *mask)
|
|||
new Item_int((int32)category_id));
|
||||
if (!(select= prepare_simple_select(thd,cond_topic_by_cat,
|
||||
tables,tables[0].table,&error)))
|
||||
{
|
||||
res= -1;
|
||||
goto end;
|
||||
}
|
||||
goto error;
|
||||
get_all_items_for_category(thd,tables[0].table,
|
||||
used_fields[help_topic_name].field,
|
||||
select,&topics_list);
|
||||
delete select;
|
||||
if (!(select= prepare_simple_select(thd,cond_cat_by_cat,tables,
|
||||
tables[1].table,&error)))
|
||||
{
|
||||
res= -1;
|
||||
goto end;
|
||||
}
|
||||
goto error;
|
||||
get_all_items_for_category(thd,tables[1].table,
|
||||
used_fields[help_category_name].field,
|
||||
select,&subcategories_list);
|
||||
|
@ -750,39 +731,36 @@ int mysqld_help(THD *thd, const char *mask)
|
|||
if (send_header_2(protocol, TRUE) ||
|
||||
send_variant_2_list(mem_root,protocol,&topics_list, "N",cat) ||
|
||||
send_variant_2_list(mem_root,protocol,&subcategories_list,"Y",cat))
|
||||
goto end;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else if (count_topics == 1)
|
||||
{
|
||||
if (send_answer_1(protocol,&name,&description,&example))
|
||||
goto end;
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First send header and functions */
|
||||
if (send_header_2(protocol, FALSE) ||
|
||||
send_variant_2_list(mem_root,protocol, &topics_list, "N", 0))
|
||||
goto end;
|
||||
goto error;
|
||||
if (!(select=
|
||||
prepare_select_for_name(thd,mask,mlen,tables,tables[1].table,
|
||||
used_fields[help_category_name].field,&error)))
|
||||
{
|
||||
res= -1;
|
||||
goto end;
|
||||
}
|
||||
goto error;
|
||||
search_categories(thd, tables[1].table, used_fields,
|
||||
select,&categories_list, 0);
|
||||
delete select;
|
||||
/* Then send categories */
|
||||
if (send_variant_2_list(mem_root,protocol, &categories_list, "Y", 0))
|
||||
goto end;
|
||||
goto error;
|
||||
}
|
||||
res= 0;
|
||||
|
||||
send_eof(thd);
|
||||
|
||||
end:
|
||||
DBUG_RETURN(res);
|
||||
DBUG_RETURN(FALSE);
|
||||
error:
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,8 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
|
|||
|
||||
if (check_unique && thd->dupp_field)
|
||||
{
|
||||
my_error(ER_FIELD_SPECIFIED_TWICE,MYF(0), thd->dupp_field->field_name);
|
||||
my_printf_error(ER_FIELD_SPECIFIED_TWICE, ER(ER_FIELD_SPECIFIED_TWICE),
|
||||
MYF(0), thd->dupp_field->field_name);
|
||||
return -1;
|
||||
}
|
||||
if (table->timestamp_field && // Don't set timestamp if used
|
||||
|
@ -115,12 +116,12 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
|
|||
}
|
||||
|
||||
|
||||
int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
List<Item> &fields,
|
||||
List<List_item> &values_list,
|
||||
List<Item> &update_fields,
|
||||
List<Item> &update_values,
|
||||
enum_duplicates duplic)
|
||||
bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
List<Item> &fields,
|
||||
List<List_item> &values_list,
|
||||
List<Item> &update_fields,
|
||||
List<Item> &update_values,
|
||||
enum_duplicates duplic)
|
||||
{
|
||||
int error, res;
|
||||
/*
|
||||
|
@ -174,7 +175,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||
my_printf_error(ER_DELAYED_INSERT_TABLE_LOCKED,
|
||||
ER(ER_DELAYED_INSERT_TABLE_LOCKED),
|
||||
MYF(0), table_list->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
if ((table= delayed_get_table(thd,table_list)) && !thd->is_fatal_error)
|
||||
|
@ -200,7 +201,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||
#endif /* EMBEDDED_LIBRARY */
|
||||
res= open_and_lock_tables(thd, table_list);
|
||||
if (res || thd->is_fatal_error)
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
table= table_list->table;
|
||||
thd->proc_info="init";
|
||||
|
@ -291,13 +292,18 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||
if (fields.elements || !value_count)
|
||||
{
|
||||
restore_record(table,default_values); // Get empty record
|
||||
if (fill_record(fields, *values, 0)|| thd->net.report_error)
|
||||
if (fill_record(thd, fields, *values, 0))
|
||||
{
|
||||
if (values_list.elements != 1 && !thd->net.report_error)
|
||||
{
|
||||
info.records++;
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
TODO: set thd->abort_on_warning if values_list.elements == 1
|
||||
and check that all items return warning in case of problem with
|
||||
storing field.
|
||||
*/
|
||||
error=1;
|
||||
break;
|
||||
}
|
||||
|
@ -308,7 +314,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||
restore_record(table,default_values); // Get empty record
|
||||
else
|
||||
table->record[0][0]=table->default_values[0]; // Fix delete marker
|
||||
if (fill_record(table->field,*values, 0) || thd->net.report_error)
|
||||
if (fill_record(thd, table->field, *values, 0))
|
||||
{
|
||||
if (values_list.elements != 1 && ! thd->net.report_error)
|
||||
{
|
||||
|
@ -468,7 +474,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
table->insert_values=0;
|
||||
thd->abort_on_warning= 0;
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
abort:
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
@ -478,7 +484,7 @@ abort:
|
|||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
table->insert_values=0;
|
||||
thd->abort_on_warning= 0;
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -596,7 +602,8 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list,
|
|||
(insert_into_view &&
|
||||
check_view_insertability(table_list, thd->query_id)))
|
||||
{
|
||||
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "INSERT");
|
||||
my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
|
||||
MYF(0), table_list->alias, "INSERT");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
@ -612,11 +619,11 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list,
|
|||
table_list Global/local table list
|
||||
|
||||
RETURN VALUE
|
||||
0 OK
|
||||
-1 error (message is not sent to user)
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
||||
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
||||
List<Item> &fields, List_item *values,
|
||||
List<Item> &update_fields, List<Item> &update_values,
|
||||
enum_duplicates duplic)
|
||||
|
@ -624,7 +631,7 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
|||
bool insert_into_view= (table_list->view != 0);
|
||||
/* TODO: use this condition for 'WITH CHECK OPTION' */
|
||||
Item *unused_conds= 0;
|
||||
int res;
|
||||
bool res;
|
||||
DBUG_ENTER("mysql_prepare_insert");
|
||||
|
||||
if (mysql_prepare_insert_check_table(thd, table_list, fields, &unused_conds))
|
||||
|
@ -639,15 +646,16 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
|||
thd->lex->select_lex.no_wrap_view_item= 0,
|
||||
res) ||
|
||||
setup_fields(thd, 0, table_list, update_values, 0, 0, 0))))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (unique_table(table_list, table_list->next_global))
|
||||
{
|
||||
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
|
||||
MYF(0), table_list->real_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
thd->lex->select_lex.first_execution= 0;
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -739,7 +747,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
|||
*/
|
||||
store_record(table,insert_values);
|
||||
restore_record(table,record[1]);
|
||||
if (fill_record(*info->update_fields, *info->update_values, 0))
|
||||
if (fill_record(thd, *info->update_fields, *info->update_values, 0))
|
||||
goto err;
|
||||
|
||||
/* CHECK OPTION for VIEW ... ON DUPLICATE KEY UPDATE ... */
|
||||
|
@ -1001,7 +1009,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
|
|||
{
|
||||
delete tmp;
|
||||
thd->fatal_error();
|
||||
my_error(ER_OUT_OF_RESOURCES,MYF(0));
|
||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
||||
pthread_mutex_unlock(&LOCK_delayed_create);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -1021,7 +1029,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
|
|||
delete tmp;
|
||||
thd->fatal_error();
|
||||
pthread_mutex_unlock(&LOCK_delayed_create);
|
||||
net_printf(thd,ER_CANT_CREATE_THREAD,error);
|
||||
my_error(ER_CANT_CREATE_THREAD, MYF(0), error);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -1317,7 +1325,8 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg)
|
|||
if (!(di->table->file->table_flags() & HA_CAN_INSERT_DELAYED))
|
||||
{
|
||||
thd->fatal_error();
|
||||
my_error(ER_ILLEGAL_HA, MYF(0), di->table_list.real_name);
|
||||
my_printf_error(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0),
|
||||
di->table_list.real_name);
|
||||
goto end;
|
||||
}
|
||||
di->table->copy_blobs=1;
|
||||
|
@ -1649,11 +1658,11 @@ bool delayed_insert::handle_inserts(void)
|
|||
thd thread handler
|
||||
|
||||
RETURN
|
||||
0 OK
|
||||
-1 Error
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
int mysql_insert_select_prepare(THD *thd)
|
||||
bool mysql_insert_select_prepare(THD *thd)
|
||||
{
|
||||
LEX *lex= thd->lex;
|
||||
DBUG_ENTER("mysql_insert_select_prepare");
|
||||
|
@ -1665,8 +1674,8 @@ int mysql_insert_select_prepare(THD *thd)
|
|||
if (mysql_prepare_insert_check_table(thd, lex->query_tables,
|
||||
lex->field_list,
|
||||
&lex->select_lex.where))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1742,9 +1751,9 @@ bool select_insert::send_data(List<Item> &values)
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
if (fields->elements)
|
||||
fill_record(*fields, values, 1);
|
||||
fill_record(thd, *fields, values, 1);
|
||||
else
|
||||
fill_record(table->field, values, 1);
|
||||
fill_record(thd, table->field, values, 1);
|
||||
switch (table_list->view_check_option(thd,
|
||||
thd->lex->duplicates == DUP_IGNORE))
|
||||
{
|
||||
|
@ -1769,8 +1778,7 @@ void select_insert::send_error(uint errcode,const char *err)
|
|||
{
|
||||
DBUG_ENTER("select_insert::send_error");
|
||||
|
||||
/* TODO error should be sent at the query processing end */
|
||||
::send_error(thd,errcode,err);
|
||||
my_message(errcode, err, MYF(0));
|
||||
|
||||
if (!table)
|
||||
{
|
||||
|
@ -1846,8 +1854,6 @@ bool select_insert::send_eof()
|
|||
if (error)
|
||||
{
|
||||
table->file->print_error(error,MYF(0));
|
||||
//TODO error should be sent at the query processing end
|
||||
::send_error(thd);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
char buff[160];
|
||||
|
@ -1918,7 +1924,7 @@ bool select_create::send_data(List<Item> &values)
|
|||
unit->offset_limit_cnt--;
|
||||
return 0;
|
||||
}
|
||||
fill_record(field, values, 1);
|
||||
fill_record(thd, field, values, 1);
|
||||
if (thd->net.report_error || write_record(thd, table, &info))
|
||||
return 1;
|
||||
if (table->next_number_field) // Clear for next record
|
||||
|
|
|
@ -1308,7 +1308,7 @@ bool st_select_lex::test_limit()
|
|||
if (select_limit != HA_POS_ERROR)
|
||||
{
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
|
||||
"LIMIT & IN/ALL/ANY/SOME subquery");
|
||||
"LIMIT & IN/ALL/ANY/SOME subquery");
|
||||
return(1);
|
||||
}
|
||||
// We need only 1 row to determinate existence
|
||||
|
|
|
@ -342,8 +342,8 @@ protected:
|
|||
TABLE *table; /* temporary table using for appending UNION results */
|
||||
|
||||
select_result *result;
|
||||
int res;
|
||||
ulong found_rows_for_union;
|
||||
bool res;
|
||||
bool prepared, // prepare phase already performed for UNION (unit)
|
||||
optimized, // optimize phase already performed for UNION (unit)
|
||||
executed, // already executed
|
||||
|
@ -403,9 +403,9 @@ public:
|
|||
void exclude_tree();
|
||||
|
||||
/* UNION methods */
|
||||
int prepare(THD *thd, select_result *result, ulong additional_options);
|
||||
int exec();
|
||||
int cleanup();
|
||||
bool prepare(THD *thd, select_result *result, ulong additional_options);
|
||||
bool exec();
|
||||
bool cleanup();
|
||||
inline void unclean() { cleaned= 0; }
|
||||
void reinit_exec_mechanism();
|
||||
|
||||
|
@ -413,7 +413,7 @@ public:
|
|||
void print(String *str);
|
||||
|
||||
ulong init_prepare_fake_select_lex(THD *thd);
|
||||
int change_result(select_subselect *result, select_subselect *old_result);
|
||||
bool change_result(select_subselect *result, select_subselect *old_result);
|
||||
void set_limit(st_select_lex *values, st_select_lex *sl);
|
||||
|
||||
friend void lex_start(THD *thd, uchar *buf, uint length);
|
||||
|
|
|
@ -80,7 +80,7 @@ static int read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||
String &enclosed, ulong skip_lines,
|
||||
bool ignore_check_option_errors);
|
||||
|
||||
int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
List<Item> &fields, enum enum_duplicates handle_duplicates,
|
||||
bool read_file_from_client,thr_lock_type lock_type,
|
||||
bool ignore_check_option_errors)
|
||||
|
@ -116,17 +116,18 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||
{
|
||||
my_message(ER_WRONG_FIELD_TERMINATORS,ER(ER_WRONG_FIELD_TERMINATORS),
|
||||
MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
table_list->lock_type= lock_type;
|
||||
if ((res= open_and_lock_tables(thd, table_list)))
|
||||
DBUG_RETURN(res);
|
||||
if (open_and_lock_tables(thd, table_list))
|
||||
DBUG_RETURN(TRUE);
|
||||
if (setup_tables(thd, table_list, &unused_conds))
|
||||
DBUG_RETURN(-1);
|
||||
if (!table_list->updatable || check_key_in_view(thd, table_list))
|
||||
{
|
||||
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "LOAD");
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
|
||||
MYF(0), table_list->alias, "LOAD");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
table= table_list->table;
|
||||
transactional_table= table->file->has_transactions();
|
||||
|
@ -145,14 +146,15 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||
Item *unused_conds= 0;
|
||||
if (setup_tables(thd, table_list, &unused_conds) ||
|
||||
setup_fields(thd, 0, table_list, fields, 1, 0, 0))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
if (thd->dupp_field)
|
||||
{
|
||||
my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), thd->dupp_field->field_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_FIELD_SPECIFIED_TWICE, ER(ER_FIELD_SPECIFIED_TWICE),
|
||||
MYF(0), thd->dupp_field->field_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (check_that_all_fields_are_given_values(thd, table))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
uint tot_length=0;
|
||||
|
@ -178,7 +180,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||
{
|
||||
my_message(ER_BLOBS_AND_NO_TERMINATED,ER(ER_BLOBS_AND_NO_TERMINATED),
|
||||
MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/* We can't give an error in the middle when using LOCAL files */
|
||||
|
@ -210,7 +212,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||
#if !defined(__WIN__) && !defined(OS2) && ! defined(__NETWARE__)
|
||||
MY_STAT stat_info;
|
||||
if (!my_stat(name,&stat_info,MYF(MY_WME)))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
// if we are not in slave thread, the file must be:
|
||||
if (!thd->slave_thread &&
|
||||
|
@ -221,15 +223,16 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||
((stat_info.st_mode & S_IFREG) == S_IFREG ||
|
||||
(stat_info.st_mode & S_IFIFO) == S_IFIFO)))
|
||||
{
|
||||
my_error(ER_TEXTFILE_NOT_READABLE,MYF(0),name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_TEXTFILE_NOT_READABLE,
|
||||
ER(ER_TEXTFILE_NOT_READABLE), MYF(0), name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)
|
||||
is_fifo = 1;
|
||||
#endif
|
||||
}
|
||||
if ((file=my_open(name,O_RDONLY,MYF(MY_WME))) < 0)
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
COPY_INFO info;
|
||||
|
@ -244,7 +247,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||
{
|
||||
if (file >= 0)
|
||||
my_close(file,MYF(0)); // no files in net reading
|
||||
DBUG_RETURN(-1); // Can't allocate buffers
|
||||
DBUG_RETURN(TRUE); // Can't allocate buffers
|
||||
}
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
|
|
@ -47,13 +47,13 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt
|
|||
0L)))
|
||||
{
|
||||
error=errno;
|
||||
my_printf_error(0,"Can't map file: %s, errno: %d",MYF(0),
|
||||
(my_string) name,error);
|
||||
my_printf_error(ER_NO_FILE_MAPPING, ER(ER_NO_FILE_MAPPING), MYF(0),
|
||||
(my_string) name, error);
|
||||
}
|
||||
}
|
||||
if (map && memcmp(map,magic,magic_length))
|
||||
{
|
||||
my_printf_error(0,"Wrong magic in %s",MYF(0),name);
|
||||
my_printf_error(ER_WRONG_MAGIC, ER(ER_WRONG_MAGIC), MYF(0), name);
|
||||
VOID(munmap(map,size));
|
||||
map=0;
|
||||
}
|
||||
|
@ -112,8 +112,8 @@ mapped_files *map_file(const my_string name,byte *magic,uint magic_length)
|
|||
{
|
||||
map->use_count++;
|
||||
if (!map->map)
|
||||
my_printf_error(0,"Can't map file: %s, error: %d",MYF(0),path,
|
||||
map->error);
|
||||
my_printf_error(ER_NO_FILE_MAPPING, ER(ER_NO_FILE_MAPPING), MYF(0),
|
||||
path, map->error);
|
||||
}
|
||||
VOID(pthread_mutex_unlock(&LOCK_mapped_file));
|
||||
return map;
|
||||
|
|
682
sql/sql_parse.cc
682
sql/sql_parse.cc
File diff suppressed because it is too large
Load diff
|
@ -123,16 +123,13 @@ inline bool is_param_null(const uchar *pos, ulong param_no)
|
|||
|
||||
enum { STMT_QUERY_LOG_LENGTH= 8192 };
|
||||
|
||||
enum enum_send_error { DONT_SEND_ERROR= 0, SEND_ERROR };
|
||||
|
||||
/*
|
||||
Seek prepared statement in statement map by id: returns zero if statement
|
||||
was not found, pointer otherwise.
|
||||
*/
|
||||
|
||||
static Prepared_statement *
|
||||
find_prepared_statement(THD *thd, ulong id, const char *where,
|
||||
enum enum_send_error se)
|
||||
find_prepared_statement(THD *thd, ulong id, const char *where)
|
||||
{
|
||||
Statement *stmt= thd->stmt_map.find(id);
|
||||
|
||||
|
@ -140,8 +137,6 @@ find_prepared_statement(THD *thd, ulong id, const char *where,
|
|||
{
|
||||
char llbuf[22];
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), 22, llstr(id, llbuf), where);
|
||||
if (se == SEND_ERROR)
|
||||
send_error(thd);
|
||||
return 0;
|
||||
}
|
||||
return (Prepared_statement *) stmt;
|
||||
|
@ -181,7 +176,7 @@ static bool send_prep_stmt(Prepared_statement *stmt,
|
|||
|
||||
thd->client_stmt_id= stmt->id;
|
||||
thd->client_param_count= stmt->param_count;
|
||||
thd->net.last_errno= 0;
|
||||
thd->clear_error();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -882,24 +877,23 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
|
|||
tables global/local table list
|
||||
|
||||
RETURN VALUE
|
||||
0 ok
|
||||
1 error, sent to the client
|
||||
-1 error, not sent to client
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
static int mysql_test_insert(Prepared_statement *stmt,
|
||||
TABLE_LIST *table_list,
|
||||
List<Item> &fields,
|
||||
List<List_item> &values_list,
|
||||
List<Item> &update_fields,
|
||||
List<Item> &update_values,
|
||||
enum_duplicates duplic)
|
||||
static bool mysql_test_insert(Prepared_statement *stmt,
|
||||
TABLE_LIST *table_list,
|
||||
List<Item> &fields,
|
||||
List<List_item> &values_list,
|
||||
List<Item> &update_fields,
|
||||
List<Item> &update_values,
|
||||
enum_duplicates duplic)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
LEX *lex= stmt->lex;
|
||||
List_iterator_fast<List_item> its(values_list);
|
||||
List_item *values;
|
||||
int res;
|
||||
bool res;
|
||||
DBUG_ENTER("mysql_test_insert");
|
||||
|
||||
if ((res= insert_precheck(thd, table_list)))
|
||||
|
@ -909,9 +903,9 @@ static int mysql_test_insert(Prepared_statement *stmt,
|
|||
open temporary memory pool for temporary data allocated by derived
|
||||
tables & preparation procedure
|
||||
*/
|
||||
if ((res= open_and_lock_tables(thd, table_list)))
|
||||
if (open_and_lock_tables(thd, table_list))
|
||||
{
|
||||
DBUG_RETURN(res);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if ((values= its++))
|
||||
|
@ -958,14 +952,13 @@ error:
|
|||
tables list of tables queries
|
||||
|
||||
RETURN VALUE
|
||||
0 success
|
||||
1 error, sent to client
|
||||
-1 error, not sent to client
|
||||
FALSE success
|
||||
TRUE error
|
||||
*/
|
||||
static int mysql_test_update(Prepared_statement *stmt,
|
||||
TABLE_LIST *table_list)
|
||||
static bool mysql_test_update(Prepared_statement *stmt,
|
||||
TABLE_LIST *table_list)
|
||||
{
|
||||
int res;
|
||||
bool res;
|
||||
THD *thd= stmt->thd;
|
||||
SELECT_LEX *select= &stmt->lex->select_lex;
|
||||
DBUG_ENTER("mysql_test_update");
|
||||
|
@ -1010,28 +1003,27 @@ static int mysql_test_update(Prepared_statement *stmt,
|
|||
tables list of tables queries
|
||||
|
||||
RETURN VALUE
|
||||
0 success
|
||||
1 error, sent to client
|
||||
-1 error, not sent to client
|
||||
FALSE success
|
||||
TRUE error
|
||||
*/
|
||||
static int mysql_test_delete(Prepared_statement *stmt,
|
||||
TABLE_LIST *table_list)
|
||||
{
|
||||
int res;
|
||||
THD *thd= stmt->thd;
|
||||
LEX *lex= stmt->lex;
|
||||
DBUG_ENTER("mysql_test_delete");
|
||||
|
||||
if ((res= delete_precheck(thd, table_list)))
|
||||
DBUG_RETURN(res);
|
||||
if (delete_precheck(thd, table_list))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (!(res=open_and_lock_tables(thd, table_list)))
|
||||
if (!open_and_lock_tables(thd, table_list))
|
||||
{
|
||||
res= mysql_prepare_delete(thd, table_list, &lex->select_lex.where);
|
||||
mysql_prepare_delete(thd, table_list, &lex->select_lex.where);
|
||||
lex->unit.cleanup();
|
||||
DBUG_RETURN(FALSE)
|
||||
}
|
||||
/* TODO: here we should send types of placeholders to the client. */
|
||||
DBUG_RETURN(res);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1046,9 +1038,8 @@ static int mysql_test_delete(Prepared_statement *stmt,
|
|||
tables list of tables queries
|
||||
|
||||
RETURN VALUE
|
||||
0 success
|
||||
1 error, sent to client
|
||||
-1 error, not sent to client
|
||||
FALSE success
|
||||
TRUE error, sent to client
|
||||
*/
|
||||
|
||||
static int mysql_test_select(Prepared_statement *stmt,
|
||||
|
@ -1057,7 +1048,7 @@ static int mysql_test_select(Prepared_statement *stmt,
|
|||
THD *thd= stmt->thd;
|
||||
LEX *lex= stmt->lex;
|
||||
SELECT_LEX_UNIT *unit= &lex->unit;
|
||||
int result;
|
||||
bool result;
|
||||
DBUG_ENTER("mysql_test_select");
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
|
@ -1065,10 +1056,10 @@ static int mysql_test_select(Prepared_statement *stmt,
|
|||
if (tables)
|
||||
{
|
||||
if (check_table_access(thd, privilege, tables,0))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
else if (check_access(thd, privilege, any_db,0,0,0))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
#endif
|
||||
|
||||
if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
|
||||
|
@ -1078,19 +1069,14 @@ static int mysql_test_select(Prepared_statement *stmt,
|
|||
}
|
||||
|
||||
if ((result= open_and_lock_tables(thd, tables)))
|
||||
{
|
||||
result= 1; // Error sent
|
||||
send_error(thd);
|
||||
goto err;
|
||||
}
|
||||
result= 1;
|
||||
result= TRUE;
|
||||
|
||||
thd->used_tables= 0; // Updated by setup_fields
|
||||
|
||||
// JOIN::prepare calls
|
||||
if (unit->prepare(thd, 0, 0))
|
||||
{
|
||||
send_error(thd);
|
||||
goto err_prep;
|
||||
}
|
||||
if (!text_protocol)
|
||||
|
@ -1120,7 +1106,7 @@ static int mysql_test_select(Prepared_statement *stmt,
|
|||
goto err_prep;
|
||||
}
|
||||
}
|
||||
result= 0; // ok
|
||||
result= FALSE; // ok
|
||||
|
||||
err_prep:
|
||||
unit->cleanup();
|
||||
|
@ -1139,30 +1125,27 @@ err:
|
|||
values list of expressions
|
||||
|
||||
RETURN VALUE
|
||||
0 success
|
||||
1 error, sent to client
|
||||
-1 error, not sent to client
|
||||
FALSE success
|
||||
TRUE error, sent to client
|
||||
*/
|
||||
|
||||
static int mysql_test_do_fields(Prepared_statement *stmt,
|
||||
static bool mysql_test_do_fields(Prepared_statement *stmt,
|
||||
TABLE_LIST *tables,
|
||||
List<Item> *values)
|
||||
{
|
||||
DBUG_ENTER("mysql_test_do_fields");
|
||||
THD *thd= stmt->thd;
|
||||
int res= 0;
|
||||
if (tables && (res= check_table_access(thd, SELECT_ACL, tables, 0)))
|
||||
DBUG_RETURN(res);
|
||||
bool res;
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, 0))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (tables && (res= open_and_lock_tables(thd, tables)))
|
||||
if (tables && open_and_lock_tables(thd, tables))
|
||||
{
|
||||
DBUG_RETURN(res);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
res= setup_fields(thd, 0, 0, *values, 0, 0, 0);
|
||||
stmt->lex->unit.cleanup();
|
||||
if (res)
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1176,22 +1159,21 @@ static int mysql_test_do_fields(Prepared_statement *stmt,
|
|||
values list of expressions
|
||||
|
||||
RETURN VALUE
|
||||
0 success
|
||||
1 error, sent to client
|
||||
-1 error, not sent to client
|
||||
FALSE success
|
||||
TRUE error
|
||||
*/
|
||||
static int mysql_test_set_fields(Prepared_statement *stmt,
|
||||
TABLE_LIST *tables,
|
||||
List<set_var_base> *var_list)
|
||||
static bool mysql_test_set_fields(Prepared_statement *stmt,
|
||||
TABLE_LIST *tables,
|
||||
List<set_var_base> *var_list)
|
||||
{
|
||||
DBUG_ENTER("mysql_test_set_fields");
|
||||
List_iterator_fast<set_var_base> it(*var_list);
|
||||
THD *thd= stmt->thd;
|
||||
set_var_base *var;
|
||||
int res= 0;
|
||||
bool res= 0;
|
||||
|
||||
if (tables && (res= check_table_access(thd, SELECT_ACL, tables, 0)))
|
||||
DBUG_RETURN(res);
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, 0))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (tables && (res= open_and_lock_tables(thd, tables)))
|
||||
goto error;
|
||||
|
@ -1200,7 +1182,7 @@ static int mysql_test_set_fields(Prepared_statement *stmt,
|
|||
if (var->light_check(thd))
|
||||
{
|
||||
stmt->lex->unit.cleanup();
|
||||
res= -1;
|
||||
res= TRUE;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -1220,18 +1202,17 @@ error:
|
|||
specific_prepare - function of command specific prepare
|
||||
|
||||
RETURN VALUE
|
||||
0 success
|
||||
1 error, sent to client
|
||||
-1 error, not sent to client
|
||||
FALSE success
|
||||
TRUE error
|
||||
*/
|
||||
static int select_like_statement_test(Prepared_statement *stmt,
|
||||
TABLE_LIST *tables,
|
||||
int (*specific_prepare)(THD *thd))
|
||||
static bool select_like_statement_test(Prepared_statement *stmt,
|
||||
TABLE_LIST *tables,
|
||||
bool (*specific_prepare)(THD *thd))
|
||||
{
|
||||
DBUG_ENTER("select_like_statement_test");
|
||||
THD *thd= stmt->thd;
|
||||
LEX *lex= stmt->lex;
|
||||
int res= 0;
|
||||
bool res= 0;
|
||||
|
||||
if (tables && (res= open_and_lock_tables(thd, tables)))
|
||||
goto end;
|
||||
|
@ -1244,7 +1225,7 @@ static int select_like_statement_test(Prepared_statement *stmt,
|
|||
// JOIN::prepare calls
|
||||
if (lex->unit.prepare(thd, 0, 0))
|
||||
{
|
||||
res= thd->net.report_error ? -1 : 1;
|
||||
res= TRUE;
|
||||
}
|
||||
end:
|
||||
lex->unit.cleanup();
|
||||
|
@ -1301,16 +1282,15 @@ static int mysql_test_create_table(Prepared_statement *stmt)
|
|||
tables list of tables queries
|
||||
|
||||
RETURN VALUE
|
||||
0 success
|
||||
1 error, sent to client
|
||||
-1 error, not sent to client
|
||||
FALSE success
|
||||
TRUE error
|
||||
*/
|
||||
static int mysql_test_multiupdate(Prepared_statement *stmt,
|
||||
|
||||
static bool mysql_test_multiupdate(Prepared_statement *stmt,
|
||||
TABLE_LIST *tables)
|
||||
{
|
||||
int res;
|
||||
if ((res= multi_update_precheck(stmt->thd, tables)))
|
||||
return res;
|
||||
if (multi_update_precheck(stmt->thd, tables))
|
||||
return TRUE;
|
||||
/*
|
||||
here we do not pass tables for opening, tables will be opened and locked
|
||||
by mysql_multi_update_prepare
|
||||
|
@ -1513,15 +1493,13 @@ static int check_prepared_statement(Prepared_statement *stmt,
|
|||
All other is not supported yet
|
||||
*/
|
||||
res= -1;
|
||||
my_error(ER_UNSUPPORTED_PS, MYF(0));
|
||||
my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0));
|
||||
goto error;
|
||||
}
|
||||
if (res == 0)
|
||||
DBUG_RETURN(text_protocol? 0 : (send_prep_stmt(stmt, 0) ||
|
||||
thd->protocol->flush()));
|
||||
error:
|
||||
if (res < 0)
|
||||
send_error(thd,thd->killed_errno());
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
@ -1551,10 +1529,7 @@ static bool init_param_array(Prepared_statement *stmt)
|
|||
alloc_root(stmt->thd->mem_root,
|
||||
sizeof(Item_param*) * stmt->param_count);
|
||||
if (!stmt->param_array)
|
||||
{
|
||||
send_error(thd, ER_OUT_OF_RESOURCES);
|
||||
return 1;
|
||||
}
|
||||
for (to= stmt->param_array;
|
||||
to < stmt->param_array + stmt->param_count;
|
||||
++to)
|
||||
|
@ -1578,10 +1553,10 @@ static bool init_param_array(Prepared_statement *stmt)
|
|||
name NULL or statement name. For unnamed statements binary PS
|
||||
protocol is used, for named statements text protocol is
|
||||
used.
|
||||
RETURN
|
||||
0 OK, statement prepared successfully
|
||||
other Error
|
||||
|
||||
RETURN
|
||||
FALSE OK, statement prepared successfully
|
||||
TRUE Error
|
||||
|
||||
NOTES
|
||||
This function parses the query and sends the total number of parameters
|
||||
and resultset metadata information back to client (if any), without
|
||||
|
@ -1595,21 +1570,18 @@ static bool init_param_array(Prepared_statement *stmt)
|
|||
|
||||
*/
|
||||
|
||||
int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
|
||||
LEX_STRING *name)
|
||||
bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
|
||||
LEX_STRING *name)
|
||||
{
|
||||
LEX *lex;
|
||||
Prepared_statement *stmt= new Prepared_statement(thd);
|
||||
int error;
|
||||
bool error;
|
||||
DBUG_ENTER("mysql_stmt_prepare");
|
||||
|
||||
DBUG_PRINT("prep_query", ("%s", packet));
|
||||
|
||||
if (stmt == 0)
|
||||
{
|
||||
send_error(thd, ER_OUT_OF_RESOURCES);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (name)
|
||||
{
|
||||
|
@ -1618,16 +1590,14 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
|
|||
name->length)))
|
||||
{
|
||||
delete stmt;
|
||||
send_error(thd, ER_OUT_OF_RESOURCES);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (thd->stmt_map.insert(stmt))
|
||||
{
|
||||
delete stmt;
|
||||
send_error(thd, ER_OUT_OF_RESOURCES);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
thd->set_n_backup_statement(stmt, &thd->stmt_backup);
|
||||
|
@ -1639,8 +1609,7 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
|
|||
thd->restore_backup_item_arena(stmt, &thd->stmt_backup);
|
||||
/* Statement map deletes statement on erase */
|
||||
thd->stmt_map.erase(stmt);
|
||||
send_error(thd, ER_OUT_OF_RESOURCES);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
mysql_log.write(thd, COM_PREPARE, "%s", packet);
|
||||
|
@ -1828,8 +1797,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
|
|||
|
||||
packet+= 9; /* stmt_id + 5 bytes of flags */
|
||||
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute",
|
||||
SEND_ERROR)))
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute")))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
DBUG_PRINT("exec_query:", ("%s", stmt->query));
|
||||
|
@ -1837,7 +1805,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
|
|||
/* Check if we got an error when sending long data */
|
||||
if (stmt->state == Item_arena::ERROR)
|
||||
{
|
||||
send_error(thd, stmt->last_errno, stmt->last_error);
|
||||
my_message(stmt->last_errno, stmt->last_error, MYF(0));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -1859,10 +1827,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
|
|||
DBUG_PRINT("info",("Using READ_ONLY cursor"));
|
||||
if (!stmt->cursor &&
|
||||
!(stmt->cursor= new (&stmt->main_mem_root) Cursor()))
|
||||
{
|
||||
send_error(thd, ER_OUT_OF_RESOURCES);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
/* If lex->result is set, mysql_execute_command will use it */
|
||||
stmt->lex->result= &stmt->cursor->result;
|
||||
}
|
||||
|
@ -1930,7 +1895,6 @@ set_params_data_err:
|
|||
reset_stmt_params(stmt);
|
||||
my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_execute");
|
||||
err:
|
||||
send_error(thd);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -1956,14 +1920,12 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name)
|
|||
{
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_name->length,
|
||||
stmt_name->str, "EXECUTE");
|
||||
send_error(thd);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
if (stmt->param_count != thd->lex->prepared_stmt_params.elements)
|
||||
{
|
||||
my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE");
|
||||
send_error(thd);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -1976,7 +1938,6 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name)
|
|||
&expanded_query))
|
||||
{
|
||||
my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE");
|
||||
send_error(thd);
|
||||
}
|
||||
execute_stmt(thd, stmt, &expanded_query);
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -2066,7 +2027,6 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
|
|||
!stmt->cursor->is_open())
|
||||
{
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_id, "fetch");
|
||||
send_error(thd);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -2117,8 +2077,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
|
|||
|
||||
DBUG_ENTER("mysql_stmt_reset");
|
||||
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset",
|
||||
SEND_ERROR)))
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset")))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
stmt->state= Item_arena::PREPARED;
|
||||
|
@ -2149,8 +2108,7 @@ void mysql_stmt_free(THD *thd, char *packet)
|
|||
|
||||
DBUG_ENTER("mysql_stmt_free");
|
||||
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close",
|
||||
DONT_SEND_ERROR)))
|
||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close")))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
/* Statement map deletes statement on erase */
|
||||
|
@ -2200,8 +2158,8 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
|
|||
stmt_id= uint4korr(packet);
|
||||
packet+= 4;
|
||||
|
||||
if (!(stmt=find_prepared_statement(thd, stmt_id, "mysql_stmt_send_long_data",
|
||||
DONT_SEND_ERROR)))
|
||||
if (!(stmt=find_prepared_statement(thd, stmt_id,
|
||||
"mysql_stmt_send_long_data")))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
param_number= uint2korr(packet);
|
||||
|
|
|
@ -44,7 +44,8 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
|
|||
|
||||
if (thd->locked_tables || thd->active_transaction())
|
||||
{
|
||||
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION,MYF(0));
|
||||
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
|
||||
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
@ -156,7 +157,8 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
|
|||
unpack_filename(name, name);
|
||||
if (!access(name,F_OK))
|
||||
{
|
||||
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_alias);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
|
||||
MYF(0), new_alias);
|
||||
DBUG_RETURN(ren_table); // This can't be skipped
|
||||
}
|
||||
sprintf(name,"%s/%s/%s%s",mysql_data_home,
|
||||
|
@ -165,7 +167,8 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
|
|||
unpack_filename(name, name);
|
||||
if ((table_type=get_table_type(name)) == DB_TYPE_UNKNOWN)
|
||||
{
|
||||
my_error(ER_FILE_NOT_FOUND, MYF(0), name, my_errno);
|
||||
my_printf_error(ER_FILE_NOT_FOUND, ER(ER_FILE_NOT_FOUND), MYF(0),
|
||||
name, my_errno);
|
||||
if (!skip_error)
|
||||
DBUG_RETURN(ren_table);
|
||||
}
|
||||
|
|
104
sql/sql_repl.cc
104
sql/sql_repl.cc
|
@ -276,41 +276,39 @@ bool log_in_use(const char* log_name)
|
|||
return result;
|
||||
}
|
||||
|
||||
int purge_error_message(THD* thd, int res)
|
||||
bool purge_error_message(THD* thd, int res)
|
||||
{
|
||||
const char *errmsg= 0;
|
||||
uint errmsg= 0;
|
||||
|
||||
switch (res) {
|
||||
case 0: break;
|
||||
case LOG_INFO_EOF: errmsg= "Target log not found in binlog index"; break;
|
||||
case LOG_INFO_IO: errmsg= "I/O error reading log index file"; break;
|
||||
case LOG_INFO_INVALID:
|
||||
errmsg= "Server configuration does not permit binlog purge"; break;
|
||||
case LOG_INFO_SEEK: errmsg= "Failed on fseek()"; break;
|
||||
case LOG_INFO_MEM: errmsg= "Out of memory"; break;
|
||||
case LOG_INFO_FATAL: errmsg= "Fatal error during purge"; break;
|
||||
case LOG_INFO_IN_USE: errmsg= "A purgeable log is in use, will not purge";
|
||||
break;
|
||||
default: errmsg= "Unknown error during purge"; break;
|
||||
case LOG_INFO_EOF: errmsg= ER_UNKNOWN_TARGET_BINLOG; break;
|
||||
case LOG_INFO_IO: errmsg= ER_IO_ERR_LOG_INDEX_READ; break;
|
||||
case LOG_INFO_INVALID:errmsg= ER_BINLOG_PURGE_PROHIBITED; break;
|
||||
case LOG_INFO_SEEK: errmsg= ER_FSEEK_FAIL; break;
|
||||
case LOG_INFO_MEM: errmsg= ER_OUT_OF_RESOURCES; break;
|
||||
case LOG_INFO_FATAL: errmsg= ER_BINLOG_PURGE_FATAL_ERR; break;
|
||||
case LOG_INFO_IN_USE: errmsg= ER_LOG_IN_USE; break;
|
||||
default: errmsg= ER_LOG_PURGE_UNKNOWN_ERR; break;
|
||||
}
|
||||
|
||||
if (errmsg)
|
||||
{
|
||||
send_error(thd, 0, errmsg);
|
||||
return 1;
|
||||
my_message(errmsg, ER(errmsg), MYF(0));
|
||||
return TRUE;
|
||||
}
|
||||
send_ok(thd);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int purge_master_logs(THD* thd, const char* to_log)
|
||||
bool purge_master_logs(THD* thd, const char* to_log)
|
||||
{
|
||||
char search_file_name[FN_REFLEN];
|
||||
if (!mysql_bin_log.is_open())
|
||||
{
|
||||
send_ok(thd);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mysql_bin_log.make_log_name(search_file_name, to_log);
|
||||
|
@ -320,7 +318,7 @@ int purge_master_logs(THD* thd, const char* to_log)
|
|||
}
|
||||
|
||||
|
||||
int purge_master_logs_before_date(THD* thd, time_t purge_time)
|
||||
bool purge_master_logs_before_date(THD* thd, time_t purge_time)
|
||||
{
|
||||
if (!mysql_bin_log.is_open())
|
||||
{
|
||||
|
@ -756,7 +754,7 @@ err:
|
|||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
if (file >= 0)
|
||||
(void) my_close(file, MYF(MY_WME));
|
||||
send_error(thd, my_errno, errmsg);
|
||||
my_message(my_errno, errmsg, MYF(0));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -872,7 +870,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
|
|||
if (slave_errno)
|
||||
{
|
||||
if (net_report)
|
||||
send_error(thd, slave_errno);
|
||||
my_message(slave_errno, ER(slave_errno), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
else if (net_report)
|
||||
|
@ -922,7 +920,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
|
|||
if (slave_errno)
|
||||
{
|
||||
if (net_report)
|
||||
send_error(thd, slave_errno);
|
||||
my_message(slave_errno, ER(slave_errno), MYF(0));
|
||||
return 1;
|
||||
}
|
||||
else if (net_report)
|
||||
|
@ -1003,8 +1001,8 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
|
|||
|
||||
err:
|
||||
unlock_slave_threads(mi);
|
||||
if (error)
|
||||
my_error(sql_errno, MYF(0), errmsg);
|
||||
if (error)
|
||||
my_printf_error(sql_errno, ER(sql_errno), MYF(0), errmsg);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
@ -1057,7 +1055,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
|
|||
}
|
||||
|
||||
|
||||
int change_master(THD* thd, MASTER_INFO* mi)
|
||||
bool change_master(THD* thd, MASTER_INFO* mi)
|
||||
{
|
||||
int thread_mask;
|
||||
const char* errmsg= 0;
|
||||
|
@ -1068,9 +1066,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
|||
init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
|
||||
if (thread_mask) // We refuse if any slave thread is running
|
||||
{
|
||||
net_printf(thd,ER_SLAVE_MUST_STOP);
|
||||
my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
|
||||
unlock_slave_threads(mi);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
thd->proc_info = "Changing master";
|
||||
|
@ -1078,9 +1076,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
|||
// TODO: see if needs re-write
|
||||
if (init_master_info(mi, master_info_file, relay_log_info_file, 0))
|
||||
{
|
||||
send_error(thd, ER_MASTER_INFO);
|
||||
my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
|
||||
unlock_slave_threads(mi);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1197,9 +1195,10 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
|||
0 /* not only reset, but also reinit */,
|
||||
&errmsg))
|
||||
{
|
||||
net_printf(thd, 0, "Failed purging old relay logs: %s",errmsg);
|
||||
my_printf_error(ER_RELAY_LOG_FAIL, ER(ER_RELAY_LOG_FAIL), MYF(0),
|
||||
errmsg);
|
||||
unlock_slave_threads(mi);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1213,9 +1212,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
|||
0 /*no data lock*/,
|
||||
&msg, 0))
|
||||
{
|
||||
net_printf(thd,0,"Failed initializing relay log position: %s",msg);
|
||||
my_printf_error(ER_RELAY_LOG_INIT, ER(ER_RELAY_LOG_INIT), MYF(0), msg);
|
||||
unlock_slave_threads(mi);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
mi->rli.group_master_log_pos = mi->master_log_pos;
|
||||
|
@ -1257,14 +1256,15 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
|||
unlock_slave_threads(mi);
|
||||
thd->proc_info = 0;
|
||||
send_ok(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
int reset_master(THD* thd)
|
||||
{
|
||||
if (!mysql_bin_log.is_open())
|
||||
{
|
||||
my_error(ER_FLUSH_MASTER_BINLOG_CLOSED, MYF(ME_BELL+ME_WAITTANG));
|
||||
my_message(ER_FLUSH_MASTER_BINLOG_CLOSED,
|
||||
ER(ER_FLUSH_MASTER_BINLOG_CLOSED), MYF(ME_BELL+ME_WAITTANG));
|
||||
return 1;
|
||||
}
|
||||
return mysql_bin_log.reset_logs(thd);
|
||||
|
@ -1288,7 +1288,7 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
|
|||
}
|
||||
|
||||
|
||||
int show_binlog_events(THD* thd)
|
||||
bool show_binlog_events(THD* thd)
|
||||
{
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("show_binlog_events");
|
||||
|
@ -1302,7 +1302,7 @@ int show_binlog_events(THD* thd)
|
|||
Log_event::init_show_field_list(&field_list);
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
|
@ -1406,20 +1406,21 @@ err:
|
|||
|
||||
if (errmsg)
|
||||
{
|
||||
my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
|
||||
"SHOW BINLOG EVENTS", errmsg);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_ERROR_WHEN_EXECUTING_COMMAND,
|
||||
ER(ER_ERROR_WHEN_EXECUTING_COMMAND), MYF(0),
|
||||
"SHOW BINLOG EVENTS", errmsg);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
send_eof(thd);
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->current_linfo = 0;
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
int show_binlog_info(THD* thd)
|
||||
bool show_binlog_info(THD* thd)
|
||||
{
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("show_binlog_info");
|
||||
|
@ -1432,7 +1433,7 @@ int show_binlog_info(THD* thd)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
protocol->prepare_for_resend();
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
|
@ -1445,10 +1446,10 @@ int show_binlog_info(THD* thd)
|
|||
protocol->store(&binlog_do_db);
|
||||
protocol->store(&binlog_ignore_db);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1460,11 +1461,11 @@ int show_binlog_info(THD* thd)
|
|||
thd Thread specific variable
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
1 error (Error message sent to client)
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int show_binlogs(THD* thd)
|
||||
bool show_binlogs(THD* thd)
|
||||
{
|
||||
IO_CACHE *index_file;
|
||||
char fname[FN_REFLEN];
|
||||
|
@ -1475,15 +1476,14 @@ int show_binlogs(THD* thd)
|
|||
|
||||
if (!mysql_bin_log.is_open())
|
||||
{
|
||||
//TODO: Replace with ER() error message
|
||||
send_error(thd, 0, "You are not using binary logging");
|
||||
my_message(ER_NO_BINARY_LOGGING, ER(ER_NO_BINARY_LOGGING), MYF(0));
|
||||
return 1;
|
||||
}
|
||||
|
||||
field_list.push_back(new Item_empty_string("Log_name", 255));
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
mysql_bin_log.lock_index();
|
||||
index_file=mysql_bin_log.get_index_file();
|
||||
|
||||
|
@ -1501,11 +1501,11 @@ int show_binlogs(THD* thd)
|
|||
}
|
||||
mysql_bin_log.unlock_index();
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
err:
|
||||
mysql_bin_log.unlock_index();
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,17 +43,17 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
|
|||
|
||||
int start_slave(THD* thd, MASTER_INFO* mi, bool net_report);
|
||||
int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report);
|
||||
int change_master(THD* thd, MASTER_INFO* mi);
|
||||
int show_binlog_events(THD* thd);
|
||||
bool change_master(THD* thd, MASTER_INFO* mi);
|
||||
bool show_binlog_events(THD* thd);
|
||||
int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
|
||||
const char* log_file_name2, ulonglong log_pos2);
|
||||
int reset_slave(THD *thd, MASTER_INFO* mi);
|
||||
int reset_master(THD* thd);
|
||||
int purge_master_logs(THD* thd, const char* to_log);
|
||||
int purge_master_logs_before_date(THD* thd, time_t purge_time);
|
||||
bool purge_master_logs(THD* thd, const char* to_log);
|
||||
bool purge_master_logs_before_date(THD* thd, time_t purge_time);
|
||||
bool log_in_use(const char* log_name);
|
||||
void adjust_linfo_offsets(my_off_t purge_offset);
|
||||
int show_binlogs(THD* thd);
|
||||
bool show_binlogs(THD* thd);
|
||||
extern int init_master_info(MASTER_INFO* mi);
|
||||
void kill_zombie_dump_threads(uint32 slave_server_id);
|
||||
int check_binlog_magic(IO_CACHE* log, const char** errmsg);
|
||||
|
|
|
@ -205,9 +205,9 @@ static void add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab);
|
|||
This handles SELECT with and without UNION
|
||||
*/
|
||||
|
||||
int handle_select(THD *thd, LEX *lex, select_result *result)
|
||||
bool handle_select(THD *thd, LEX *lex, select_result *result)
|
||||
{
|
||||
int res;
|
||||
bool res;
|
||||
register SELECT_LEX *select_lex = &lex->select_lex;
|
||||
DBUG_ENTER("handle_select");
|
||||
|
||||
|
@ -232,11 +232,14 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
|
|||
}
|
||||
DBUG_PRINT("info",("res: %d report_error: %d", res,
|
||||
thd->net.report_error));
|
||||
if (thd->net.report_error || res < 0)
|
||||
res|= thd->net.report_error;
|
||||
if (unlikely(res))
|
||||
{
|
||||
result->send_error(0, NullS);
|
||||
/*
|
||||
If we have real error reported erly then this will be ignored
|
||||
*/
|
||||
result->send_error(ER_UNKNOWN_ERROR, NullS);
|
||||
result->abort();
|
||||
res= 1; // Error sent to client
|
||||
}
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
@ -374,7 +377,8 @@ JOIN::prepare(Item ***rref_pointer_array,
|
|||
}
|
||||
if (flag == 3)
|
||||
{
|
||||
my_error(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,MYF(0));
|
||||
my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
|
||||
ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
|
@ -401,21 +405,22 @@ JOIN::prepare(Item ***rref_pointer_array,
|
|||
{
|
||||
if (!test_if_subpart(procedure->group,group_list))
|
||||
{ /* purecov: inspected */
|
||||
my_message(0,"Can't handle procedures with differents groups yet",
|
||||
MYF(0)); /* purecov: inspected */
|
||||
my_message(ER_DIFF_GROUPS_PROC, ER(ER_DIFF_GROUPS_PROC),
|
||||
MYF(0)); /* purecov: inspected */
|
||||
goto err; /* purecov: inspected */
|
||||
}
|
||||
}
|
||||
#ifdef NOT_NEEDED
|
||||
else if (!group_list && procedure->flags & PROC_GROUP)
|
||||
{
|
||||
my_message(0,"Select must have a group with this procedure",MYF(0));
|
||||
my_message(ER_NO_GROUP_FOR_PROC, MYF(0));
|
||||
goto err;
|
||||
}
|
||||
#endif
|
||||
if (order && (procedure->flags & PROC_NO_SORT))
|
||||
{ /* purecov: inspected */
|
||||
my_message(0,"Can't use order with this procedure",MYF(0)); /* purecov: inspected */
|
||||
my_message(ER_ORDER_WITH_PROC, ER(ER_ORDER_WITH_PROC),
|
||||
MYF(0)); /* purecov: inspected */
|
||||
goto err; /* purecov: inspected */
|
||||
}
|
||||
}
|
||||
|
@ -1803,7 +1808,7 @@ Cursor::fetch(ulong num_rows)
|
|||
|
||||
if (thd->killed) /* Aborted by user */
|
||||
{
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0));
|
||||
my_message(ER_SERVER_SHUTDOWN, ER(ER_SERVER_SHUTDOWN), MYF(0));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1940,7 +1945,7 @@ Cursor::~Cursor()
|
|||
/*********************************************************************/
|
||||
|
||||
|
||||
int
|
||||
bool
|
||||
mysql_select(THD *thd, Item ***rref_pointer_array,
|
||||
TABLE_LIST *tables, uint wild_num, List<Item> &fields,
|
||||
COND *conds, uint og_num, ORDER *order, ORDER *group,
|
||||
|
@ -1948,7 +1953,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
|
|||
select_result *result, SELECT_LEX_UNIT *unit,
|
||||
SELECT_LEX *select_lex)
|
||||
{
|
||||
int err;
|
||||
bool err;
|
||||
bool free_join= 1;
|
||||
DBUG_ENTER("mysql_select");
|
||||
|
||||
|
@ -1956,7 +1961,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
|
|||
if (select_lex->join != 0)
|
||||
{
|
||||
join= select_lex->join;
|
||||
// is it single SELECT in derived table, called in derived table creation
|
||||
/*
|
||||
is it single SELECT in derived table, called in derived table
|
||||
creation
|
||||
*/
|
||||
if (select_lex->linkage != DERIVED_TABLE_TYPE ||
|
||||
(select_options & SELECT_DESCRIBE))
|
||||
{
|
||||
|
@ -1965,7 +1973,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
|
|||
//here is EXPLAIN of subselect or derived table
|
||||
if (join->change_result(result))
|
||||
{
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1984,7 +1992,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
|
|||
else
|
||||
{
|
||||
if (!(join= new JOIN(thd, fields, select_options, result)))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
thd->proc_info="init";
|
||||
thd->used_tables=0; // Updated by setup_fields
|
||||
if (join->prepare(rref_pointer_array, tables, wild_num,
|
||||
|
@ -2032,10 +2040,8 @@ err:
|
|||
{
|
||||
thd->proc_info="end";
|
||||
err= join->cleanup();
|
||||
if (thd->net.report_error)
|
||||
err= -1;
|
||||
delete join;
|
||||
DBUG_RETURN(err);
|
||||
DBUG_RETURN(err || thd->net.report_error);
|
||||
}
|
||||
DBUG_RETURN(join->error);
|
||||
}
|
||||
|
@ -2192,7 +2198,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
|
|||
if (s->dependent & s->table->map)
|
||||
{
|
||||
join->tables=0; // Don't use join->table
|
||||
my_error(ER_WRONG_OUTER_JOIN,MYF(0));
|
||||
my_message(ER_WRONG_OUTER_JOIN, ER(ER_WRONG_OUTER_JOIN), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
s->key_dependent= s->dependent;
|
||||
|
@ -5614,7 +5620,8 @@ bool error_if_full_join(JOIN *join)
|
|||
{
|
||||
if (tab->type == JT_ALL && (!tab->select || !tab->select->quick))
|
||||
{
|
||||
my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,MYF(0));
|
||||
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
|
||||
ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
@ -10717,7 +10724,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
|
|||
}
|
||||
if (copy_blobs(first_field))
|
||||
{
|
||||
my_error(ER_OUTOFMEMORY,MYF(0));
|
||||
my_message(ER_OUTOFMEMORY, ER(ER_OUTOFMEMORY), MYF(0));
|
||||
error=0;
|
||||
goto err;
|
||||
}
|
||||
|
@ -12736,10 +12743,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
|
|||
}
|
||||
|
||||
|
||||
int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
|
||||
bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
|
||||
{
|
||||
DBUG_ENTER("mysql_explain_union");
|
||||
int res= 0;
|
||||
bool res= 0;
|
||||
SELECT_LEX *first= unit->first_select();
|
||||
|
||||
for (SELECT_LEX *sl= first;
|
||||
|
@ -12790,9 +12797,7 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
|
|||
first->options | thd->options | SELECT_DESCRIBE,
|
||||
result, unit, first);
|
||||
}
|
||||
if (res > 0 || thd->net.report_error)
|
||||
res= -1; // mysql_explain_select do not report error
|
||||
DBUG_RETURN(res);
|
||||
DBUG_RETURN(res || thd->net.report_error);
|
||||
}
|
||||
|
||||
|
||||
|
@ -13003,17 +13008,17 @@ void st_select_lex::print(THD *thd, String *str)
|
|||
res new select_result object
|
||||
|
||||
RETURN
|
||||
0 - OK
|
||||
-1 - error
|
||||
FALSE - OK
|
||||
TRUE - error
|
||||
*/
|
||||
|
||||
int JOIN::change_result(select_result *res)
|
||||
bool JOIN::change_result(select_result *res)
|
||||
{
|
||||
DBUG_ENTER("JOIN::change_result");
|
||||
result= res;
|
||||
if (!procedure && result->prepare(fields_list, select_lex->master_unit()))
|
||||
{
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ class JOIN :public Sql_alloc
|
|||
return (do_send_rows && tmp_table_param.sum_func_count != 0 &&
|
||||
!group_list);
|
||||
}
|
||||
int change_result(select_result *result);
|
||||
bool change_result(select_result *result);
|
||||
};
|
||||
|
||||
|
||||
|
|
205
sql/sql_show.cc
205
sql/sql_show.cc
|
@ -48,7 +48,7 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *packet);
|
|||
A database is a directory in the mysql_data_home directory
|
||||
*/
|
||||
|
||||
int
|
||||
bool
|
||||
mysqld_show_dbs(THD *thd,const char *wild)
|
||||
{
|
||||
Item_string *field=new Item_string("",0,thd->charset());
|
||||
|
@ -68,9 +68,9 @@ mysqld_show_dbs(THD *thd,const char *wild)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
if (mysql_find_files(thd,&files,NullS,mysql_data_home,wild,1))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
List_iterator_fast<char> it(files);
|
||||
|
||||
while ((file_name=it++))
|
||||
|
@ -84,11 +84,11 @@ mysqld_show_dbs(THD *thd,const char *wild)
|
|||
protocol->prepare_for_resend();
|
||||
protocol->store(file_name, system_charset_info);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,7 +96,7 @@ mysqld_show_dbs(THD *thd,const char *wild)
|
|||
List all open tables in a database
|
||||
***************************************************************************/
|
||||
|
||||
int mysqld_show_open_tables(THD *thd,const char *wild)
|
||||
bool mysqld_show_open_tables(THD *thd,const char *wild)
|
||||
{
|
||||
List<Item> field_list;
|
||||
OPEN_TABLE_LIST *open_list;
|
||||
|
@ -110,10 +110,10 @@ int mysqld_show_open_tables(THD *thd,const char *wild)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (!(open_list=list_open_tables(thd,wild)) && thd->is_fatal_error)
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
for (; open_list ; open_list=open_list->next)
|
||||
{
|
||||
|
@ -124,11 +124,11 @@ int mysqld_show_open_tables(THD *thd,const char *wild)
|
|||
protocol->store_tiny((longlong) open_list->locked);
|
||||
if (protocol->write())
|
||||
{
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,7 +137,7 @@ int mysqld_show_open_tables(THD *thd,const char *wild)
|
|||
** A table is a .frm file in the current databasedir
|
||||
***************************************************************************/
|
||||
|
||||
int mysqld_show_tables(THD *thd, const char *db, const char *wild,
|
||||
bool mysqld_show_tables(THD *thd, const char *db, const char *wild,
|
||||
bool show_type)
|
||||
{
|
||||
Item_string *field=new Item_string("",0,thd->charset());
|
||||
|
@ -162,10 +162,9 @@ int mysqld_show_tables(THD *thd, const char *db, const char *wild,
|
|||
if (show_type)
|
||||
field_list.push_back(new Item_empty_string("Table_type", 10));
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
if (mysql_find_files(thd,&files,db,path,wild,0))
|
||||
DBUG_RETURN(-1);
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF) ||
|
||||
mysql_find_files(thd,&files,db,path,wild,0))
|
||||
DBUG_RETURN(TRUE);
|
||||
List_iterator_fast<char> it(files);
|
||||
while ((file_name=it++))
|
||||
{
|
||||
|
@ -190,17 +189,17 @@ int mysqld_show_tables(THD *thd, const char *db, const char *wild,
|
|||
}
|
||||
}
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** List all table types supported
|
||||
***************************************************************************/
|
||||
|
||||
int mysqld_show_storage_engines(THD *thd)
|
||||
bool mysqld_show_storage_engines(THD *thd)
|
||||
{
|
||||
List<Item> field_list;
|
||||
Protocol *protocol= thd->protocol;
|
||||
|
@ -212,7 +211,7 @@ int mysqld_show_storage_engines(THD *thd)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
const char *default_type_name=
|
||||
ha_get_storage_engine((enum db_type)thd->variables.table_type);
|
||||
|
@ -230,10 +229,10 @@ int mysqld_show_storage_engines(THD *thd)
|
|||
protocol->store(option_name, system_charset_info);
|
||||
protocol->store(types->comment, system_charset_info);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -275,7 +274,7 @@ static struct show_privileges_st sys_privileges[]=
|
|||
{NullS, NullS, NullS}
|
||||
};
|
||||
|
||||
int mysqld_show_privileges(THD *thd)
|
||||
bool mysqld_show_privileges(THD *thd)
|
||||
{
|
||||
List<Item> field_list;
|
||||
Protocol *protocol= thd->protocol;
|
||||
|
@ -287,7 +286,7 @@ int mysqld_show_privileges(THD *thd)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
show_privileges_st *privilege= sys_privileges;
|
||||
for (privilege= sys_privileges; privilege->privilege ; privilege++)
|
||||
|
@ -297,10 +296,10 @@ int mysqld_show_privileges(THD *thd)
|
|||
protocol->store(privilege->context, system_charset_info);
|
||||
protocol->store(privilege->comment, system_charset_info);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -340,7 +339,7 @@ static struct show_column_type_st sys_column_types[]=
|
|||
"A very small integer"},
|
||||
};
|
||||
|
||||
int mysqld_show_column_types(THD *thd)
|
||||
bool mysqld_show_column_types(THD *thd)
|
||||
{
|
||||
List<Item> field_list;
|
||||
Protocol *protocol= thd->protocol;
|
||||
|
@ -363,7 +362,7 @@ int mysqld_show_column_types(THD *thd)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/* TODO: Change the loop to not use 'i' */
|
||||
for (uint i=0; i < sizeof(sys_column_types)/sizeof(sys_column_types[0]); i++)
|
||||
|
@ -384,10 +383,10 @@ int mysqld_show_column_types(THD *thd)
|
|||
protocol->store(sys_column_types[i].default_value, system_charset_info);
|
||||
protocol->store(sys_column_types[i].comment, system_charset_info);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -486,7 +485,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
|
|||
Extended version of mysqld_show_tables
|
||||
***************************************************************************/
|
||||
|
||||
int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
||||
bool mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
||||
{
|
||||
Item *item;
|
||||
List<char> files;
|
||||
|
@ -496,7 +495,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
|||
TABLE *table;
|
||||
Protocol *protocol= thd->protocol;
|
||||
TIME time;
|
||||
int res;
|
||||
bool res;
|
||||
DBUG_ENTER("mysqld_extend_show_tables");
|
||||
|
||||
(void) sprintf(path,"%s/%s",mysql_data_home,db);
|
||||
|
@ -537,11 +536,9 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
|||
field_list.push_back(item=new Item_empty_string("Comment",80));
|
||||
item->maybe_null=1;
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (mysql_find_files(thd,&files,db,path,wild,0))
|
||||
DBUG_RETURN(-1);
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF) ||
|
||||
mysql_find_files(thd,&files,db,path,wild,0))
|
||||
DBUG_RETURN(TRUE);
|
||||
List_iterator_fast<char> it(files);
|
||||
while ((file_name=it++))
|
||||
{
|
||||
|
@ -558,14 +555,12 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
|||
{
|
||||
for (uint i=2 ; i < field_list.elements ; i++)
|
||||
protocol->store_null();
|
||||
// Send error to Comment field if possible
|
||||
if (res < 0)
|
||||
// Send error to Comment field
|
||||
if (res)
|
||||
{
|
||||
protocol->store(thd->net.last_error, system_charset_info);
|
||||
thd->clear_error();
|
||||
}
|
||||
else
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
else if (table_list.view)
|
||||
{
|
||||
|
@ -680,10 +675,10 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
|||
}
|
||||
close_thread_tables(thd, 0);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -691,7 +686,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
|||
** List all columns in a table_list->real_name
|
||||
***************************************************************************/
|
||||
|
||||
int
|
||||
bool
|
||||
mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
||||
bool verbose)
|
||||
{
|
||||
|
@ -707,11 +702,9 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
|||
table_list->real_name));
|
||||
|
||||
table_list->lock_type= TL_UNLOCK;
|
||||
if ((res= open_and_lock_tables(thd, table_list)))
|
||||
if (open_and_lock_tables(thd, table_list))
|
||||
{
|
||||
if (res < 0)
|
||||
send_error(thd);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
table= table_list->table;
|
||||
file=table->file;
|
||||
|
@ -737,7 +730,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
|||
// Send first number of fields and records
|
||||
if (protocol->send_records_num(&field_list, (ulonglong)file->records) ||
|
||||
protocol->send_fields(&field_list, Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
restore_record(table,default_values); // Get empty record
|
||||
|
||||
Field **ptr,*field;
|
||||
|
@ -846,16 +839,16 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
|||
system_charset_info);
|
||||
}
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bool
|
||||
mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
||||
{
|
||||
TABLE *table;
|
||||
|
@ -868,18 +861,16 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
|||
table_list->real_name));
|
||||
|
||||
/* Only one table for now, but VIEW can involve several tables */
|
||||
if ((res= open_and_lock_tables(thd, table_list)))
|
||||
if (open_and_lock_tables(thd, table_list))
|
||||
{
|
||||
if (res < 0)
|
||||
send_error(thd);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
/* TODO: add environment variables show when it become possible */
|
||||
if (thd->lex->only_view && !table_list->view)
|
||||
{
|
||||
my_error(ER_WRONG_OBJECT, MYF(0), table_list->db,
|
||||
table_list->real_name, "VIEW");
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
|
||||
table_list->db, table_list->real_name, "VIEW");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
table= table_list->table;
|
||||
|
@ -887,7 +878,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
|||
if ((table_list->view ?
|
||||
view_store_create_info(thd, table_list, &buffer) :
|
||||
store_create_info(thd, table, &buffer)))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
List<Item> field_list;
|
||||
if (table_list->view)
|
||||
|
@ -906,31 +897,31 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
protocol->prepare_for_resend();
|
||||
buffer.length(0);
|
||||
if (table_list->view)
|
||||
{
|
||||
protocol->store(table_list->view_name.str, system_charset_info);
|
||||
if (view_store_create_info(thd, table_list, &buffer))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
protocol->store(table->table_name, system_charset_info);
|
||||
if (store_create_info(thd, table, &buffer))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
|
||||
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
int mysqld_show_create_db(THD *thd, char *dbname,
|
||||
HA_CREATE_INFO *create_info)
|
||||
bool mysqld_show_create_db(THD *thd, char *dbname,
|
||||
HA_CREATE_INFO *create_info)
|
||||
{
|
||||
int length;
|
||||
char path[FN_REFLEN];
|
||||
|
@ -947,8 +938,8 @@ int mysqld_show_create_db(THD *thd, char *dbname,
|
|||
|
||||
if (check_db_name(dbname))
|
||||
{
|
||||
net_printf(thd,ER_WRONG_DB_NAME, dbname);
|
||||
DBUG_RETURN(1);
|
||||
my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), dbname);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
|
@ -959,11 +950,12 @@ int mysqld_show_create_db(THD *thd, char *dbname,
|
|||
thd->master_access);
|
||||
if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
|
||||
{
|
||||
net_printf(thd,ER_DBACCESS_DENIED_ERROR,
|
||||
thd->priv_user, thd->host_or_ip, dbname);
|
||||
my_printf_error(ER_DBACCESS_DENIED_ERROR,
|
||||
ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
|
||||
thd->priv_user, thd->host_or_ip, dbname);
|
||||
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
|
||||
thd->priv_user, thd->host_or_ip, dbname);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -977,8 +969,8 @@ int mysqld_show_create_db(THD *thd, char *dbname,
|
|||
}
|
||||
if (access(path,F_OK))
|
||||
{
|
||||
net_printf(thd,ER_BAD_DB_ERROR,dbname);
|
||||
DBUG_RETURN(1);
|
||||
my_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0), dbname);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (found_libchar)
|
||||
path[length-1]= FN_LIBCHAR;
|
||||
|
@ -991,7 +983,7 @@ int mysqld_show_create_db(THD *thd, char *dbname,
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(dbname, strlen(dbname), system_charset_info);
|
||||
|
@ -1016,12 +1008,12 @@ int mysqld_show_create_db(THD *thd, char *dbname,
|
|||
protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
|
||||
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
mysqld_show_logs(THD *thd)
|
||||
{
|
||||
List<Item> field_list;
|
||||
|
@ -1034,19 +1026,19 @@ mysqld_show_logs(THD *thd)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
#ifdef HAVE_BERKELEY_DB
|
||||
if ((have_berkeley_db == SHOW_OPTION_YES) && berkeley_show_logs(protocol))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
#endif
|
||||
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bool
|
||||
mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
|
||||
{
|
||||
TABLE *table;
|
||||
|
@ -1057,8 +1049,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
|
|||
|
||||
if (!(table = open_ltable(thd, table_list, TL_UNLOCK)))
|
||||
{
|
||||
send_error(thd);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
List<Item> field_list;
|
||||
|
@ -1084,7 +1075,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
KEY *key_info=table->key_info;
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_TIME);
|
||||
|
@ -1135,11 +1126,11 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
|
|||
else
|
||||
protocol->store("", 0, system_charset_info);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
}
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1157,12 +1148,8 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
|
|||
DBUG_PRINT("enter",("table: %s",table_list->real_name));
|
||||
|
||||
table_list->lock_type= TL_UNLOCK;
|
||||
if ((res= open_and_lock_tables(thd, table_list)))
|
||||
{
|
||||
if (res < 0)
|
||||
send_error(thd);
|
||||
if (open_and_lock_tables(thd, table_list))
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
table= table_list->table;
|
||||
|
||||
List<Item> field_list;
|
||||
|
@ -1828,7 +1815,7 @@ static bool write_collation(Protocol *protocol, CHARSET_INFO *cs)
|
|||
return protocol->write();
|
||||
}
|
||||
|
||||
int mysqld_show_collations(THD *thd, const char *wild)
|
||||
bool mysqld_show_collations(THD *thd, const char *wild)
|
||||
{
|
||||
char buff[8192];
|
||||
String packet2(buff,sizeof(buff),thd->charset());
|
||||
|
@ -1836,7 +1823,7 @@ int mysqld_show_collations(THD *thd, const char *wild)
|
|||
CHARSET_INFO **cs;
|
||||
Protocol *protocol= thd->protocol;
|
||||
|
||||
DBUG_ENTER("mysqld_show_charsets");
|
||||
DBUG_ENTER(" mysqld_show_collations");
|
||||
|
||||
field_list.push_back(new Item_empty_string("Collation",30));
|
||||
field_list.push_back(new Item_empty_string("Charset",30));
|
||||
|
@ -1847,7 +1834,7 @@ int mysqld_show_collations(THD *thd, const char *wild)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ )
|
||||
{
|
||||
|
@ -1868,10 +1855,10 @@ int mysqld_show_collations(THD *thd, const char *wild)
|
|||
}
|
||||
}
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(FALSE);
|
||||
err:
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
static bool write_charset(Protocol *protocol, CHARSET_INFO *cs)
|
||||
|
@ -1884,7 +1871,7 @@ static bool write_charset(Protocol *protocol, CHARSET_INFO *cs)
|
|||
return protocol->write();
|
||||
}
|
||||
|
||||
int mysqld_show_charsets(THD *thd, const char *wild)
|
||||
bool mysqld_show_charsets(THD *thd, const char *wild)
|
||||
{
|
||||
char buff[8192];
|
||||
String packet2(buff,sizeof(buff),thd->charset());
|
||||
|
@ -1901,7 +1888,7 @@ int mysqld_show_charsets(THD *thd, const char *wild)
|
|||
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ )
|
||||
{
|
||||
|
@ -1914,18 +1901,18 @@ int mysqld_show_charsets(THD *thd, const char *wild)
|
|||
goto err;
|
||||
}
|
||||
}
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(FALSE);
|
||||
err:
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
||||
enum enum_var_type value_type,
|
||||
pthread_mutex_t *mutex,
|
||||
struct system_status_var *status_var)
|
||||
bool mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
||||
enum enum_var_type value_type,
|
||||
pthread_mutex_t *mutex,
|
||||
struct system_status_var *status_var)
|
||||
{
|
||||
char buff[1024];
|
||||
List<Item> field_list;
|
||||
|
@ -1937,7 +1924,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
|||
field_list.push_back(new Item_empty_string("Value",256));
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
null_lex_str.str= 0; // For sys_var->value_ptr()
|
||||
null_lex_str.length= 0;
|
||||
|
||||
|
@ -2229,11 +2216,11 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
|||
}
|
||||
pthread_mutex_unlock(mutex);
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
err:
|
||||
pthread_mutex_unlock(mutex);
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
|
321
sql/sql_table.cc
321
sql/sql_table.cc
|
@ -63,15 +63,15 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
|
|||
Wait if global_read_lock (FLUSH TABLES WITH READ LOCK) is set.
|
||||
|
||||
RETURN
|
||||
0 ok. In this case ok packet is sent to user
|
||||
-1 Error (Error message given but not sent to user)
|
||||
FALSE OK. In this case ok packet is sent to user
|
||||
TRUE Error
|
||||
|
||||
*/
|
||||
|
||||
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
||||
my_bool drop_temporary)
|
||||
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
||||
my_bool drop_temporary)
|
||||
{
|
||||
int error= 0;
|
||||
bool error= FALSE;
|
||||
DBUG_ENTER("mysql_rm_table");
|
||||
|
||||
/* mark for close and remove all cached entries */
|
||||
|
@ -84,9 +84,10 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
|||
{
|
||||
if (thd->global_read_lock)
|
||||
{
|
||||
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0),
|
||||
tables->real_name);
|
||||
error= 1;
|
||||
my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,
|
||||
ER(ER_TABLE_NOT_LOCKED_FOR_WRITE), MYF(0),
|
||||
tables->real_name);
|
||||
error= TRUE;
|
||||
goto err;
|
||||
}
|
||||
while (global_read_lock && ! thd->killed)
|
||||
|
@ -106,9 +107,9 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
|||
pthread_mutex_unlock(&thd->mysys_var->mutex);
|
||||
|
||||
if (error)
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
send_ok(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -268,9 +269,10 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||
if (wrong_tables.length())
|
||||
{
|
||||
if (!foreign_key_error)
|
||||
my_error(ER_BAD_TABLE_ERROR,MYF(0), wrong_tables.c_ptr());
|
||||
my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
|
||||
wrong_tables.c_ptr());
|
||||
else
|
||||
my_error(ER_ROW_IS_REFERENCED, MYF(0));
|
||||
my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0));
|
||||
error= 1;
|
||||
}
|
||||
|
||||
|
@ -468,7 +470,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
|
||||
if (check_column_name(sql_field->field_name))
|
||||
{
|
||||
my_error(ER_WRONG_COLUMN_NAME, MYF(0), sql_field->field_name);
|
||||
my_printf_error(ER_WRONG_COLUMN_NAME, ER(ER_WRONG_COLUMN_NAME), MYF(0),
|
||||
sql_field->field_name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -485,7 +488,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
*/
|
||||
if (field_no < select_field_pos || dup_no >= select_field_pos)
|
||||
{
|
||||
my_error(ER_DUP_FIELDNAME,MYF(0),sql_field->field_name);
|
||||
my_printf_error(ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME), MYF(0),
|
||||
sql_field->field_name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
else
|
||||
|
@ -626,24 +630,27 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
}
|
||||
if (timestamps_with_niladic > 1)
|
||||
{
|
||||
my_error(ER_TOO_MUCH_AUTO_TIMESTAMP_COLS,MYF(0));
|
||||
my_message(ER_TOO_MUCH_AUTO_TIMESTAMP_COLS,
|
||||
ER(ER_TOO_MUCH_AUTO_TIMESTAMP_COLS), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (auto_increment > 1)
|
||||
{
|
||||
my_error(ER_WRONG_AUTO_KEY,MYF(0));
|
||||
my_message(ER_WRONG_AUTO_KEY, ER(ER_WRONG_AUTO_KEY), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (auto_increment &&
|
||||
(file->table_flags() & HA_NO_AUTO_INCREMENT))
|
||||
{
|
||||
my_error(ER_TABLE_CANT_HANDLE_AUTO_INCREMENT,MYF(0));
|
||||
my_message(ER_TABLE_CANT_HANDLE_AUTO_INCREMENT,
|
||||
ER(ER_TABLE_CANT_HANDLE_AUTO_INCREMENT), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
if (blob_columns && (file->table_flags() & HA_NO_BLOBS))
|
||||
{
|
||||
my_error(ER_TABLE_CANT_HANDLE_BLOB,MYF(0));
|
||||
my_message(ER_TABLE_CANT_HANDLE_BLOB, ER(ER_TABLE_CANT_HANDLE_BLOB),
|
||||
MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -669,9 +676,11 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
if (fk_key->ref_columns.elements &&
|
||||
fk_key->ref_columns.elements != fk_key->columns.elements)
|
||||
{
|
||||
my_error(ER_WRONG_FK_DEF, MYF(0), fk_key->name ? fk_key->name :
|
||||
"foreign key without name",
|
||||
ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
|
||||
my_printf_error(ER_WRONG_FK_DEF, ER(ER_WRONG_FK_DEF), MYF(0),
|
||||
(fk_key->name ?
|
||||
fk_key->name :
|
||||
"foreign key without name"),
|
||||
ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
continue;
|
||||
|
@ -685,7 +694,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
}
|
||||
if (key->name && strlen(key->name) > NAME_LEN)
|
||||
{
|
||||
my_error(ER_TOO_LONG_IDENT, MYF(0), key->name);
|
||||
my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
|
||||
key->name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
key_iterator2.rewind ();
|
||||
|
@ -725,7 +735,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
if (key->name && !tmp_table &&
|
||||
!my_strcasecmp(system_charset_info,key->name,primary_key_name))
|
||||
{
|
||||
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name);
|
||||
my_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX),
|
||||
MYF(0), key->name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
|
@ -793,7 +804,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
{
|
||||
if (!(file->table_flags() & HA_CAN_FULLTEXT))
|
||||
{
|
||||
my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0));
|
||||
my_message(ER_TABLE_CANT_HANDLE_FT, ER(ER_TABLE_CANT_HANDLE_FT),
|
||||
MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
|
@ -934,7 +946,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
}
|
||||
if (key->type == Key::SPATIAL)
|
||||
{
|
||||
my_error(ER_SPATIAL_CANT_HAVE_NULL, MYF(0));
|
||||
my_message(ER_SPATIAL_CANT_HAVE_NULL,
|
||||
ER(ER_SPATIAL_CANT_HAVE_NULL), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
|
@ -980,7 +993,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
(key_info->flags & HA_NOSAME))) &&
|
||||
column->length != length)))
|
||||
{
|
||||
my_error(ER_WRONG_SUB_KEY,MYF(0));
|
||||
my_message(ER_WRONG_SUB_KEY, ER(ER_WRONG_SUB_KEY), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
else if (!(file->table_flags() & HA_NO_PREFIX_CHAR_KEYS))
|
||||
|
@ -1033,7 +1046,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
{
|
||||
if (primary_key)
|
||||
{
|
||||
my_error(ER_MULTIPLE_PRI_KEY,MYF(0));
|
||||
my_message(ER_MULTIPLE_PRI_KEY, ER(ER_MULTIPLE_PRI_KEY),
|
||||
MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
key_name=primary_key_name;
|
||||
|
@ -1044,7 +1058,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
key_info_buffer,key_info);
|
||||
if (check_if_keyname_exists(key_name,key_info_buffer,key_info))
|
||||
{
|
||||
my_error(ER_DUP_KEYNAME,MYF(0),key_name);
|
||||
my_printf_error(ER_DUP_KEYNAME, ER(ER_DUP_KEYNAME), MYF(0),
|
||||
key_name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
key_info->name=(char*) key_name;
|
||||
|
@ -1052,7 +1067,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
}
|
||||
if (!key_info->name || check_column_name(key_info->name))
|
||||
{
|
||||
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key_info->name);
|
||||
my_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX),
|
||||
MYF(0), key_info->name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (!(key_info->flags & HA_NULL_PART_KEY))
|
||||
|
@ -1069,12 +1085,12 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
if (!unique_key && !primary_key &&
|
||||
(file->table_flags() & HA_REQUIRE_PRIMARY_KEY))
|
||||
{
|
||||
my_error(ER_REQUIRES_PRIMARY_KEY,MYF(0));
|
||||
my_message(ER_REQUIRES_PRIMARY_KEY, ER(ER_REQUIRES_PRIMARY_KEY), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (auto_increment > 0)
|
||||
{
|
||||
my_error(ER_WRONG_AUTO_KEY,MYF(0));
|
||||
my_message(ER_WRONG_AUTO_KEY, ER(ER_WRONG_AUTO_KEY), MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
/* Sort keys in optimized order */
|
||||
|
@ -1108,30 +1124,31 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
and must be zero for standard create of table.
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
-1 error
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
List<create_field> &fields,
|
||||
List<Key> &keys,bool tmp_table,
|
||||
uint select_field_count)
|
||||
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
List<create_field> &fields,
|
||||
List<Key> &keys,bool tmp_table,
|
||||
uint select_field_count)
|
||||
{
|
||||
char path[FN_REFLEN];
|
||||
const char *alias;
|
||||
int error= -1;
|
||||
uint db_options, key_count;
|
||||
KEY *key_info_buffer;
|
||||
handler *file;
|
||||
bool error= TRUE;
|
||||
enum db_type new_db_type;
|
||||
DBUG_ENTER("mysql_create_table");
|
||||
|
||||
/* Check for duplicate fields and check type of table to create */
|
||||
if (!fields.elements)
|
||||
{
|
||||
my_error(ER_TABLE_MUST_HAVE_COLUMNS,MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
|
||||
MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if ((new_db_type= ha_checktype(create_info->db_type)) !=
|
||||
create_info->db_type)
|
||||
|
@ -1160,8 +1177,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||
if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
|
||||
(file->table_flags() & HA_NO_TEMP_TABLES))
|
||||
{
|
||||
my_error(ER_ILLEGAL_HA,MYF(0),table_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0), table_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1186,7 +1203,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||
keys, tmp_table, db_options, file,
|
||||
key_info_buffer, &key_count,
|
||||
select_field_count))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/* Check if table exists */
|
||||
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
||||
|
@ -1209,10 +1226,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
|
||||
{
|
||||
create_info->table_existed= 1; // Mark that table existed
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), MYF(0),
|
||||
alias);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (wait_if_global_read_lock(thd, 0, 1))
|
||||
DBUG_RETURN(error);
|
||||
|
@ -1224,10 +1242,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
|
||||
{
|
||||
create_info->table_existed= 1; // Mark that table existed
|
||||
error= 0;
|
||||
error= FALSE;
|
||||
}
|
||||
else
|
||||
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR,
|
||||
ER(ER_TABLE_EXISTS_ERROR), MYF(0), table_name);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -1253,10 +1272,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||
if (create_if_not_exists)
|
||||
{
|
||||
create_info->table_existed= 1; // Mark that table existed
|
||||
error= 0;
|
||||
error= FALSE;
|
||||
}
|
||||
else
|
||||
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR,
|
||||
ER(ER_TABLE_EXISTS_ERROR), MYF(0), table_name);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -1292,7 +1312,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||
HA_LEX_CREATE_TMP_TABLE));
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
error=0;
|
||||
error= FALSE;
|
||||
end:
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
start_waiting_global_read_lock(thd);
|
||||
|
@ -1475,7 +1495,8 @@ mysql_rename_table(enum db_type base,
|
|||
}
|
||||
delete file;
|
||||
if (error)
|
||||
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
|
||||
my_printf_error(ER_ERROR_ON_RENAME, ER(ER_ERROR_ON_RENAME),
|
||||
MYF(0), from, to, error);
|
||||
DBUG_RETURN(error != 0);
|
||||
}
|
||||
|
||||
|
@ -1565,7 +1586,7 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table,
|
|||
protocol->store((char*) operator_name, system_charset_info);
|
||||
protocol->store("error", 5, system_charset_info);
|
||||
protocol->store(errmsg, system_charset_info);
|
||||
thd->net.last_error[0]=0;
|
||||
thd->clear_error();
|
||||
if (protocol->write())
|
||||
return -1;
|
||||
return 1;
|
||||
|
@ -1742,20 +1763,20 @@ end:
|
|||
|
||||
/*
|
||||
RETURN VALUES
|
||||
0 Message sent to net (admin operation went ok)
|
||||
-1 Message should be sent by caller
|
||||
(admin operation or network communication failed)
|
||||
FALSE Message sent to net (admin operation went ok)
|
||||
TRUE Message should be sent by caller
|
||||
(admin operation or network communication failed)
|
||||
*/
|
||||
static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
HA_CHECK_OPT* check_opt,
|
||||
const char *operator_name,
|
||||
thr_lock_type lock_type,
|
||||
bool open_for_modify,
|
||||
uint extra_open_options,
|
||||
int (*prepare_func)(THD *, TABLE_LIST *,
|
||||
HA_CHECK_OPT *),
|
||||
int (handler::*operator_func)
|
||||
(THD *, HA_CHECK_OPT *))
|
||||
static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
HA_CHECK_OPT* check_opt,
|
||||
const char *operator_name,
|
||||
thr_lock_type lock_type,
|
||||
bool open_for_modify,
|
||||
uint extra_open_options,
|
||||
int (*prepare_func)(THD *, TABLE_LIST *,
|
||||
HA_CHECK_OPT *),
|
||||
int (handler::*operator_func)
|
||||
(THD *, HA_CHECK_OPT *))
|
||||
{
|
||||
TABLE_LIST *table;
|
||||
List<Item> field_list;
|
||||
|
@ -1773,7 +1794,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
item->maybe_null = 1;
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
mysql_ha_flush(thd, tables, MYSQL_HA_CLOSE_FINAL);
|
||||
for (table= tables; table; table= table->next_local)
|
||||
|
@ -1785,9 +1806,6 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
|
||||
thd->open_options|= extra_open_options;
|
||||
table->table = open_ltable(thd, table, lock_type);
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
thd->net.last_errno= 0; // these errors shouldn't get client
|
||||
#endif
|
||||
thd->open_options&= ~extra_open_options;
|
||||
|
||||
if (prepare_func)
|
||||
|
@ -1813,7 +1831,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
if (!(err_msg=thd->net.last_error))
|
||||
err_msg=ER(ER_CHECK_NO_SUCH_TABLE);
|
||||
protocol->store(err_msg, system_charset_info);
|
||||
thd->net.last_error[0]=0;
|
||||
thd->clear_error();
|
||||
if (protocol->write())
|
||||
goto err;
|
||||
continue;
|
||||
|
@ -1857,9 +1875,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
}
|
||||
|
||||
int result_code = (table->table->file->*operator_func)(thd, check_opt);
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
thd->net.last_errno= 0; // these errors shouldn't get client
|
||||
#endif
|
||||
thd->clear_error(); // these errors shouldn't get client
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
|
@ -1960,16 +1976,16 @@ send_result_message:
|
|||
}
|
||||
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
err:
|
||||
close_thread_tables(thd); // Shouldn't be needed
|
||||
if (table)
|
||||
table->table=0;
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
int mysql_backup_table(THD* thd, TABLE_LIST* table_list)
|
||||
bool mysql_backup_table(THD* thd, TABLE_LIST* table_list)
|
||||
{
|
||||
DBUG_ENTER("mysql_backup_table");
|
||||
DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
|
||||
|
@ -1978,7 +1994,7 @@ int mysql_backup_table(THD* thd, TABLE_LIST* table_list)
|
|||
}
|
||||
|
||||
|
||||
int mysql_restore_table(THD* thd, TABLE_LIST* table_list)
|
||||
bool mysql_restore_table(THD* thd, TABLE_LIST* table_list)
|
||||
{
|
||||
DBUG_ENTER("mysql_restore_table");
|
||||
DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
|
||||
|
@ -1988,7 +2004,7 @@ int mysql_restore_table(THD* thd, TABLE_LIST* table_list)
|
|||
}
|
||||
|
||||
|
||||
int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
DBUG_ENTER("mysql_repair_table");
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
|
||||
|
@ -1998,7 +2014,7 @@ int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
|||
}
|
||||
|
||||
|
||||
int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
bool mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
DBUG_ENTER("mysql_optimize_table");
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
|
||||
|
@ -2016,11 +2032,11 @@ int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
|||
tables Table list (one table only)
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
-1 error
|
||||
FALSE ok
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
|
||||
bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
|
||||
LEX_STRING *key_cache_name)
|
||||
{
|
||||
HA_CHECK_OPT check_opt;
|
||||
|
@ -2032,8 +2048,9 @@ int mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
|
|||
if (!(key_cache= get_key_cache(key_cache_name)))
|
||||
{
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_UNKNOWN_KEY_CACHE, ER(ER_UNKNOWN_KEY_CACHE), MYF(0),
|
||||
key_cache_name->str);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
check_opt.key_cache= key_cache;
|
||||
|
@ -2091,11 +2108,11 @@ int reassign_keycache_tables(THD *thd, KEY_CACHE *src_cache,
|
|||
tables Table list (one table only)
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
-1 error
|
||||
FALSE ok
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int mysql_preload_keys(THD* thd, TABLE_LIST* tables)
|
||||
bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
|
||||
{
|
||||
DBUG_ENTER("mysql_preload_keys");
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, 0,
|
||||
|
@ -2115,13 +2132,13 @@ int mysql_preload_keys(THD* thd, TABLE_LIST* tables)
|
|||
table_ident Src table_ident
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
-1 error
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
|
||||
int mysql_create_like_table(THD* thd, TABLE_LIST* table,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Table_ident *table_ident)
|
||||
bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Table_ident *table_ident)
|
||||
{
|
||||
TABLE **tmp_table;
|
||||
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
|
||||
|
@ -2129,7 +2146,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
|
|||
char *table_name= table->real_name;
|
||||
char *src_db= thd->db;
|
||||
char *src_table= table_ident->table.str;
|
||||
int err, res= -1;
|
||||
int err;
|
||||
bool res= TRUE;
|
||||
TABLE_LIST src_tables_list;
|
||||
DBUG_ENTER("mysql_create_like_table");
|
||||
|
||||
|
@ -2141,8 +2159,9 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
|
|||
check_table_name(src_table,table_ident->table.length)) ||
|
||||
table_ident->db.str && check_db_name((src_db= table_ident->db.str)))
|
||||
{
|
||||
my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0),
|
||||
src_table);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
bzero((gptr)&src_tables_list, sizeof(src_tables_list));
|
||||
|
@ -2160,7 +2179,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
|
|||
reg_ext, NullS);
|
||||
if (access(src_path, F_OK))
|
||||
{
|
||||
my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table);
|
||||
my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
|
||||
src_table);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -2229,7 +2249,7 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
|
|||
HA_LEX_CREATE_TMP_TABLE));
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
res= 0;
|
||||
res= FALSE;
|
||||
goto err;
|
||||
|
||||
table_exists:
|
||||
|
@ -2240,10 +2260,11 @@ table_exists:
|
|||
ER(ER_TABLE_EXISTS_ERROR), table_name);
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||
ER_TABLE_EXISTS_ERROR,warn_buff);
|
||||
res= 0;
|
||||
res= FALSE;
|
||||
}
|
||||
else
|
||||
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), MYF(0),
|
||||
table_name);
|
||||
|
||||
err:
|
||||
pthread_mutex_lock(&LOCK_open);
|
||||
|
@ -2253,7 +2274,7 @@ err:
|
|||
}
|
||||
|
||||
|
||||
int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
bool mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
#ifdef OS2
|
||||
thr_lock_type lock_type = TL_WRITE;
|
||||
|
@ -2268,7 +2289,7 @@ int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
|||
}
|
||||
|
||||
|
||||
int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
|
||||
bool mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
#ifdef OS2
|
||||
thr_lock_type lock_type = TL_WRITE;
|
||||
|
@ -2502,7 +2523,8 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
|
|||
}
|
||||
if (idx>= table->keys)
|
||||
{
|
||||
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), drop_key->name);
|
||||
my_printf_error(ER_CANT_DROP_FIELD_OR_KEY, ER(ER_CANT_DROP_FIELD_OR_KEY),
|
||||
MYF(0), drop_key->name);
|
||||
/*don't need to free((gptr) key_numbers);*/
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
@ -2559,13 +2581,13 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
|
|||
Alter table
|
||||
*/
|
||||
|
||||
int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
TABLE_LIST *table_list,
|
||||
List<create_field> &fields, List<Key> &keys,
|
||||
uint order_num, ORDER *order,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
ALTER_INFO *alter_info, bool do_send_ok)
|
||||
bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
HA_CREATE_INFO *create_info,
|
||||
TABLE_LIST *table_list,
|
||||
List<create_field> &fields, List<Key> &keys,
|
||||
uint order_num, ORDER *order,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
ALTER_INFO *alter_info, bool do_send_ok)
|
||||
{
|
||||
TABLE *table,*new_table=0;
|
||||
int error;
|
||||
|
@ -2594,7 +2616,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list,
|
||||
alter_info->tablespace_op));
|
||||
if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ)))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/* Check that we are not trying to rename to an existing table */
|
||||
if (new_name)
|
||||
|
@ -2625,8 +2647,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
{
|
||||
if (find_temporary_table(thd,new_db,new_name_buff))
|
||||
{
|
||||
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_name_buff);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
|
||||
MYF(0), new_name_buff);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2637,8 +2660,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
F_OK))
|
||||
{
|
||||
/* Table will be closed in do_command() */
|
||||
my_error(ER_TABLE_EXISTS_ERROR,MYF(0), new_alias);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
|
||||
MYF(0), new_alias);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2678,7 +2702,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
error=0;
|
||||
if (!access(new_name_buff,F_OK))
|
||||
{
|
||||
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_name);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
|
||||
MYF(0), new_name);
|
||||
error= -1;
|
||||
}
|
||||
else
|
||||
|
@ -2822,8 +2847,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
{
|
||||
if (def->sql_type == FIELD_TYPE_BLOB)
|
||||
{
|
||||
my_error(ER_BLOB_CANT_HAVE_DEFAULT,MYF(0),def->change);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_BLOB_CANT_HAVE_DEFAULT,
|
||||
ER(ER_BLOB_CANT_HAVE_DEFAULT), MYF(0), def->change);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
def->def=alter->def; // Use new default
|
||||
alter_it.remove();
|
||||
|
@ -2836,8 +2862,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
{
|
||||
if (def->change && ! def->field)
|
||||
{
|
||||
my_error(ER_BAD_FIELD_ERROR,MYF(0),def->change,table_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
|
||||
def->change, table_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (!def->after)
|
||||
create_list.push_back(def);
|
||||
|
@ -2854,22 +2881,24 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
}
|
||||
if (!find)
|
||||
{
|
||||
my_error(ER_BAD_FIELD_ERROR,MYF(0),def->after,table_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR),
|
||||
MYF(0), def->after, table_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
find_it.after(def); // Put element after this
|
||||
}
|
||||
}
|
||||
if (alter_info->alter_list.elements)
|
||||
{
|
||||
my_error(ER_BAD_FIELD_ERROR,MYF(0),alter_info->alter_list.head()->name,
|
||||
table_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
|
||||
alter_info->alter_list.head()->name, table_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (!create_list.elements)
|
||||
{
|
||||
my_error(ER_CANT_REMOVE_ALL_FIELDS,MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
my_message(ER_CANT_REMOVE_ALL_FIELDS, ER(ER_CANT_REMOVE_ALL_FIELDS),
|
||||
MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2957,22 +2986,25 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
if (key->name &&
|
||||
!my_strcasecmp(system_charset_info,key->name,primary_key_name))
|
||||
{
|
||||
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX),
|
||||
MYF(0), key->name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (alter_info->drop_list.elements)
|
||||
{
|
||||
my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0),
|
||||
alter_info->drop_list.head()->name);
|
||||
my_printf_error(ER_CANT_DROP_FIELD_OR_KEY,
|
||||
ER(ER_CANT_DROP_FIELD_OR_KEY), MYF(0),
|
||||
alter_info->drop_list.head()->name);
|
||||
goto err;
|
||||
}
|
||||
if (alter_info->alter_list.elements)
|
||||
{
|
||||
my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0),
|
||||
alter_info->alter_list.head()->name);
|
||||
my_printf_error(ER_CANT_DROP_FIELD_OR_KEY,
|
||||
ER(ER_CANT_DROP_FIELD_OR_KEY), MYF(0),
|
||||
alter_info->alter_list.head()->name);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -3175,7 +3207,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
if (!access(new_name_buff,F_OK))
|
||||
{
|
||||
error=1;
|
||||
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_name_buff);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
|
||||
MYF(0), new_name_buff);
|
||||
VOID(quick_rm_table(new_db_type,new_db,tmp_name));
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
goto err;
|
||||
|
@ -3313,10 +3346,10 @@ end_temporary:
|
|||
if (do_send_ok)
|
||||
send_ok(thd,copied+deleted,0L,tmp_name);
|
||||
thd->some_tables_deleted=0;
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
err:
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3502,8 +3535,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
|||
RETURN
|
||||
Like mysql_alter_table().
|
||||
*/
|
||||
int mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
|
||||
bool do_send_ok)
|
||||
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
|
||||
bool do_send_ok)
|
||||
{
|
||||
DBUG_ENTER("mysql_recreate_table");
|
||||
LEX *lex= thd->lex;
|
||||
|
@ -3525,7 +3558,7 @@ int mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
|
|||
}
|
||||
|
||||
|
||||
int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
|
||||
bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
|
||||
{
|
||||
TABLE_LIST *table;
|
||||
List<Item> field_list;
|
||||
|
@ -3539,7 +3572,7 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
|
|||
item->maybe_null= 1;
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
for (table= tables; table; table= table->next_local)
|
||||
{
|
||||
|
@ -3558,7 +3591,7 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
|
|||
{
|
||||
/* Table didn't exist */
|
||||
protocol->store_null();
|
||||
thd->net.last_error[0]=0;
|
||||
thd->clear_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3620,11 +3653,11 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
|
|||
}
|
||||
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
err:
|
||||
close_thread_tables(thd); // Shouldn't be needed
|
||||
if (table)
|
||||
table->table=0;
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
|
|
@ -38,12 +38,13 @@ static File_option triggers_file_parameters[]=
|
|||
methods.
|
||||
|
||||
RETURN VALUE
|
||||
0 - Success, non-0 in case of error.
|
||||
FALSE Success
|
||||
TRUE error
|
||||
*/
|
||||
int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
||||
bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
||||
{
|
||||
TABLE *table;
|
||||
int result= 0;
|
||||
bool result= 0;
|
||||
|
||||
DBUG_ENTER("mysql_create_or_drop_trigger");
|
||||
|
||||
|
@ -53,7 +54,7 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
|||
*/
|
||||
|
||||
if (open_and_lock_tables(thd, tables))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/*
|
||||
TODO: We should check if user has TRIGGER privilege for table here.
|
||||
|
@ -61,7 +62,7 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
|||
we don't have proper privilege checking for triggers in place yet.
|
||||
*/
|
||||
if (check_global_access(thd, SUPER_ACL))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
table= tables->table;
|
||||
|
||||
|
@ -73,20 +74,21 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
|||
*/
|
||||
if (tables->view || table->tmp_table != NO_TMP_TABLE)
|
||||
{
|
||||
my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE,
|
||||
ER(ER_TRG_ON_VIEW_OR_TEMP_TABLE), MYF(0), tables->alias);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if (!table->triggers)
|
||||
{
|
||||
if (!create)
|
||||
{
|
||||
my_error(ER_TRG_DOES_NOT_EXIST, MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
my_message(ER_TRG_DOES_NOT_EXIST, ER(ER_TRG_DOES_NOT_EXIST), MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if (!(table->triggers= new (&table->mem_root) Table_triggers_list()))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -96,12 +98,12 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
|||
global read lock is held without helding LOCK_open).
|
||||
*/
|
||||
if (wait_if_global_read_lock(thd, 0, 0))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
if ((create ? table->triggers->create_trigger(thd, tables):
|
||||
table->triggers->drop_trigger(thd, tables)))
|
||||
result= -1;
|
||||
result= (create ?
|
||||
table->triggers->create_trigger(thd, tables):
|
||||
table->triggers->drop_trigger(thd, tables));
|
||||
|
||||
/* It is sensible to invalidate table in any case */
|
||||
close_cached_table(thd, table);
|
||||
|
@ -140,7 +142,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
|
|||
/* We don't allow creation of several triggers of the same type yet */
|
||||
if (bodies[lex->trg_chistics.event][lex->trg_chistics.action_time])
|
||||
{
|
||||
my_error(ER_TRG_ALREADY_EXISTS, MYF(0));
|
||||
my_message(ER_TRG_ALREADY_EXISTS, ER(ER_TRG_ALREADY_EXISTS), MYF(0));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -150,7 +152,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
|
|||
if (my_strcasecmp(system_charset_info, lex->name_and_length.str,
|
||||
name->str) == 0)
|
||||
{
|
||||
my_error(ER_TRG_ALREADY_EXISTS, MYF(0));
|
||||
my_message(ER_TRG_ALREADY_EXISTS, ER(ER_TRG_ALREADY_EXISTS), MYF(0));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +258,7 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables)
|
|||
}
|
||||
}
|
||||
|
||||
my_error(ER_TRG_DOES_NOT_EXIST, MYF(0));
|
||||
my_message(ER_TRG_DOES_NOT_EXIST, ER(ER_TRG_DOES_NOT_EXIST), MYF(0));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -416,8 +418,8 @@ err_with_lex_cleanup:
|
|||
We don't care about this error message much because .TRG files will
|
||||
be merged into .FRM anyway.
|
||||
*/
|
||||
my_error(ER_WRONG_OBJECT, MYF(0), table_name, triggers_file_ext,
|
||||
"TRIGGER");
|
||||
my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
|
||||
table_name, triggers_file_ext, "TRIGGER");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
|||
|
||||
if (!initialized)
|
||||
{
|
||||
send_error(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES));
|
||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
@ -379,19 +379,20 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
|||
*/
|
||||
if (strchr(udf->dl, '/'))
|
||||
{
|
||||
send_error(thd, ER_UDF_NO_PATHS,ER(ER_UDF_NO_PATHS));
|
||||
my_message(ER_UDF_NO_PATHS, ER(ER_UDF_NO_PATHS), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (udf->name.length > NAME_LEN)
|
||||
{
|
||||
net_printf(thd, ER_TOO_LONG_IDENT,udf->name);
|
||||
my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
|
||||
udf->name);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
rw_wrlock(&THR_LOCK_udf);
|
||||
if ((hash_search(&udf_hash,(byte*) udf->name.str, udf->name.length)))
|
||||
{
|
||||
net_printf(thd, ER_UDF_EXISTS, udf->name);
|
||||
my_printf_error(ER_UDF_EXISTS, ER(ER_UDF_EXISTS), MYF(0), udf->name);
|
||||
goto err;
|
||||
}
|
||||
if (!(dl = find_udf_dl(udf->dl)))
|
||||
|
@ -400,7 +401,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
|||
{
|
||||
DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)",
|
||||
udf->dl,errno,dlerror()));
|
||||
net_printf(thd, ER_CANT_OPEN_LIBRARY, udf->dl, errno, dlerror());
|
||||
my_printf_error(ER_CANT_OPEN_LIBRARY, ER(ER_CANT_OPEN_LIBRARY), MYF(0),
|
||||
udf->dl, errno, dlerror());
|
||||
goto err;
|
||||
}
|
||||
new_dl=1;
|
||||
|
@ -410,16 +412,14 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
|||
|
||||
if (udf->func == NULL)
|
||||
{
|
||||
net_printf(thd, ER_CANT_FIND_DL_ENTRY, udf->name);
|
||||
my_printf_error(ER_CANT_FIND_DL_ENTRY, ER(ER_CANT_FIND_DL_ENTRY), MYF(0),
|
||||
udf->name);
|
||||
goto err;
|
||||
}
|
||||
udf->name.str=strdup_root(&mem,udf->name.str);
|
||||
udf->dl=strdup_root(&mem,udf->dl);
|
||||
if (!(u_d=add_udf(&udf->name,udf->returns,udf->dl,udf->type)))
|
||||
{
|
||||
send_error(thd,0); // End of memory
|
||||
goto err;
|
||||
}
|
||||
u_d->dlhandle = dl;
|
||||
u_d->func=udf->func;
|
||||
u_d->func_init=udf->func_init;
|
||||
|
@ -447,7 +447,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
|||
close_thread_tables(thd);
|
||||
if (error)
|
||||
{
|
||||
net_printf(thd, ER_ERROR_ON_WRITE, "func@mysql",error);
|
||||
my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0),
|
||||
"func@mysql", error);
|
||||
del_udf(u_d);
|
||||
goto err;
|
||||
}
|
||||
|
@ -470,14 +471,15 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
|
|||
DBUG_ENTER("mysql_drop_function");
|
||||
if (!initialized)
|
||||
{
|
||||
send_error(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES));
|
||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
rw_wrlock(&THR_LOCK_udf);
|
||||
if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str,
|
||||
(uint) udf_name->length)))
|
||||
{
|
||||
net_printf(thd, ER_FUNCTION_NOT_DEFINED, udf_name->str);
|
||||
my_printf_error(ER_FUNCTION_NOT_DEFINED, ER(ER_FUNCTION_NOT_DEFINED),
|
||||
MYF(0), udf_name->str);
|
||||
goto err;
|
||||
}
|
||||
del_udf(udf);
|
||||
|
|
|
@ -24,21 +24,20 @@
|
|||
#include "mysql_priv.h"
|
||||
#include "sql_select.h"
|
||||
|
||||
int mysql_union(THD *thd, LEX *lex, select_result *result,
|
||||
SELECT_LEX_UNIT *unit)
|
||||
bool mysql_union(THD *thd, LEX *lex, select_result *result,
|
||||
SELECT_LEX_UNIT *unit)
|
||||
{
|
||||
DBUG_ENTER("mysql_union");
|
||||
int res, res_cln;
|
||||
bool res;
|
||||
if (!(res= unit->prepare(thd, result, SELECT_NO_UNLOCK)))
|
||||
res= unit->exec();
|
||||
if (res == 0 && thd->cursor && thd->cursor->is_open())
|
||||
if (!res && thd->cursor && thd->cursor->is_open())
|
||||
{
|
||||
thd->cursor->set_unit(unit);
|
||||
res_cln= 0;
|
||||
}
|
||||
else
|
||||
res_cln= unit->cleanup();
|
||||
DBUG_RETURN(res?res:res_cln);
|
||||
res|= unit->cleanup();
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,7 +75,7 @@ bool select_union::send_data(List<Item> &values)
|
|||
unit->offset_limit_cnt--;
|
||||
return 0;
|
||||
}
|
||||
fill_record(table->field, values, 1);
|
||||
fill_record(thd, table->field, values, 1);
|
||||
if (thd->net.report_error || write_record(thd, table,&info))
|
||||
{
|
||||
if (thd->net.last_errno == ER_RECORD_FILE_FULL)
|
||||
|
@ -104,8 +103,7 @@ bool select_union::flush()
|
|||
int error;
|
||||
if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
|
||||
{
|
||||
table->file->print_error(error,MYF(0));
|
||||
::send_error(thd);
|
||||
table->file->print_error(error, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -147,8 +145,8 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd)
|
|||
}
|
||||
|
||||
|
||||
int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
||||
ulong additional_options)
|
||||
bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
||||
ulong additional_options)
|
||||
{
|
||||
SELECT_LEX *lex_select_save= thd_arg->lex->current_select;
|
||||
SELECT_LEX *sl, *first_select;
|
||||
|
@ -177,16 +175,16 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||
if (!sl->join->procedure &&
|
||||
result->prepare(sl->join->fields_list, this))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
sl->join->select_options|= SELECT_DESCRIBE;
|
||||
sl->join->reinit();
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
prepared= 1;
|
||||
res= 0;
|
||||
res= FALSE;
|
||||
|
||||
thd_arg->lex->current_select= sl= first_select= first_select_in_union();
|
||||
found_rows_for_union= first_select->options & OPTION_FOUND_ROWS;
|
||||
|
@ -239,7 +237,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||
sl->with_wild= 0;
|
||||
last_procedure= join->procedure;
|
||||
|
||||
if (res || thd_arg->is_fatal_error)
|
||||
if ((res= (res || thd_arg->is_fatal_error)))
|
||||
goto err;
|
||||
if (sl == first_select)
|
||||
{
|
||||
|
@ -269,7 +267,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||
while ((type= tp++, item_tmp= it++))
|
||||
{
|
||||
if (((Item_type_holder*)type)->join_types(thd_arg, item_tmp))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,7 +323,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||
{
|
||||
if (tmp_arena)
|
||||
thd->restore_backup_item_arena(tmp_arena, &backup);
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
if (tmp_arena)
|
||||
|
@ -343,7 +341,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||
result)))
|
||||
{
|
||||
fake_select_lex->table_list.empty();
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
fake_select_lex->item_list= item_list;
|
||||
|
||||
|
@ -378,15 +376,15 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||
|
||||
thd_arg->lex->current_select= lex_select_save;
|
||||
|
||||
DBUG_RETURN(res || thd_arg->is_fatal_error ? 1 : 0);
|
||||
DBUG_RETURN(res || thd_arg->is_fatal_error);
|
||||
|
||||
err:
|
||||
thd_arg->lex->current_select= lex_select_save;
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
int st_select_lex_unit::exec()
|
||||
bool st_select_lex_unit::exec()
|
||||
{
|
||||
SELECT_LEX *lex_select_save= thd->lex->current_select;
|
||||
SELECT_LEX *select_cursor=first_select_in_union();
|
||||
|
@ -395,7 +393,7 @@ int st_select_lex_unit::exec()
|
|||
DBUG_ENTER("st_select_lex_unit::exec");
|
||||
|
||||
if (executed && !uncacheable && !describe)
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
executed= 1;
|
||||
|
||||
if (uncacheable || !item || !item->assigned() || describe)
|
||||
|
@ -410,7 +408,7 @@ int st_select_lex_unit::exec()
|
|||
}
|
||||
/* re-enabling indexes for next subselect iteration */
|
||||
if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL))
|
||||
DBUG_ASSERT(1);
|
||||
DBUG_ASSERT(TRUE);
|
||||
}
|
||||
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
|
||||
{
|
||||
|
@ -465,7 +463,7 @@ int st_select_lex_unit::exec()
|
|||
if (sl == union_distinct)
|
||||
{
|
||||
if (table->file->disable_indexes(HA_KEY_SWITCH_ALL))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
table->no_keyread=1;
|
||||
}
|
||||
res= sl->join->error;
|
||||
|
@ -474,7 +472,7 @@ int st_select_lex_unit::exec()
|
|||
{
|
||||
examined_rows+= thd->examined_row_count;
|
||||
thd->lex->current_select= lex_select_save;
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
if (res)
|
||||
|
@ -500,7 +498,7 @@ int st_select_lex_unit::exec()
|
|||
optimized= 1;
|
||||
|
||||
/* Send result to 'result' */
|
||||
res= -1;
|
||||
res= TRUE;
|
||||
{
|
||||
List<Item_func_match> empty_list;
|
||||
empty_list.empty();
|
||||
|
@ -519,7 +517,7 @@ int st_select_lex_unit::exec()
|
|||
fake_select_lex->options, result)))
|
||||
{
|
||||
fake_select_lex->table_list.empty();
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -566,7 +564,7 @@ int st_select_lex_unit::exec()
|
|||
}
|
||||
|
||||
|
||||
int st_select_lex_unit::cleanup()
|
||||
bool st_select_lex_unit::cleanup()
|
||||
{
|
||||
int error= 0;
|
||||
JOIN *join;
|
||||
|
@ -574,7 +572,7 @@ int st_select_lex_unit::cleanup()
|
|||
|
||||
if (cleaned)
|
||||
{
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
cleaned= 1;
|
||||
|
||||
|
@ -648,19 +646,19 @@ void st_select_lex_unit::reinit_exec_mechanism()
|
|||
old_result old select_result object
|
||||
|
||||
RETURN
|
||||
0 - OK
|
||||
-1 - error
|
||||
FALSE - OK
|
||||
TRUE - error
|
||||
*/
|
||||
|
||||
int st_select_lex_unit::change_result(select_subselect *result,
|
||||
select_subselect *old_result)
|
||||
bool st_select_lex_unit::change_result(select_subselect *result,
|
||||
select_subselect *old_result)
|
||||
{
|
||||
int res= 0;
|
||||
bool res= FALSE;
|
||||
for (SELECT_LEX *sl= first_select_in_union(); sl; sl= sl->next_select())
|
||||
{
|
||||
if (sl->join && sl->join->result == old_result)
|
||||
if ((res= sl->join->change_result(result)))
|
||||
return (res);
|
||||
if (sl->join->change_result(result))
|
||||
return TRUE;
|
||||
}
|
||||
if (fake_select_lex && fake_select_lex->join)
|
||||
res= fake_select_lex->join->change_result(result);
|
||||
|
|
|
@ -73,7 +73,8 @@ static bool check_fields(THD *thd, List<Item> &items)
|
|||
if (!(field= item->filed_for_view_update()))
|
||||
{
|
||||
/* item has name, because it comes from VIEW SELECT list */
|
||||
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name);
|
||||
my_printf_error(ER_NONUPDATEABLE_COLUMN, ER(ER_NONUPDATEABLE_COLUMN),
|
||||
MYF(0), item->name);
|
||||
return TRUE;
|
||||
}
|
||||
/*
|
||||
|
@ -86,21 +87,21 @@ static bool check_fields(THD *thd, List<Item> &items)
|
|||
}
|
||||
|
||||
|
||||
int mysql_update(THD *thd,
|
||||
TABLE_LIST *table_list,
|
||||
List<Item> &fields,
|
||||
List<Item> &values,
|
||||
COND *conds,
|
||||
uint order_num, ORDER *order,
|
||||
ha_rows limit,
|
||||
enum enum_duplicates handle_duplicates)
|
||||
bool mysql_update(THD *thd,
|
||||
TABLE_LIST *table_list,
|
||||
List<Item> &fields,
|
||||
List<Item> &values,
|
||||
COND *conds,
|
||||
uint order_num, ORDER *order,
|
||||
ha_rows limit,
|
||||
enum enum_duplicates handle_duplicates)
|
||||
{
|
||||
bool using_limit= limit != HA_POS_ERROR;
|
||||
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
|
||||
bool used_key_is_modified, transactional_table, log_delayed;
|
||||
bool ignore_err= (thd->lex->duplicates == DUP_IGNORE);
|
||||
bool res;
|
||||
int error=0;
|
||||
int res;
|
||||
uint used_index;
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
uint want_privilege;
|
||||
|
@ -117,8 +118,8 @@ int mysql_update(THD *thd,
|
|||
LINT_INIT(used_index);
|
||||
LINT_INIT(timestamp_query_id);
|
||||
|
||||
if ((error= open_and_lock_tables(thd, table_list)))
|
||||
DBUG_RETURN(error);
|
||||
if (open_and_lock_tables(thd, table_list))
|
||||
DBUG_RETURN(TRUE);
|
||||
thd->proc_info="init";
|
||||
table= table_list->table;
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
|
@ -156,16 +157,17 @@ int mysql_update(THD *thd,
|
|||
res= setup_fields(thd, 0, table_list, fields, 1, 0, 0);
|
||||
select_lex->no_wrap_view_item= 0;
|
||||
if (res)
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
}
|
||||
if (table_list->view && check_fields(thd, fields))
|
||||
{
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (!table_list->updatable || check_key_in_view(thd, table_list))
|
||||
{
|
||||
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE");
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
|
||||
MYF(0), table_list->alias, "UPDATE");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (table->timestamp_field)
|
||||
{
|
||||
|
@ -184,7 +186,7 @@ int mysql_update(THD *thd,
|
|||
if (setup_fields(thd, 0, table_list, values, 0, 0, 0))
|
||||
{
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
}
|
||||
|
||||
// Don't count on usage of 'only index' when calculating which key to use
|
||||
|
@ -197,10 +199,10 @@ int mysql_update(THD *thd,
|
|||
free_underlaid_joins(thd, select_lex);
|
||||
if (error)
|
||||
{
|
||||
DBUG_RETURN(-1); // Error in where
|
||||
DBUG_RETURN(TRUE); // Error in where
|
||||
}
|
||||
send_ok(thd); // No matching records
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
/* If running in safe sql mode, don't allow updates without keys */
|
||||
if (table->quick_keys.is_clear_all())
|
||||
|
@ -362,8 +364,9 @@ int mysql_update(THD *thd,
|
|||
if (!(select && select->skip_record()))
|
||||
{
|
||||
store_record(table,record[1]);
|
||||
if (fill_record(fields,values, 0) || thd->net.report_error)
|
||||
if (fill_record(thd, fields, values, 0))
|
||||
break; /* purecov: inspected */
|
||||
|
||||
found++;
|
||||
|
||||
if (table->triggers)
|
||||
|
@ -457,9 +460,7 @@ int mysql_update(THD *thd,
|
|||
}
|
||||
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
if (error >= 0)
|
||||
send_error(thd,thd->killed_errno()); /* purecov: inspected */
|
||||
else
|
||||
if (error < 0)
|
||||
{
|
||||
char buff[80];
|
||||
sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,
|
||||
|
@ -473,7 +474,7 @@ int mysql_update(THD *thd,
|
|||
thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */
|
||||
thd->abort_on_warning= 0;
|
||||
free_io_cache(table);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(error >= 0 || thd->net.report_error);
|
||||
|
||||
err:
|
||||
delete select;
|
||||
|
@ -484,7 +485,7 @@ err:
|
|||
table->file->extra(HA_EXTRA_NO_KEYREAD);
|
||||
}
|
||||
thd->abort_on_warning= 0;
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -499,11 +500,10 @@ err:
|
|||
order - ORDER BY clause list
|
||||
|
||||
RETURN VALUE
|
||||
0 - OK
|
||||
1 - error (message is sent to user)
|
||||
-1 - error (message is not sent to user)
|
||||
FALSE OK
|
||||
TRUE error
|
||||
*/
|
||||
int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
||||
bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
||||
Item **conds, uint order_num, ORDER *order)
|
||||
{
|
||||
TABLE *table= table_list->table;
|
||||
|
@ -527,16 +527,17 @@ int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
|||
setup_order(thd, select_lex->ref_pointer_array,
|
||||
table_list, all_fields, all_fields, order) ||
|
||||
setup_ftfuncs(select_lex))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/* Check that we are not using table that we are updating in a sub select */
|
||||
if (unique_table(table_list, table_list->next_global))
|
||||
{
|
||||
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), MYF(0),
|
||||
table_list->real_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
select_lex->fix_prepare_information(thd, conds);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -569,11 +570,11 @@ static table_map get_table_map(List<Item> *items)
|
|||
thd thread handler
|
||||
|
||||
RETURN
|
||||
0 OK
|
||||
-1 Error
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
int mysql_multi_update_prepare(THD *thd)
|
||||
bool mysql_multi_update_prepare(THD *thd)
|
||||
{
|
||||
LEX *lex= thd->lex;
|
||||
ulong opened_tables;
|
||||
|
@ -619,7 +620,7 @@ int mysql_multi_update_prepare(THD *thd)
|
|||
res= setup_fields(thd, 0, table_list, *fields, 1, 0, 0),
|
||||
lex->select_lex.no_wrap_view_item= 0,
|
||||
res))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
for (tl= table_list; tl ; tl= tl->next_local)
|
||||
{
|
||||
|
@ -632,7 +633,7 @@ int mysql_multi_update_prepare(THD *thd)
|
|||
|
||||
if (update_view && check_fields(thd, *fields))
|
||||
{
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
tables_for_update= get_table_map(fields);
|
||||
|
@ -657,8 +658,10 @@ int mysql_multi_update_prepare(THD *thd)
|
|||
{
|
||||
if (!tl->updatable || check_key_in_view(thd, tl))
|
||||
{
|
||||
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), tl->alias, "UPDATE");
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_NON_UPDATABLE_TABLE,
|
||||
ER(ER_NON_UPDATABLE_TABLE), MYF(0),
|
||||
tl->alias, "UPDATE");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -668,8 +671,9 @@ int mysql_multi_update_prepare(THD *thd)
|
|||
if (lex->select_lex.check_updateable_in_subqueries(tl->db,
|
||||
tl->real_name))
|
||||
{
|
||||
my_error(ER_UPDATE_TABLE_USED, MYF(0), tl->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_UPDATE_TABLE_USED,
|
||||
ER(ER_UPDATE_TABLE_USED), MYF(0), tl->real_name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
DBUG_PRINT("info",("setting table `%s` for update", tl->alias));
|
||||
tl->lock_type= lex->multi_lock_option;
|
||||
|
@ -688,7 +692,7 @@ int mysql_multi_update_prepare(THD *thd)
|
|||
opened_tables= thd->status_var.opened_tables;
|
||||
/* now lock and fill tables */
|
||||
if (lock_tables(thd, table_list, table_count))
|
||||
DBUG_RETURN(thd->net.report_error ? -1 : 1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/*
|
||||
we have to re-call fixfields for fixed items, because lock maybe
|
||||
|
@ -719,12 +723,12 @@ int mysql_multi_update_prepare(THD *thd)
|
|||
res= setup_fields(thd, 0, table_list, *fields, 1, 0, 0),
|
||||
lex->select_lex.no_wrap_view_item= 0,
|
||||
res))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (thd->fill_derived_tables() &&
|
||||
mysql_handle_derived(lex, &mysql_derived_filling))
|
||||
DBUG_RETURN(thd->net.report_error ? -1 : 1);
|
||||
DBUG_RETURN (0);
|
||||
DBUG_RETURN (FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -732,16 +736,16 @@ int mysql_multi_update_prepare(THD *thd)
|
|||
Setup multi-update handling and call SELECT to do the join
|
||||
*/
|
||||
|
||||
int mysql_multi_update(THD *thd,
|
||||
TABLE_LIST *table_list,
|
||||
List<Item> *fields,
|
||||
List<Item> *values,
|
||||
COND *conds,
|
||||
ulong options,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
|
||||
bool mysql_multi_update(THD *thd,
|
||||
TABLE_LIST *table_list,
|
||||
List<Item> *fields,
|
||||
List<Item> *values,
|
||||
COND *conds,
|
||||
ulong options,
|
||||
enum enum_duplicates handle_duplicates,
|
||||
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
|
||||
{
|
||||
int res;
|
||||
bool res;
|
||||
multi_update *result;
|
||||
DBUG_ENTER("mysql_multi_update");
|
||||
|
||||
|
@ -750,7 +754,7 @@ int mysql_multi_update(THD *thd,
|
|||
|
||||
if (!(result= new multi_update(thd, table_list, fields, values,
|
||||
handle_duplicates)))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
thd->no_trans_update= 0;
|
||||
thd->abort_on_warning= test(thd->variables.sql_mode &
|
||||
|
@ -767,7 +771,7 @@ int mysql_multi_update(THD *thd,
|
|||
result, unit, select_lex);
|
||||
delete result;
|
||||
thd->abort_on_warning= 0;
|
||||
DBUG_RETURN(res);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -805,7 +809,7 @@ int multi_update::prepare(List<Item> ¬_used_values,
|
|||
|
||||
if (!tables_to_update)
|
||||
{
|
||||
my_error(ER_NO_TABLES_USED, MYF(0));
|
||||
my_message(ER_NO_TABLES_USED, ER(ER_NO_TABLES_USED), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
@ -1091,8 +1095,10 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
|||
{
|
||||
table->status|= STATUS_UPDATED;
|
||||
store_record(table,record[1]);
|
||||
if (fill_record(*fields_for_table[offset], *values_for_table[offset], 0))
|
||||
if (fill_record(thd, *fields_for_table[offset],
|
||||
*values_for_table[offset], 0))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
found++;
|
||||
if (compare_record(table, thd->query_id))
|
||||
{
|
||||
|
@ -1135,7 +1141,7 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
|||
{
|
||||
int error;
|
||||
TABLE *tmp_table= tmp_tables[offset];
|
||||
fill_record(tmp_table->field+1, *values_for_table[offset], 1);
|
||||
fill_record(thd, tmp_table->field+1, *values_for_table[offset], 1);
|
||||
found++;
|
||||
/* Store pointer to row */
|
||||
memcpy((char*) tmp_table->field[0]->ptr,
|
||||
|
@ -1161,7 +1167,7 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
|||
void multi_update::send_error(uint errcode,const char *err)
|
||||
{
|
||||
/* First send error what ever it is ... */
|
||||
::send_error(thd,errcode,err);
|
||||
my_error(errcode, MYF(0), err);
|
||||
|
||||
/* If nothing updated return */
|
||||
if (!updated)
|
||||
|
@ -1354,7 +1360,6 @@ bool multi_update::send_eof()
|
|||
/* Safety: If we haven't got an error before (should not happen) */
|
||||
my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update",
|
||||
MYF(0));
|
||||
::send_error(thd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,13 +42,12 @@ TYPELIB updatable_views_with_limit_typelib=
|
|||
mode - VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE
|
||||
|
||||
RETURN VALUE
|
||||
0 OK
|
||||
-1 Error
|
||||
1 Error and error message given
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
int mysql_create_view(THD *thd,
|
||||
enum_view_create_mode mode)
|
||||
bool mysql_create_view(THD *thd,
|
||||
enum_view_create_mode mode)
|
||||
{
|
||||
LEX *lex= thd->lex;
|
||||
bool link_to_local;
|
||||
|
@ -58,7 +57,7 @@ int mysql_create_view(THD *thd,
|
|||
TABLE_LIST *tbl;
|
||||
SELECT_LEX *select_lex= &lex->select_lex, *sl;
|
||||
SELECT_LEX_UNIT *unit= &lex->unit;
|
||||
int res= 0;
|
||||
bool res= FALSE;
|
||||
DBUG_ENTER("mysql_create_view");
|
||||
|
||||
if (lex->proc_list.first ||
|
||||
|
@ -67,16 +66,17 @@ int mysql_create_view(THD *thd,
|
|||
my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), (lex->result ?
|
||||
"INTO" :
|
||||
"PROCEDURE"));
|
||||
res= -1;
|
||||
res= TRUE;
|
||||
goto err;
|
||||
}
|
||||
if (lex->derived_tables ||
|
||||
lex->variables_used || lex->param_list.elements)
|
||||
{
|
||||
my_error((lex->derived_tables ?
|
||||
int err= (lex->derived_tables ?
|
||||
ER_VIEW_SELECT_DERIVED :
|
||||
ER_VIEW_SELECT_VARIABLE), MYF(0));
|
||||
res= -1;
|
||||
ER_VIEW_SELECT_VARIABLE);
|
||||
my_message(err, ER(err), MYF(0));
|
||||
res= TRUE;
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ int mysql_create_view(THD *thd,
|
|||
(check_access(thd, DELETE_ACL, view->db, &view->grant.privilege,
|
||||
0, 0) ||
|
||||
grant_option && check_grant(thd, DELETE_ACL, view, 0, 1, 0))))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(TRUE);
|
||||
for (sl= select_lex; sl; sl= sl->next_select())
|
||||
{
|
||||
for (tbl= sl->get_table_list(); tbl; tbl= tbl->next_local)
|
||||
|
@ -120,7 +120,7 @@ int mysql_create_view(THD *thd,
|
|||
thd->priv_user,
|
||||
thd->host_or_ip,
|
||||
tbl->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
/*
|
||||
Mark this table as a table which will be checked after the prepare
|
||||
|
@ -156,7 +156,7 @@ int mysql_create_view(THD *thd,
|
|||
&tbl->grant.privilege, 0, 0) ||
|
||||
grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0))
|
||||
{
|
||||
res= 1;
|
||||
res= TRUE;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -178,8 +178,8 @@ int mysql_create_view(THD *thd,
|
|||
}
|
||||
#endif
|
||||
|
||||
if ((res= open_and_lock_tables(thd, tables)))
|
||||
DBUG_RETURN(res);
|
||||
if (open_and_lock_tables(thd, tables))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/*
|
||||
check that tables are not temporary and this VIEW do not used in query
|
||||
|
@ -190,8 +190,9 @@ int mysql_create_view(THD *thd,
|
|||
/* is this table temporary and is not view? */
|
||||
if (tbl->table->tmp_table != NO_TMP_TABLE && !tbl->view)
|
||||
{
|
||||
my_error(ER_VIEW_SELECT_TMPTABLE, MYF(0), tbl->alias);
|
||||
res= -1;
|
||||
my_printf_error(ER_VIEW_SELECT_TMPTABLE,
|
||||
ER(ER_VIEW_SELECT_TMPTABLE), MYF(0), tbl->alias);
|
||||
res= TRUE;
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -200,8 +201,9 @@ int mysql_create_view(THD *thd,
|
|||
strcmp(tbl->view_db.str, view->db) == 0 &&
|
||||
strcmp(tbl->view_name.str, view->real_name) == 0)
|
||||
{
|
||||
my_error(ER_NO_SUCH_TABLE, MYF(0), tbl->view_db.str, tbl->view_name.str);
|
||||
res= -1;
|
||||
my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
|
||||
tbl->view_db.str, tbl->view_name.str);
|
||||
res= TRUE;
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -221,7 +223,7 @@ int mysql_create_view(THD *thd,
|
|||
some errors from prepare are reported to user, if is not then
|
||||
it will be checked after err: label
|
||||
*/
|
||||
res= 1;
|
||||
res= TRUE;
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -255,8 +257,9 @@ int mysql_create_view(THD *thd,
|
|||
{
|
||||
if (strcmp(item->name, check->name) == 0)
|
||||
{
|
||||
my_error(ER_DUP_FIELDNAME, MYF(0), item->name);
|
||||
DBUG_RETURN(-1);
|
||||
my_printf_error(ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME),
|
||||
MYF(0), item->name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +298,7 @@ int mysql_create_view(THD *thd,
|
|||
thd->host_or_ip,
|
||||
item->name,
|
||||
view->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +307,7 @@ int mysql_create_view(THD *thd,
|
|||
|
||||
if (wait_if_global_read_lock(thd, 0, 0))
|
||||
{
|
||||
res= -1;
|
||||
res= TRUE;
|
||||
goto err;
|
||||
}
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
|
@ -322,9 +325,7 @@ err:
|
|||
thd->proc_info= "end";
|
||||
lex->link_first_table_back(view, link_to_local);
|
||||
unit->cleanup();
|
||||
if (thd->net.report_error)
|
||||
res= -1;
|
||||
DBUG_RETURN(res);
|
||||
DBUG_RETURN(res || thd->net.report_error);
|
||||
}
|
||||
|
||||
|
||||
|
@ -431,7 +432,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
|||
{
|
||||
if (mode == VIEW_CREATE_NEW)
|
||||
{
|
||||
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), view->alias);
|
||||
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
|
||||
MYF(0), view->alias);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -441,8 +443,9 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
|||
if (!parser->ok() ||
|
||||
strncmp("VIEW", parser->type()->str, parser->type()->length))
|
||||
{
|
||||
my_error(ER_WRONG_OBJECT, MYF(0), (view->db ? view->db : thd->db),
|
||||
view->real_name, "VIEW");
|
||||
my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
|
||||
(view->db ? view->db : thd->db),
|
||||
view->real_name, "VIEW");
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -462,7 +465,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
|||
{
|
||||
if (mode == VIEW_ALTER)
|
||||
{
|
||||
my_error(ER_NO_SUCH_TABLE, MYF(0), view->db, view->alias);
|
||||
my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
|
||||
view->db, view->alias);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
|
@ -525,7 +529,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
|||
if (view->with_check != VIEW_CHECK_NONE &&
|
||||
!view->updatable_view)
|
||||
{
|
||||
my_error(ER_VIEW_NONUPD_CHECK, MYF(0), view->db, view->real_name);
|
||||
my_printf_error(ER_VIEW_NONUPD_CHECK, ER(ER_VIEW_NONUPD_CHECK), MYF(0),
|
||||
view->db, view->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -696,7 +701,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
|
|||
if (check_table_access(thd, SELECT_ACL, view_tables, 1) &&
|
||||
check_table_access(thd, SHOW_VIEW_ACL, table, 1))
|
||||
{
|
||||
my_error(ER_VIEW_NO_EXPLAIN, MYF(0));
|
||||
my_message(ER_VIEW_NO_EXPLAIN, ER(ER_VIEW_NO_EXPLAIN), MYF(0));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -845,12 +850,11 @@ err:
|
|||
drop_mode - cascade/check
|
||||
|
||||
RETURN VALUE
|
||||
0 OK
|
||||
-1 Error
|
||||
1 Error and error message given
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
int mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
||||
bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
||||
{
|
||||
DBUG_ENTER("mysql_drop_view");
|
||||
char path[FN_REFLEN];
|
||||
|
@ -876,9 +880,11 @@ int mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
|||
continue;
|
||||
}
|
||||
if (type)
|
||||
my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->real_name, "VIEW");
|
||||
my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
|
||||
view->db, view->real_name, "VIEW");
|
||||
else
|
||||
my_error(ER_BAD_TABLE_ERROR, MYF(0), name);
|
||||
my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
|
||||
name);
|
||||
goto err;
|
||||
}
|
||||
if (my_delete(path, MYF(MY_WME)))
|
||||
|
@ -886,11 +892,11 @@ int mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
|||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
}
|
||||
send_ok(thd);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
err:
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
int mysql_create_view(THD *thd,
|
||||
enum_view_create_mode mode);
|
||||
bool mysql_create_view(THD *thd,
|
||||
enum_view_create_mode mode);
|
||||
|
||||
my_bool mysql_make_view(File_parser *parser, TABLE_LIST *table);
|
||||
|
||||
int mysql_drop_view(THD *thd, TABLE_LIST *view, enum_drop_mode drop_mode);
|
||||
bool mysql_drop_view(THD *thd, TABLE_LIST *view, enum_drop_mode drop_mode);
|
||||
|
||||
bool check_key_in_view(THD *thd, TABLE_LIST * view);
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue