Commit 4c221321 authored by unknown's avatar unknown

Added help for --local-infile

Fix for bug on intel where (int32) 1 << 32 == 1, which gave problems when using 32 keys.
Allow SET PASSWORD for anonymous user


Docs/manual.texi:
  Changelog
client/mysql.cc:
  Added help for --local-infile
client/mysqlimport.c:
  Merge with 4.0.
  Patch for LOCAL INFILE handling
configure.in:
  cleanup
include/global.h:
  Fix for bug on intel where (int32) 1 << 32 == 1
mysql-test/r/create.result:
  Test of CREATE TABLE with 32 keys
mysql-test/t/create.test:
  Test of CREATE TABLE with 32 keys
scripts/mysqlhotcopy.sh:
  Patch for databasenames with space.
sql/ha_isam.cc:
  Fix for bug on intel where (int32) 1 << 32 == 1
sql/ha_myisam.cc:
  Fix for bug on intel where (int32) 1 << 32 == 1
sql/ha_myisammrg.cc:
  Fix for bug on intel where (int32) 1 << 32 == 1
sql/mysqld.cc:
  Added help for --local-infile
sql/sql_acl.cc:
  Allow SET PASSWORD of anonymous user
sql/table.cc:
  Fix for bug on intel where (int32) 1 << 32 == 1
parent c13baf70
......@@ -12010,6 +12010,12 @@ make sure that @file{gmalloc.o} is included in @file{libgthreads.a} and
In FSU Pthreads, the following system calls are pthreads-aware: @code{read()},
@code{write()}, @code{getmsg()}, @code{connect()}, @code{accept()},
@code{select()}, and @code{wait()}.
@item
The CSSA-2001-SCO.35.2 (the patch is listed in custom as
erg711905-dscr_remap security patch (ver 2.0.0) breaks FSU threads and
makes mysqld instable. You have to remove this one if you want to run
mysqld on an OpenServer 5.0.6 machine.
@end itemize
If you want to install DBI on SCO, you have to edit the @file{Makefile} in
......@@ -46890,6 +46896,12 @@ not yet 100% confident in this code.
@node News-3.23.50, News-3.23.49, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.50
@itemize @bullet
@item
Fixed problem with @code{SHOW CREATE TABLE} and @code{PRIMARY KEY} when using
32 indexes.
@item
Fixed that one can use @code{SET PASSWORD} for the anonymous user.
@item
Fixed core-dump bug when reading client groups from option files using
@code{mysql_options()}.
@item
......@@ -487,6 +487,7 @@ static void usage(int version)
-i, --ignore-space Ignore space after function names.\n\
-h, --host=... Connect to host.\n\
-H, --html Produce HTML output.\n\
--local-infile=[1|0] Enable/disable LOAD DATA LOCAL INFILE\n\
-L, --skip-line-numbers\n\
Don't write line number for errors.\n");
#ifndef __WIN__
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
/* Copyright (C) 2000 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 */
......@@ -25,7 +25,7 @@
** * *
** *************************
*/
#define IMPORT_VERSION "2.7"
#define IMPORT_VERSION "2.8"
#include "client_priv.h"
#include "mysql_version.h"
......@@ -336,7 +336,7 @@ static int write_to_table(char *filename, MYSQL *sock)
if (ignore)
end= strmov(end, " IGNORE");
end= strmov(strmov(end, " INTO TABLE "), tablename);
if (fields_terminated || enclosed || opt_enclosed || escaped)
end= strmov(end, " FIELDS");
end= add_load_option(end, fields_terminated, " TERMINATED BY");
......@@ -397,10 +397,13 @@ static MYSQL *db_connect(char *host, char *database, char *user, char *passwd)
mysql_init(&mysql_connection);
if (opt_compress)
mysql_options(&mysql_connection,MYSQL_OPT_COMPRESS,NullS);
if (opt_local_file)
mysql_options(&mysql_connection,MYSQL_OPT_LOCAL_INFILE,
(char*) &opt_local_file);
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath);
opt_ssl_capath, opt_ssl_cipher);
#endif
if (!(sock= mysql_real_connect(&mysql_connection,host,user,passwd,
database,opt_mysql_port,opt_mysql_unix_port,
......@@ -482,7 +485,7 @@ static char *add_load_option(char *ptr, const char *object,
** This is done by doubleing ' and add a end -\ if needed to avoid
** syntax errors from the SQL parser.
*/
static char *field_escape(char *to,const char *from,uint length)
{
const char *end;
......@@ -505,7 +508,7 @@ static char *field_escape(char *to,const char *from,uint length)
*to++= '\\';
return to;
}
int main(int argc, char **argv)
......
......@@ -607,7 +607,7 @@ AC_SUBST(MYSQLD_USER)
AC_MSG_CHECKING(if we should should enable LOAD DATA LOCAL by default)
AC_ARG_ENABLE(local-infile,
[ --enable-local-infile
If LOAD DATA LOCAL INFILE is enabled by default.],
Enable LOAD DATA LOCAL INFILE (default: disabled)],
[ ENABLED_LOCAL_INFILE=$enableval ],
[ ENABLED_LOCAL_INFILE=no ]
)
......
......@@ -281,6 +281,7 @@ typedef unsigned short ushort;
#define set_if_bigger(a,b) { if ((a) < (b)) (a)=(b); }
#define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); }
#define test_all_bits(a,b) (((a) & (b)) == (b))
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
#ifndef HAVE_RINT
#define rint(A) floor((A)+0.5)
......
......@@ -12,3 +12,40 @@ table type possible_keys key key_len ref rows Extra
t2 ref B B 21 const 1 where used
a B
3 world
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` int(11) default NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`),
KEY `b_2` (`b`),
KEY `b_3` (`b`),
KEY `b_4` (`b`),
KEY `b_5` (`b`),
KEY `b_6` (`b`),
KEY `b_7` (`b`),
KEY `b_8` (`b`),
KEY `b_9` (`b`),
KEY `b_10` (`b`),
KEY `b_11` (`b`),
KEY `b_12` (`b`),
KEY `b_13` (`b`),
KEY `b_14` (`b`),
KEY `b_15` (`b`),
KEY `b_16` (`b`),
KEY `b_17` (`b`),
KEY `b_18` (`b`),
KEY `b_19` (`b`),
KEY `b_20` (`b`),
KEY `b_21` (`b`),
KEY `b_22` (`b`),
KEY `b_23` (`b`),
KEY `b_24` (`b`),
KEY `b_25` (`b`),
KEY `b_26` (`b`),
KEY `b_27` (`b`),
KEY `b_28` (`b`),
KEY `b_29` (`b`),
KEY `b_30` (`b`),
KEY `b_31` (`b`)
) TYPE=MyISAM
......@@ -69,3 +69,11 @@ create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world";
select * from t2 where b="world";
drop table t1,t2;
#
# Test of primary key with 32 index
#
create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b));
show create table t1;
drop table t1;
......@@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
# Documentation continued at end of file
my $VERSION = "1.15";
my $VERSION = "1.16";
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";
......@@ -236,9 +236,7 @@ my $num_files = 0;
foreach my $rdb ( @db_desc ) {
my $db = $rdb->{src};
eval { $dbh->do( "use $db" ); };
die "Database '$db' not accessible: $@" if ( $@ );
my @dbh_tables = $dbh->tables();
my @dbh_tables = get_list_of_tables( $db );
## generate regex for tables/files
my $t_regex;
......@@ -307,7 +305,7 @@ foreach my $rdb ( @db_desc ) {
$rdb->{files} = [ @db_files ];
$rdb->{index} = [ @index_files ];
my @hc_tables = map { "$db.$_" } @dbh_tables;
my @hc_tables = map { "`$db`.`$_`" } @dbh_tables;
$rdb->{tables} = [ @hc_tables ];
$rdb->{raid_dirs} = [ get_raid_dirs( $rdb->{files} ) ];
......@@ -562,14 +560,14 @@ sub copy_files {
# add recursive option for scp
push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/;
my @non_raid = grep { ! m:/\d{2}/[^/]+$: } @$files;
my @non_raid = map { "'$_'" } grep { ! m:/\d{2}/[^/]+$: } @$files;
# add files to copy and the destination directory
safe_system( @cp, @non_raid, $target );
+ safe_system( @cp, @non_raid, "'$target'" );
foreach my $rd ( @$raid_dirs ) {
my @raid = grep { m:$rd/: } @$files;
safe_system( @cp, @raid, "$target/$rd" ) if ( @raid );
my @raid = map { "'$_'" } grep { m:$rd/: } @$files;
safe_system( @cp, @raid, "'$target'/$rd" ) if ( @raid );
}
}
else
......@@ -735,6 +733,25 @@ sub get_raid_dirs {
return sort keys %dirs;
}
sub get_list_of_tables {
my ( $db ) = @_;
# "use database" cannot cope with database names containing spaces
# so create a new connection
my $dbh = DBI->connect("dbi:mysql:${db}${dsn};mysql_read_default_group=mysqlhotcopy",
$opt{user}, $opt{password},
{
RaiseError => 1,
PrintError => 0,
AutoCommit => 1,
});
my @dbh_tables = eval { $dbh->tables() };
$dbh->disconnect();
return @dbh_tables;
}
__END__
=head1 DESCRIPTION
......@@ -975,3 +992,4 @@ Jeremy D. Zawodny - Removed depricated DBI calls. Fixed bug which
resulted in nothing being copied when a regexp was specified but no
database name(s).
Martin Waite - Fix to handle database name that contains space.
......@@ -191,7 +191,7 @@ void ha_isam::info(uint flag)
sortkey = info.sortkey;
block_size=nisam_block_size;
table->keys = min(table->keys,info.keys);
table->keys_in_use= (((key_map) 1) << table->keys)- (key_map) 1;
table->keys_in_use= set_bits(key_map,table->keys);
table->db_options_in_use= info.options;
table->db_record_offset=
(table->db_options_in_use &
......
......@@ -664,7 +664,7 @@ bool ha_myisam::activate_all_index(THD *thd)
MI_CHECK param;
MYISAM_SHARE* share = file->s;
DBUG_ENTER("activate_all_index");
if (share->state.key_map != ((ulonglong) 1L << share->base.keys)-1)
if (share->state.key_map != set_bits(ulonglong, share->base.keys))
{
const char *save_proc_info=thd->proc_info;
thd->proc_info="Creating index";
......
......@@ -169,7 +169,7 @@ void ha_myisammrg::info(uint flag)
deleted = (ha_rows) info.deleted;
data_file_length=info.data_file_length;
errkey = info.errkey;
table->keys_in_use=(((key_map) 1) << table->keys)- (key_map) 1;
table->keys_in_use= set_bits(key_map, table->keys);
table->db_options_in_use = info.options;
table->is_view=1;
mean_rec_length=info.reclength;
......
......@@ -3243,6 +3243,7 @@ Starts the MySQL server\n");
--init-file=file Read SQL commands from this file at startup\n\
-L, --language=... Client error messages in given language. May be\n\
given as a full path\n\
--local-infile=[1|0] Enable/disable LOAD DATA LOCAL INFILE\n\
-l, --log[=file] Log connections and queries to file\n\
--log-bin[=file] Log queries in new binary format (for replication)\n\
--log-bin-index=file File that holds the names for last binary log files\n\
......
......@@ -765,11 +765,6 @@ bool change_password(THD *thd, const char *host, const char *user,
char *new_password)
{
uint length=0;
if (!user[0])
{
send_error(&thd->net, ER_PASSWORD_ANONYMOUS_USER);
return 1;
}
if (!initialized)
{
send_error(&thd->net, ER_PASSWORD_NOT_ALLOWED); /* purecov: inspected */
......@@ -781,15 +776,21 @@ bool change_password(THD *thd, const char *host, const char *user,
length=(uint) strlen(new_password);
new_password[length & 16]=0;
if (!thd || (!thd->slave_thread && ( strcmp(thd->user,user) ||
my_strcasecmp(host,thd->host ? thd->host : thd->ip))))
if (!thd->slave_thread &&
(strcmp(thd->user,user) ||
my_strcasecmp(host,thd->host ? thd->host : thd->ip)))
{
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
return 1;
}
if (!thd->slave_thread && !thd->user[0])
{
send_error(&thd->net, ER_PASSWORD_ANONYMOUS_USER);
return 1;
}
VOID(pthread_mutex_lock(&acl_cache->lock));
ACL_USER *acl_user;
if (!(acl_user= find_acl_user(host,user)) || !acl_user->user)
if (!(acl_user= find_acl_user(host,user)))
{
send_error(&thd->net, ER_PASSWORD_NO_MATCH);
VOID(pthread_mutex_unlock(&acl_cache->lock));
......@@ -797,7 +798,8 @@ bool change_password(THD *thd, const char *host, const char *user,
}
if (update_user_table(thd,
acl_user->host.hostname ? acl_user->host.hostname : "",
acl_user->user, new_password))
acl_user->user ? acl_user->user : "",
new_password))
{
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
send_error(&thd->net,0); /* purecov: deadcode */
......@@ -817,7 +819,7 @@ bool change_password(THD *thd, const char *host, const char *user,
qinfo.q_len =
my_sprintf(buff,
(buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"",
acl_user->user,
acl_user->user ? acl_user->user : "",
acl_user->host.hostname ? acl_user->host.hostname : "",
new_password));
mysql_update_log.write(thd,buff,qinfo.q_len);
......
......@@ -130,8 +130,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
VOID(my_seek(file,(ulong) uint2korr(head+6),MY_SEEK_SET,MYF(0)));
if (read_string(file,(gptr*) &disk_buff,(uint) uint2korr(head+28)))
goto err_not_open; /* purecov: inspected */
outparam->keys=keys=disk_buff[0];
outparam->keys_in_use= (((key_map) 1) << keys)- (key_map) 1;
outparam->keys=keys= disk_buff[0];
outparam->keys_in_use= set_bits(key_map, keys);
outparam->key_parts=key_parts=disk_buff[1];
n_length=keys*sizeof(KEY)+key_parts*sizeof(KEY_PART_INFO);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment