diff options
-rwxr-xr-x | BitKeeper/triggers/post-commit | 3 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 27 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | mysql-test/r/func_crypt.result | 10 | ||||
-rw-r--r-- | mysql-test/r/myisam.result | 1 | ||||
-rw-r--r-- | mysql-test/t/func_crypt.test | 9 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 1 | ||||
-rw-r--r-- | scripts/mysqlhotcopy.sh | 19 | ||||
-rw-r--r-- | sql/item_func.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 | ||||
-rw-r--r-- | support-files/mysql.server.sh | 26 |
11 files changed, 79 insertions, 23 deletions
diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit index 636e4262693..7f803732d5b 100755 --- a/BitKeeper/triggers/post-commit +++ b/BitKeeper/triggers/post-commit @@ -19,7 +19,8 @@ BK_STATUS=$BK_STATUS$BK_COMMIT if [ "$BK_STATUS" = OK ] then -CHANGESET=`bk -R prs -r+ -h -d':I:' ChangeSet` +USRN=`echo $FROM | sed 's/\(..*\)@.*/\1/'` +CHANGESET=${USRN}:`bk -R prs -r+ -h -d':I:' ChangeSet` #++ # dev-public@ diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 298521b5aa7..34b7ae11f74 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -52,7 +52,7 @@ static const char* host = 0; static int port = MYSQL_PORT; static const char* sock= 0; static const char* user = 0; -static const char* pass = ""; +static char* pass = 0; static ulonglong position = 0; static short binlog_flags = 0; static MYSQL* mysql = NULL; @@ -227,7 +227,7 @@ static struct my_option my_long_options[] = {"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', "Password to connect to remote server.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Use port to connect to the remote server.", (gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, @@ -267,6 +267,11 @@ void sql_print_error(const char *format,...) va_end(args); } +static void cleanup() +{ + my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); +} + static void die(const char* fmt, ...) { va_list args; @@ -275,6 +280,7 @@ static void die(const char* fmt, ...) vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); va_end(args); + cleanup(); exit(1); } @@ -334,6 +340,7 @@ extern "C" my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { + bool tty_password=0; switch (optid) { #ifndef DBUG_OFF case '#': @@ -344,7 +351,17 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), one_database = 1; break; case 'p': - pass = my_strdup(argument, MYF(0)); + if (argument) + { + my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); + char *start=argument; + pass= my_strdup(argument,MYF(MY_FAE)); + while (*argument) *argument++= 'x'; /* Destroy argument */ + if (*start) + start[1]=0; /* Cut length of argument */ + } + else + tty_password=1; break; case 'r': if (!(result_file = my_fopen(argument, O_WRONLY | O_BINARY, MYF(MY_WME)))) @@ -360,6 +377,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), usage(); exit(0); } + if (tty_password) + pass= get_tty_password(NullS); + return 0; } @@ -778,6 +798,7 @@ int main(int argc, char** argv) my_fclose(result_file, MYF(0)); if (remote_opt) mysql_close(mysql); + cleanup(); free_defaults(defaults_argv); my_end(0); return 0; diff --git a/configure.in b/configure.in index 8ce3a9aea67..02825ce1424 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 4.0.16) +AM_INIT_AUTOMAKE(mysql, 4.0.17) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result index 742de833bf7..96bbaa6cae7 100644 --- a/mysql-test/r/func_crypt.result +++ b/mysql-test/r/func_crypt.result @@ -7,3 +7,13 @@ old_password('test') password('test') select length(encrypt('test')), encrypt('test','aa'); length(encrypt('test')) encrypt('test','aa') 13 aaqPiZY5xR5l. +drop table if exists t1; +create table t1 (name varchar(50), pw varchar(16)); +insert into t1 values ('tom', password('my_pass')); +set @pass='my_pass'; +select name from t1 where name='tom' and pw=password(@pass); +name +tom +select name from t1 where name='tom' and pw=password(@undefined); +name +drop table t1; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 3052af3499d..e113a48f4da 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -83,7 +83,6 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK DROP TABLE t1; -drop table if exists t1; create table t1 ( t1 char(255), key(t1(250))); insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test index f403d96e885..e612405c5e9 100644 --- a/mysql-test/t/func_crypt.test +++ b/mysql-test/t/func_crypt.test @@ -4,3 +4,12 @@ select length(encrypt('foo', 'ff')) <> 0; --replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l. select old_password('test'), password('test'); select length(encrypt('test')), encrypt('test','aa'); + +drop table if exists t1; +create table t1 (name varchar(50), pw varchar(16)); +insert into t1 values ('tom', password('my_pass')); +set @pass='my_pass'; +select name from t1 where name='tom' and pw=password(@pass); +select name from t1 where name='tom' and pw=password(@undefined); +drop table t1; + diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index a5490153a17..12853cd67ca 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -88,7 +88,6 @@ DROP TABLE t1; # in ha_myisam::repair, and index size is changed (decreased). # -drop table if exists t1; create table t1 ( t1 char(255), key(t1(250))); insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index f23955da06a..654e5466e12 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. # Documentation continued at end of file -my $VERSION = "1.19"; +my $VERSION = "1.20"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; @@ -235,10 +235,15 @@ else # --- resolve database names from regexp --- if ( defined $opt{regexp} ) { + my $t_regex = '.*'; + if ( $opt{regexp} =~ s{^/(.+)/\./(.+)/$}{$1} ) { + $t_regex = $2; + } + my $sth_dbs = $dbh->prepare("show databases"); $sth_dbs->execute; while ( my ($db_name) = $sth_dbs->fetchrow_array ) { - push @db_desc, { 'src' => $db_name } if ( $db_name =~ m/$opt{regexp}/o ); + push @db_desc, { 'src' => $db_name, 't_regex' => $t_regex } if ( $db_name =~ m/$opt{regexp}/o ); } } @@ -413,6 +418,8 @@ foreach my $rdb ( @db_desc ) { else { mkdir($tgt_dirpath, 0750) or die "Can't create '$tgt_dirpath': $!\n" unless -d $tgt_dirpath; + my @f_info= stat "$datadir/$rdb->{src}"; + chown $f_info[4], $f_info[5], $tgt_dirpath; } } } @@ -938,6 +945,14 @@ server in a mutual replication setup. Copy all databases with names matching the pattern +=item --regexp /pattern1/./pattern2/ + +Copy all tables with names matching pattern2 from all databases with +names matching pattern1. For example, to select all tables which +names begin with 'bar' from all databases which names end with 'foo': + + mysqlhotcopy --indices --method=cp --regexp /foo$/./^bar/ + =item db_name./pattern/ Copy only tables matching pattern. Shell metacharacters ( (, ), |, !, diff --git a/sql/item_func.cc b/sql/item_func.cc index fd6d17d0cf2..8d7ee637d73 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2087,7 +2087,7 @@ void Item_func_get_user_var::fix_length_and_dec() bool Item_func_get_user_var::const_item() const { - return var_entry && current_thd->query_id != var_entry->update_query_id; + return (!var_entry || current_thd->query_id != var_entry->update_query_id); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f1ab998c0fa..55813378b9c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2600,6 +2600,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) table_map used_tables; if (join->tables > 1) cond->update_used_tables(); // Tablenr may have changed + if (join->const_tables == join->tables) + join->const_table_map|=RAND_TABLE_BIT; { // Check const tables COND *const_cond= make_cond_for_table(cond,join->const_table_map,(table_map) 0); diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index 89d45e0f26d..36eb5c4dff6 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -109,19 +109,6 @@ else fi # -# Set pid file if not given -# -if test -z "$pid_file" -then - pid_file=$datadir/`@HOSTNAME@`.pid -else - case "$pid_file" in - /* ) ;; - * ) pid_file="$datadir/$pid_file" ;; - esac -fi - -# # Test if someone changed datadir; In this case we should also read the # default arguments from this directory # @@ -134,6 +121,19 @@ fi parse_arguments `$print_defaults $extra_args mysqld mysql_server mysql.server` +# +# Set pid file if not given +# +if test -z "$pid_file" +then + pid_file=$datadir/`@HOSTNAME@`.pid +else + case "$pid_file" in + /* ) ;; + * ) pid_file="$datadir/$pid_file" ;; + esac +fi + # Safeguard (relative paths, core dumps..) cd $basedir |