Commit 848235f7 authored by unknown's avatar unknown
Browse files

Merge BUG#15110 from 5.0 into 5.1.

Merge mysql.com:/home/alik/MySQL/devel/5.0-bug15110
into  mysql.com:/home/alik/MySQL/devel/5.1-bug15110


BitKeeper/etc/ignore:
  auto-union
client/mysqldump.c:
  Auto merged
include/mysql_com.h:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
mysql-test/r/type_time.result:
  Auto merged
sql/Makefile.am:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_trigger.cc:
  Auto merged
client/Makefile.am:
  Add my_user.c
include/Makefile.am:
  Add my_user.c
libmysqld/Makefile.am:
  Add my_user.c
mysql-test/t/disabled.def:
  Enable type_time.test
sql/sql_parse.cc:
  Merge.
parents 4a114543 9d2def68
Loading
Loading
Loading
Loading
+54 −118
Original line number Diff line number Diff line
@@ -133,107 +133,6 @@ autom4te.cache/*
autom4te.cache/output.0
autom4te.cache/requests
autom4te.cache/traces.0
storage/bdb/*.ds?
storage/bdb/*.vcproj
storage/bdb/README
storage/bdb/btree/btree_auto.c
storage/bdb/build_unix/*
storage/bdb/build_vxworks/db.h
storage/bdb/build_vxworks/db_int.h
storage/bdb/build_win32/db.h
storage/bdb/build_win32/db_archive.dsp
storage/bdb/build_win32/db_checkpoint.dsp
storage/bdb/build_win32/db_config.h
storage/bdb/build_win32/db_cxx.h
storage/bdb/build_win32/db_deadlock.dsp
storage/bdb/build_win32/db_dll.dsp
storage/bdb/build_win32/db_dump.dsp
storage/bdb/build_win32/db_int.h
storage/bdb/build_win32/db_java.dsp
storage/bdb/build_win32/db_load.dsp
storage/bdb/build_win32/db_perf.dsp
storage/bdb/build_win32/db_printlog.dsp
storage/bdb/build_win32/db_recover.dsp
storage/bdb/build_win32/db_stat.dsp
storage/bdb/build_win32/db_static.dsp
storage/bdb/build_win32/db_tcl.dsp
storage/bdb/build_win32/db_test.dsp
storage/bdb/build_win32/db_upgrade.dsp
storage/bdb/build_win32/db_verify.dsp
storage/bdb/build_win32/ex_access.dsp
storage/bdb/build_win32/ex_btrec.dsp
storage/bdb/build_win32/ex_env.dsp
storage/bdb/build_win32/ex_lock.dsp
storage/bdb/build_win32/ex_mpool.dsp
storage/bdb/build_win32/ex_tpcb.dsp
storage/bdb/build_win32/excxx_access.dsp
storage/bdb/build_win32/excxx_btrec.dsp
storage/bdb/build_win32/excxx_env.dsp
storage/bdb/build_win32/excxx_lock.dsp
storage/bdb/build_win32/excxx_mpool.dsp
storage/bdb/build_win32/excxx_tpcb.dsp
storage/bdb/build_win32/include.tcl
storage/bdb/build_win32/libdb.def
storage/bdb/build_win32/libdb.rc
storage/bdb/db/crdel_auto.c
storage/bdb/db/db_auto.c
storage/bdb/dbinc_auto/*.*
storage/bdb/dbreg/dbreg_auto.c
storage/bdb/dist/autom4te-2.53.cache/*
storage/bdb/dist/autom4te-2.53.cache/output.0
storage/bdb/dist/autom4te-2.53.cache/requests
storage/bdb/dist/autom4te-2.53.cache/traces.0
storage/bdb/dist/autom4te.cache/*
storage/bdb/dist/autom4te.cache/output.0
storage/bdb/dist/autom4te.cache/requests
storage/bdb/dist/autom4te.cache/traces.0
storage/bdb/dist/config.hin
storage/bdb/dist/configure
storage/bdb/dist/tags
storage/bdb/dist/template/db_server_proc
storage/bdb/dist/template/gen_client_ret
storage/bdb/dist/template/rec_btree
storage/bdb/dist/template/rec_crdel
storage/bdb/dist/template/rec_db
storage/bdb/dist/template/rec_dbreg
storage/bdb/dist/template/rec_fileops
storage/bdb/dist/template/rec_hash
storage/bdb/dist/template/rec_log
storage/bdb/dist/template/rec_qam
storage/bdb/dist/template/rec_txn
storage/bdb/fileops/fileops_auto.c
storage/bdb/hash/hash_auto.c
storage/bdb/include/btree_auto.h
storage/bdb/include/btree_ext.h
storage/bdb/include/clib_ext.h
storage/bdb/include/common_ext.h
storage/bdb/include/crdel_auto.h
storage/bdb/include/db_auto.h
storage/bdb/include/db_ext.h
storage/bdb/include/db_server.h
storage/bdb/include/env_ext.h
storage/bdb/include/gen_client_ext.h
storage/bdb/include/gen_server_ext.h
storage/bdb/include/hash_auto.h
storage/bdb/include/hash_ext.h
storage/bdb/include/lock_ext.h
storage/bdb/include/log_auto.h
storage/bdb/include/log_ext.h
storage/bdb/include/mp_ext.h
storage/bdb/include/mutex_ext.h
storage/bdb/include/os_ext.h
storage/bdb/include/qam_auto.h
storage/bdb/include/qam_ext.h
storage/bdb/include/rpc_client_ext.h
storage/bdb/include/rpc_server_ext.h
storage/bdb/include/tcl_ext.h
storage/bdb/include/txn_auto.h
storage/bdb/include/txn_ext.h
storage/bdb/include/xa_ext.h
storage/bdb/log/log_auto.c
storage/bdb/qam/qam_auto.c
storage/bdb/txn/txn_auto.c
storage/bdb/txn/txn_autop.c
binary/*
bkpull.log
bkpull.log*
@@ -257,6 +156,7 @@ client/mf_iocache.c
client/mf_iocache.cc
client/my_decimal.cc
client/my_decimal.h
client/my_user.c
client/mysql
client/mysql.cpp
client/mysqladmin
@@ -270,6 +170,7 @@ client/mysqlimport
client/mysqlmanager-pwgen
client/mysqlmanagerc
client/mysqlshow
client/mysqlslap
client/mysqltest
client/mysqltestmanager-pwgen
client/mysqltestmanagerc
@@ -386,6 +287,7 @@ isam/test2
isam/test3
isamchk/*.ds?
isamchk/*.vcproj
item_xmlfunc.cc
lib_debug/*
lib_release/*
libmysql/*.c
@@ -415,6 +317,9 @@ libmysqld/derror.cc
libmysqld/discover.cc
libmysqld/emb_qcache.cpp
libmysqld/errmsg.c
libmysqld/event.cc
libmysqld/event_executor.cc
libmysqld/event_timed.cc
libmysqld/examples/client_test.c
libmysqld/examples/client_test.cc
libmysqld/examples/completion_hash.cc
@@ -450,6 +355,7 @@ libmysqld/ha_isammrg.cc
libmysqld/ha_myisam.cc
libmysqld/ha_myisammrg.cc
libmysqld/ha_ndbcluster.cc
libmysqld/ha_ndbcluster_binlog.cc
libmysqld/ha_partition.cc
libmysqld/ha_tina.cc
libmysqld/handler.cc
@@ -480,6 +386,7 @@ libmysqld/mf_iocache.cc
libmysqld/mini_client.cc
libmysqld/my_decimal.cc
libmysqld/my_time.c
libmysqld/my_user.c
libmysqld/net_pkg.cc
libmysqld/net_serv.cc
libmysqld/opt_ft.cc
@@ -494,6 +401,7 @@ libmysqld/protocol_cursor.cc
libmysqld/records.cc
libmysqld/repl_failsafe.cc
libmysqld/rpl_filter.cc
libmysqld/rpl_injector.cc
libmysqld/set_var.cc
libmysqld/simple-test
libmysqld/slave.cc
@@ -1102,6 +1010,7 @@ sql/message.mc
sql/message.rc
sql/mini_client_errors.c
sql/my_time.c
sql/my_user.c
sql/mysql_tzinfo_to_sql
sql/mysql_tzinfo_to_sql.cc
sql/mysql_tzinfo_to_sql_tztime.cc
@@ -1137,6 +1046,9 @@ stamp-h2.in
stamp-h3
stamp-h4
start_mysqld.sh
storage/archive/archive_test
storage/bdb/*.ds?
storage/bdb/*.vcproj
storage/bdb/README
storage/bdb/btree/btree_auto.c
storage/bdb/btree/btree_autop.c
@@ -1156,6 +1068,38 @@ storage/bdb/build_vxworks/dbdemo/dbdemo20.wpj
storage/bdb/build_vxworks/dbdemo/dbdemo22.wpj
storage/bdb/build_win32/*.dsp
storage/bdb/build_win32/*.h
storage/bdb/build_win32/db.h
storage/bdb/build_win32/db_archive.dsp
storage/bdb/build_win32/db_checkpoint.dsp
storage/bdb/build_win32/db_config.h
storage/bdb/build_win32/db_cxx.h
storage/bdb/build_win32/db_deadlock.dsp
storage/bdb/build_win32/db_dll.dsp
storage/bdb/build_win32/db_dump.dsp
storage/bdb/build_win32/db_int.h
storage/bdb/build_win32/db_java.dsp
storage/bdb/build_win32/db_load.dsp
storage/bdb/build_win32/db_perf.dsp
storage/bdb/build_win32/db_printlog.dsp
storage/bdb/build_win32/db_recover.dsp
storage/bdb/build_win32/db_stat.dsp
storage/bdb/build_win32/db_static.dsp
storage/bdb/build_win32/db_tcl.dsp
storage/bdb/build_win32/db_test.dsp
storage/bdb/build_win32/db_upgrade.dsp
storage/bdb/build_win32/db_verify.dsp
storage/bdb/build_win32/ex_access.dsp
storage/bdb/build_win32/ex_btrec.dsp
storage/bdb/build_win32/ex_env.dsp
storage/bdb/build_win32/ex_lock.dsp
storage/bdb/build_win32/ex_mpool.dsp
storage/bdb/build_win32/ex_tpcb.dsp
storage/bdb/build_win32/excxx_access.dsp
storage/bdb/build_win32/excxx_btrec.dsp
storage/bdb/build_win32/excxx_env.dsp
storage/bdb/build_win32/excxx_lock.dsp
storage/bdb/build_win32/excxx_mpool.dsp
storage/bdb/build_win32/excxx_tpcb.dsp
storage/bdb/build_win32/include.tcl
storage/bdb/build_win32/libdb.def
storage/bdb/build_win32/libdb.rc
@@ -1473,6 +1417,8 @@ storage/ndb/src/mgmclient/test_cpcd/*.d
storage/ndb/src/mgmsrv/ndb_mgmd
storage/ndb/src/mgmsrv/ndb_mgmd.dsp
storage/ndb/src/ndbapi/libndbapi.dsp
storage/ndb/test/ndbapi/DbAsyncGenerator
storage/ndb/test/ndbapi/DbCreate
storage/ndb/test/ndbapi/bank/bankCreator
storage/ndb/test/ndbapi/bank/bankMakeGL
storage/ndb/test/ndbapi/bank/bankSumAccounts
@@ -1488,21 +1434,26 @@ storage/ndb/test/ndbapi/flexBench
storage/ndb/test/ndbapi/flexBench.dsp
storage/ndb/test/ndbapi/flexHammer
storage/ndb/test/ndbapi/flexTT
storage/ndb/test/ndbapi/ndbapi_slow_select
storage/ndb/test/ndbapi/testBackup
storage/ndb/test/ndbapi/testBasic
storage/ndb/test/ndbapi/testBasic.dsp
storage/ndb/test/ndbapi/testBasicAsynch
storage/ndb/test/ndbapi/testBitfield
storage/ndb/test/ndbapi/testBlobs
storage/ndb/test/ndbapi/testBlobs.dsp
storage/ndb/test/ndbapi/testDataBuffers
storage/ndb/test/ndbapi/testDeadlock
storage/ndb/test/ndbapi/testDict
storage/ndb/test/ndbapi/testIndex
storage/ndb/test/ndbapi/testLcp
storage/ndb/test/ndbapi/testMgm
storage/ndb/test/ndbapi/testNdbApi
storage/ndb/test/ndbapi/testNodeRestart
storage/ndb/test/ndbapi/testOIBasic
storage/ndb/test/ndbapi/testOperations
storage/ndb/test/ndbapi/testPartitioning
storage/ndb/test/ndbapi/testReadPerf
storage/ndb/test/ndbapi/testRestartGci
storage/ndb/test/ndbapi/testSRBank
storage/ndb/test/ndbapi/testScan
@@ -1513,6 +1464,7 @@ storage/ndb/test/ndbapi/testSystemRestart
storage/ndb/test/ndbapi/testTimeout
storage/ndb/test/ndbapi/testTransactions
storage/ndb/test/ndbapi/test_event
storage/ndb/test/ndbapi/test_event_merge
storage/ndb/test/run-test/atrt
storage/ndb/test/src/libNDBT.dsp
storage/ndb/test/tools/copy_tab
@@ -1527,6 +1479,7 @@ storage/ndb/test/tools/hugoPkReadRecord
storage/ndb/test/tools/hugoPkUpdate
storage/ndb/test/tools/hugoScanRead
storage/ndb/test/tools/hugoScanUpdate
storage/ndb/test/tools/listen_event
storage/ndb/test/tools/ndb_cpcc
storage/ndb/test/tools/restart
storage/ndb/test/tools/verify_index
@@ -1658,20 +1611,3 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
client/mysqlslap
storage/archive/archive_test
item_xmlfunc.cc
storage/ndb/test/ndbapi/DbAsyncGenerator
storage/ndb/test/ndbapi/DbCreate
storage/ndb/test/ndbapi/ndbapi_slow_select
storage/ndb/test/ndbapi/testBitfield
storage/ndb/test/ndbapi/testLcp
storage/ndb/test/ndbapi/testPartitioning
storage/ndb/test/ndbapi/testReadPerf
storage/ndb/test/ndbapi/test_event_merge
storage/ndb/test/tools/listen_event
libmysqld/ha_ndbcluster_binlog.cc
libmysqld/rpl_injector.cc
libmysqld/event.cc
libmysqld/event_executor.cc
libmysqld/event_timed.cc
+5 −2
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix)
mysqlslap_SOURCES=              mysqlslap.c $(top_srcdir)/mysys/my_lock.c \
				$(top_srcdir)/mysys/my_alarm.c \
  				$(yassl_dummy_link_fix)
mysqldump_SOURCES=              mysqldump.c $(yassl_dummy_link_fix)
mysqldump_SOURCES=              mysqldump.c my_user.c $(yassl_dummy_link_fix)
mysqlimport_SOURCES=            mysqlimport.c $(yassl_dummy_link_fix)
sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
strings_src=decimal.c
@@ -72,7 +72,10 @@ link_sources:
        for f in $(strings_src) ; do \
          rm -f $(srcdir)/$$f; \
          @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
         done;
         done; \
         rm -f $(srcdir)/my_user.c; \
         @LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c;
	

# Don't update the files from bitkeeper
%::SCCS/s.%
+32 −3
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@

#include <my_global.h>
#include <my_sys.h>
#include <my_user.h>
#include <m_string.h>
#include <m_ctype.h>
#include <hash.h>
@@ -1850,9 +1851,37 @@ static void dump_triggers_for_table (char *table, char *db)
DELIMITER ;;\n");
  while ((row= mysql_fetch_row(result)))
  {
    fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n\
/*!50003 CREATE TRIGGER %s %s %s ON %s FOR EACH ROW%s%s */;;\n\n",
            row[6], /* sql_mode */
    fprintf(sql_file,
            "/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n"
            "/*!50003 CREATE */ ",
            row[6] /* sql_mode */);

    if (mysql_num_fields(result) > 7)
    {
      /*
        mysqldump can be run against the server, that does not support definer
        in triggers (there is no DEFINER column in SHOW TRIGGERS output). So,
        we should check if we have this column before accessing it.
      */

      uint       user_name_len;
      char       user_name_str[USERNAME_LENGTH + 1];
      char       quoted_user_name_str[USERNAME_LENGTH * 2 + 3];
      uint       host_name_len;
      char       host_name_str[HOSTNAME_LENGTH + 1];
      char       quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
    
      parse_user(row[7], strlen(row[7]), user_name_str, &user_name_len,
                 host_name_str, &host_name_len);

      fprintf(sql_file,
              "/*!50017 DEFINER=%s@%s */ ",
              quote_name(user_name_str, quoted_user_name_str, FALSE),
              quote_name(host_name_str, quoted_host_name_str, FALSE));
    }

    fprintf(sql_file,
            "/*!50003 TRIGGER %s %s %s ON %s FOR EACH ROW%s%s */;;\n\n",
            quote_name(row[0], name_buff, 0), /* Trigger */
            row[4], /* Timing */
            row[1], /* Event */
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
			my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
			thr_lock.h t_ctype.h violite.h md5.h base64.h \
			mysql_version.h.in my_handler.h my_time.h decimal.h \
			my_vle.h
			my_vle.h my_user.h

# mysql_version.h are generated
CLEANFILES =            mysql_version.h my_config.h readline openssl

include/my_user.h

0 → 100644
+35 −0
Original line number Diff line number Diff line
/* Copyright (C) 2005 MySQL AB

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 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 */

/*
  This is a header for libraries containing functions used in both server and
  only some of clients (but not in libmysql)...
*/

#ifndef _my_user_h_
#define _my_user_h_

#include <my_global.h>

C_MODE_START

void parse_user(const char *user_id_str, uint user_id_len,
                char *user_name_str, uint *user_name_len,
                char *host_name_str, uint *host_name_len);

C_MODE_END

#endif /* _my_user_h_ */
Loading