mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mashka.mysql.fi:/home/my/mysql-4.0
This commit is contained in:
commit
0eeee3670e
20 changed files with 184 additions and 83 deletions
|
@ -1454,7 +1454,7 @@ int main(int argc, char **argv)
|
|||
else
|
||||
{
|
||||
row = mysql_fetch_row(master);
|
||||
if (row[0] && row[1])
|
||||
if (row && row[0] && row[1])
|
||||
{
|
||||
fprintf(md_result_file,
|
||||
"\n--\n-- Position to start replication from\n--\n\n");
|
||||
|
|
|
@ -873,15 +873,19 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
|
|||
{
|
||||
if (b_type & BLOCK_LAST)
|
||||
{
|
||||
mi_check_print_error(param,"Record link to short for record at %s",
|
||||
llstr(start_recpos,llbuff));
|
||||
mi_check_print_error(param,
|
||||
"Wrong record length %s of %s at %s",
|
||||
llstr(block_info.rec_len-left_length,llbuff),
|
||||
llstr(block_info.rec_len, llbuff2),
|
||||
llstr(start_recpos,llbuff3));
|
||||
got_error=1;
|
||||
break;
|
||||
}
|
||||
if (info->state->data_file_length < block_info.next_filepos)
|
||||
{
|
||||
mi_check_print_error(param,"Found next-recordlink that points outside datafile at %s",
|
||||
llstr(block_info.filepos,llbuff));
|
||||
mi_check_print_error(param,
|
||||
"Found next-recordlink that points outside datafile at %s",
|
||||
llstr(block_info.filepos,llbuff));
|
||||
got_error=1;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -485,7 +485,7 @@ int _mi_write_part_record(MI_INFO *info,
|
|||
{
|
||||
info->update&= ~HA_STATE_EXTEND_BLOCK;
|
||||
if (my_block_write(&info->rec_cache,(byte*) *record-head_length,
|
||||
length+extra_length+del_length,filepos))
|
||||
length+extra_length+del_length,filepos))
|
||||
goto err;
|
||||
}
|
||||
else if (my_b_write(&info->rec_cache,(byte*) *record-head_length,
|
||||
|
@ -1412,10 +1412,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
|
|||
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
|
||||
if (my_read(file,(char*) header,sizeof(info->header),MYF(0)) !=
|
||||
sizeof(info->header))
|
||||
{
|
||||
my_errno=HA_ERR_WRONG_IN_RECORD;
|
||||
return BLOCK_FATAL_ERROR;
|
||||
}
|
||||
goto err;
|
||||
}
|
||||
DBUG_DUMP("header",(byte*) header,MI_BLOCK_INFO_HEADER_LENGTH);
|
||||
if (info->second_read)
|
||||
|
@ -1435,10 +1432,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
|
|||
if ((info->block_len=(uint) mi_uint3korr(header+1)) <
|
||||
MI_MIN_BLOCK_LENGTH ||
|
||||
(info->block_len & (MI_DYN_ALIGN_SIZE -1)))
|
||||
{
|
||||
my_errno=HA_ERR_WRONG_IN_RECORD;
|
||||
return BLOCK_ERROR;
|
||||
}
|
||||
goto err;
|
||||
info->filepos=filepos;
|
||||
info->next_filepos=mi_sizekorr(header+4);
|
||||
info->prev_filepos=mi_sizekorr(header+12);
|
||||
|
@ -1449,7 +1443,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
|
|||
(mi_uint4korr(header+12) != 0 &&
|
||||
(mi_uint4korr(header+12) != (ulong) ~0 ||
|
||||
info->prev_filepos != (ulong) ~0)))
|
||||
return BLOCK_FATAL_ERROR;
|
||||
goto err;
|
||||
#endif
|
||||
return return_val | BLOCK_DELETED; /* Deleted block */
|
||||
|
||||
|
@ -1529,8 +1523,9 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
|
|||
info->second_read=1;
|
||||
info->filepos=filepos+12;
|
||||
return return_val;
|
||||
default:
|
||||
my_errno=HA_ERR_WRONG_IN_RECORD; /* Garbage */
|
||||
return BLOCK_ERROR;
|
||||
}
|
||||
|
||||
err:
|
||||
my_errno=HA_ERR_WRONG_IN_RECORD; /* Garbage */
|
||||
return BLOCK_ERROR;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ static const char *load_default_groups[]= { "myisamchk", 0 };
|
|||
static const char *set_charset_name;
|
||||
static CHARSET_INFO *set_charset;
|
||||
static long opt_myisam_block_size;
|
||||
static const char *my_progname_short;
|
||||
|
||||
static const char *type_names[]=
|
||||
{ "?","char","binary", "short", "long", "float",
|
||||
|
@ -85,6 +86,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
int error;
|
||||
MY_INIT(argv[0]);
|
||||
my_progname_short= my_progname+dirname_length(my_progname);
|
||||
|
||||
#ifdef __EMX__
|
||||
_wildcard (&argc, &argv);
|
||||
|
@ -330,7 +332,7 @@ static void usage(void)
|
|||
puts("This software comes with NO WARRANTY: see the PUBLIC for details.\n");
|
||||
puts("Description, check and repair of MyISAM tables.");
|
||||
puts("Used without options all tables on the command will be checked for errors");
|
||||
printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname);
|
||||
printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname_short);
|
||||
puts("\nGlobal options:\n\
|
||||
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'\n\
|
||||
-?, --help Display this help and exit.\n\
|
||||
|
@ -679,7 +681,7 @@ static void get_options(register int *argc,register char ***argv)
|
|||
{
|
||||
VOID(fprintf(stderr,
|
||||
"%s: --unpack can't be used with --quick or --sort-records\n",
|
||||
my_progname));
|
||||
my_progname_short));
|
||||
exit(1);
|
||||
}
|
||||
if ((check_param.testflag & T_READONLY) &&
|
||||
|
@ -689,7 +691,7 @@ static void get_options(register int *argc,register char ***argv)
|
|||
{
|
||||
VOID(fprintf(stderr,
|
||||
"%s: Can't use --readonly when repairing or sorting\n",
|
||||
my_progname));
|
||||
my_progname_short));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -1655,13 +1657,13 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
|
|||
if (!param->warning_printed && !param->error_printed)
|
||||
{
|
||||
if (param->testflag & T_SILENT)
|
||||
fprintf(stderr,"%s: MyISAM file %s\n",my_progname,
|
||||
fprintf(stderr,"%s: MyISAM file %s\n",my_progname_short,
|
||||
param->isam_file_name);
|
||||
param->out_flag|= O_DATA_LOST;
|
||||
}
|
||||
param->warning_printed=1;
|
||||
va_start(args,fmt);
|
||||
fprintf(stderr,"%s: warning: ",my_progname);
|
||||
fprintf(stderr,"%s: warning: ",my_progname_short);
|
||||
VOID(vfprintf(stderr, fmt, args));
|
||||
VOID(fputc('\n',stderr));
|
||||
fflush(stderr);
|
||||
|
@ -1681,12 +1683,12 @@ void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
|
|||
if (!param->warning_printed && !param->error_printed)
|
||||
{
|
||||
if (param->testflag & T_SILENT)
|
||||
fprintf(stderr,"%s: MyISAM file %s\n",my_progname,param->isam_file_name);
|
||||
fprintf(stderr,"%s: MyISAM file %s\n",my_progname_short,param->isam_file_name);
|
||||
param->out_flag|= O_DATA_LOST;
|
||||
}
|
||||
param->error_printed|=1;
|
||||
va_start(args,fmt);
|
||||
fprintf(stderr,"%s: error: ",my_progname);
|
||||
fprintf(stderr,"%s: error: ",my_progname_short);
|
||||
VOID(vfprintf(stderr, fmt, args));
|
||||
VOID(fputc('\n',stderr));
|
||||
fflush(stderr);
|
||||
|
|
|
@ -10,3 +10,6 @@ inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
|
|||
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
|
||||
inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
|
||||
NULL 255.255.1.255 0.0.1.255
|
||||
select length(format('nan', 2)) > 0;
|
||||
length(format('nan', 2)) > 0
|
||||
1
|
||||
|
|
|
@ -69,4 +69,12 @@ select id, sum(qty) as sqty from t1 group by id having sqty>2;
|
|||
id sqty
|
||||
1 5
|
||||
2 9
|
||||
select sum(qty) as sqty from t1 group by id having count(id) > 0;
|
||||
sqty
|
||||
5
|
||||
9
|
||||
select sum(qty) as sqty from t1 group by id having count(distinct id) > 0;
|
||||
sqty
|
||||
5
|
||||
9
|
||||
drop table t1;
|
||||
|
|
|
@ -7,3 +7,8 @@ select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.5555
|
|||
select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
|
||||
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
|
||||
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
|
||||
|
||||
#
|
||||
# Test for core dump with nan
|
||||
#
|
||||
select length(format('nan', 2)) > 0;
|
||||
|
|
|
@ -63,4 +63,6 @@ drop table t1;
|
|||
create table t1 (id int not null, qty int not null);
|
||||
insert into t1 values (1,2),(1,3),(2,4),(2,5);
|
||||
select id, sum(qty) as sqty from t1 group by id having sqty>2;
|
||||
select sum(qty) as sqty from t1 group by id having count(id) > 0;
|
||||
select sum(qty) as sqty from t1 group by id having count(distinct id) > 0;
|
||||
drop table t1;
|
||||
|
|
|
@ -157,10 +157,10 @@ extern "C" {
|
|||
DBUG_PRINT("enter",("Fd: %d pos: %lu whence: %d MyFlags: %d",
|
||||
fd, (ulong) pos, whence, MyFlags));
|
||||
|
||||
assert(pos != MY_FILEPOS_ERROR);
|
||||
|
||||
if (is_raid(fd))
|
||||
{
|
||||
assert(pos != MY_FILEPOS_ERROR);
|
||||
|
||||
RaidFd *raid= (*dynamic_element(&RaidFd::_raid_map,fd,RaidFd**));
|
||||
DBUG_RETURN(raid->Seek(pos,whence,MyFlags));
|
||||
}
|
||||
|
|
|
@ -118,7 +118,8 @@ then
|
|||
resolved=`$bindir/resolveip localhost 2>&1`
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "Sorry, the host '$hostname' could not be looked up."
|
||||
echo "Neither host '$hostname' and 'localhost' could not be looked up with"
|
||||
echo "$bindir/resolveip"
|
||||
echo "Please configure the 'hostname' command to return a correct hostname."
|
||||
echo "If you want to solve this at a later stage, restart this script with"
|
||||
echo "the --force option"
|
||||
|
@ -134,15 +135,12 @@ then
|
|||
fi
|
||||
|
||||
# Create database directories mysql & test
|
||||
if test "$IN_RPM" -eq 0
|
||||
then
|
||||
if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi
|
||||
if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi
|
||||
if test ! -d $ldata/test; then mkdir $ldata/test; chmod 700 $ldata/test ; fi
|
||||
if test -w / -a ! -z "$user"; then
|
||||
chown $user $ldata $ldata/mysql $ldata/test;
|
||||
fi
|
||||
fi
|
||||
|
||||
# Initialize variables
|
||||
c_d="" i_d=""
|
||||
|
|
|
@ -1473,15 +1473,17 @@ String *Item_func_format::val_str(String *str)
|
|||
str_length=str->length();
|
||||
if (nr < 0)
|
||||
str_length--; // Don't count sign
|
||||
length=str->length()+(diff=(str_length- dec-1)/3);
|
||||
if (diff && diff < 330) // size of buff ...
|
||||
|
||||
/* We need this test to handle 'nan' values */
|
||||
if (str_length >= dec+4)
|
||||
{
|
||||
char *tmp,*pos;
|
||||
str=copy_if_not_alloced(&tmp_str,str,length);
|
||||
length= str->length()+(diff=(str_length- dec-1)/3);
|
||||
str= copy_if_not_alloced(&tmp_str,str,length);
|
||||
str->length(length);
|
||||
tmp=(char*) str->ptr()+length - dec-1;
|
||||
for (pos=(char*) str->ptr()+length ; pos != tmp; pos--)
|
||||
pos[0]=pos[- (int) diff];
|
||||
tmp= (char*) str->ptr()+length - dec-1;
|
||||
for (pos= (char*) str->ptr()+length ; pos != tmp; pos--)
|
||||
pos[0]= pos[-(int) diff];
|
||||
while (diff)
|
||||
{
|
||||
pos[0]=pos[-(int) diff]; pos--;
|
||||
|
|
|
@ -1607,6 +1607,7 @@ static void init_signals(void)
|
|||
sa.sa_handler=handle_segfault;
|
||||
#endif
|
||||
sigaction(SIGSEGV, &sa, NULL);
|
||||
sigaction(SIGABRT, &sa, NULL);
|
||||
#ifdef SIGBUS
|
||||
sigaction(SIGBUS, &sa, NULL);
|
||||
#endif
|
||||
|
|
|
@ -2520,8 +2520,8 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
|
|||
}
|
||||
|
||||
|
||||
bool check_grant_column (THD *thd,TABLE *table, const char *name,
|
||||
uint length, uint show_tables)
|
||||
bool check_grant_column(THD *thd,TABLE *table, const char *name,
|
||||
uint length, uint show_tables)
|
||||
{
|
||||
GRANT_TABLE *grant_table;
|
||||
GRANT_COLUMN *grant_column;
|
||||
|
@ -2529,6 +2529,8 @@ bool check_grant_column (THD *thd,TABLE *table, const char *name,
|
|||
ulong want_access=table->grant.want_privilege;
|
||||
if (!want_access)
|
||||
return 0; // Already checked
|
||||
if (!grant_option)
|
||||
goto err2;
|
||||
|
||||
pthread_mutex_lock(&LOCK_grant);
|
||||
|
||||
|
@ -2560,8 +2562,9 @@ bool check_grant_column (THD *thd,TABLE *table, const char *name,
|
|||
#endif
|
||||
|
||||
/* We must use my_printf_error() here! */
|
||||
err:
|
||||
err:
|
||||
pthread_mutex_unlock(&LOCK_grant);
|
||||
err2:
|
||||
if (!show_tables)
|
||||
{
|
||||
char command[128];
|
||||
|
|
|
@ -1694,7 +1694,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
|
|||
else
|
||||
thd->dupp_field=field;
|
||||
}
|
||||
if (check_grants && check_grant_column(thd,table,name,length))
|
||||
if (check_grants && check_grant_column(thd,table,name,length))
|
||||
return WRONG_GRANT;
|
||||
return field;
|
||||
}
|
||||
|
@ -1719,8 +1719,8 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
|
|||
{
|
||||
found_table=1;
|
||||
Field *find=find_field_in_table(thd,tables->table,name,length,
|
||||
grant_option &&
|
||||
tables->table->grant.want_privilege,
|
||||
test(tables->table->grant.
|
||||
want_privilege),
|
||||
1);
|
||||
if (find)
|
||||
{
|
||||
|
@ -1760,8 +1760,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
|
|||
for (; tables ; tables=tables->next)
|
||||
{
|
||||
Field *field=find_field_in_table(thd,tables->table,name,length,
|
||||
grant_option &&
|
||||
tables->table->grant.want_privilege,
|
||||
test(tables->table->grant.want_privilege),
|
||||
allow_rowid);
|
||||
if (field)
|
||||
{
|
||||
|
@ -1985,10 +1984,10 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
|
|||
(!db_name || !strcmp(tables->db,db_name))))
|
||||
{
|
||||
/* Ensure that we have access right to all columns */
|
||||
if (grant_option && !(table->grant.privilege &
|
||||
table->grant.want_privilege) &&
|
||||
if (!(table->grant.privilege & SELECT_ACL) &&
|
||||
check_grant_all_columns(thd,SELECT_ACL,table))
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
Field **ptr=table->field,*field;
|
||||
thd->used_tables|=table->map;
|
||||
while ((field = *ptr++))
|
||||
|
|
|
@ -2533,7 +2533,8 @@ error:
|
|||
|
||||
save_priv In this we store global and db level grants for the table
|
||||
Note that we don't store db level grants if the global grants
|
||||
is enough to satisfy the request.
|
||||
is enough to satisfy the request and the global grants contains
|
||||
a SELECT grant.
|
||||
****************************************************************************/
|
||||
|
||||
bool
|
||||
|
@ -2558,7 +2559,17 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
|
|||
|
||||
if ((thd->master_access & want_access) == want_access)
|
||||
{
|
||||
*save_priv=thd->master_access | thd->db_access;
|
||||
/*
|
||||
If we don't have a global SELECT privilege, we have to get the database
|
||||
specific access rights to be able to handle queries of type
|
||||
UPDATE t1 SET a=1 WHERE b > 0
|
||||
*/
|
||||
db_access= thd->db_access;
|
||||
if (!(thd->master_access & SELECT_ACL) &&
|
||||
(db && (!thd->db || strcmp(db,thd->db))))
|
||||
db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr,
|
||||
thd->priv_user, db); /* purecov: inspected */
|
||||
*save_priv=thd->master_access | db_access;
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
if (((want_access & ~thd->master_access) & ~(DB_ACLS | EXTRA_ACL)) ||
|
||||
|
|
|
@ -2017,8 +2017,12 @@ sum_expr:
|
|||
{ $$=new Item_sum_count(new Item_int((int32) 0L,1)); }
|
||||
| COUNT_SYM '(' in_sum_expr ')'
|
||||
{ $$=new Item_sum_count($3); }
|
||||
| COUNT_SYM '(' DISTINCT expr_list ')'
|
||||
{ $$=new Item_sum_count_distinct(* $4); }
|
||||
| COUNT_SYM '(' DISTINCT
|
||||
{ Select->in_sum_expr++; }
|
||||
expr_list
|
||||
{ Select->in_sum_expr--; }
|
||||
')'
|
||||
{ $$=new Item_sum_count_distinct(* $5); }
|
||||
| GROUP_UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' in_sum_expr ')'
|
||||
{ $$= new Item_sum_unique_users($3,atoi($5.str),atoi($7.str),$9); }
|
||||
| MIN_SYM '(' in_sum_expr ')'
|
||||
|
|
|
@ -11,12 +11,13 @@ use Getopt::Long;
|
|||
$opt_host="";
|
||||
$opt_user=$opt_password="";
|
||||
$opt_db="test";
|
||||
$opt_rows=200; # Test of blobs up to ($rows-1)*100000+1 bytes
|
||||
$opt_rows=20; # Test of blobs up to ($rows-1)*100000+1 bytes
|
||||
$opt_compress=0;
|
||||
$opt_table="test_big_record";
|
||||
$opt_loop_count=100000; # Change this to make test harder/easier
|
||||
|
||||
GetOptions("host=s","db=s","user=s", "password=s", "table=s", "rows=i",
|
||||
"compress") || die "Aborted";
|
||||
"compress", "loop-count=i") || die "Aborted";
|
||||
|
||||
print "Connection to database $test_db\n";
|
||||
|
||||
|
@ -42,12 +43,12 @@ $|=1; # Flush output to stdout to be able to monitor process
|
|||
for ($i=0 ; $i < $opt_rows ; $i++)
|
||||
{
|
||||
$tmp= chr(65+($i % 16)) x ($i*100000+1);
|
||||
print $i," ",length($tmp),"\n";
|
||||
$tmp= $dbh->quote($tmp);
|
||||
$dbh->do("insert into $opt_table (test) values ($tmp)") or die $DBI::errstr;
|
||||
print ".";
|
||||
}
|
||||
|
||||
print "Reading records\n";
|
||||
print "\nReading records\n";
|
||||
|
||||
$sth=$dbh->prepare("select * from $opt_table", { "mysql_use_result" => 1}) or die $dbh->errstr;
|
||||
|
||||
|
@ -56,14 +57,40 @@ $sth->execute() or die $sth->errstr;
|
|||
$i=0;
|
||||
while (($row = $sth->fetchrow_arrayref))
|
||||
{
|
||||
print $row->[0]," ",length($row->[1]),"\n";
|
||||
die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+($i % 16)) x ($i*100000+1)));
|
||||
$i++;
|
||||
}
|
||||
|
||||
die "Didn't get all rows from server" if ($i != $opt_rows);
|
||||
|
||||
$dbh->do("drop table $opt_table") or die $DBI::errstr;
|
||||
#
|
||||
# Test by insert/updating/deleting random rows for a while
|
||||
#
|
||||
|
||||
print "Test ok\n";
|
||||
print "Testing insert/update/delete\n";
|
||||
|
||||
$max_row_id= $rows;
|
||||
for ($i= 0 ; $i < $opt_loop_count ; $i++)
|
||||
{
|
||||
$length= int(rand 65535);
|
||||
$tmp= chr(65+($i % 16)) x $length;
|
||||
$tmp= $dbh->quote($tmp);
|
||||
$dbh->do("insert into $opt_table (test) values ($tmp)") or die $DBI::errstr;
|
||||
$max_row_id++;
|
||||
$length=int(rand 65535);
|
||||
$tmp= chr(65+($i % 16)) x $length;
|
||||
$tmp= $dbh->quote($tmp);
|
||||
$id= int(rand $max_row_id);
|
||||
$dbh->do("update $opt_table set test= $tmp where auto= $id") or die $DBI::errstr;
|
||||
if (($i % 2) == 1)
|
||||
{
|
||||
$id= int(rand $max_row_id);
|
||||
$dbh->do("delete from $opt_table where auto= $id") or die $DBI::errstr;
|
||||
}
|
||||
print "." if ($i % ($opt_loop_count/100) == 1);
|
||||
}
|
||||
|
||||
# $dbh->do("drop table $opt_table") or die $DBI::errstr;
|
||||
|
||||
print "\nTest ok\n";
|
||||
exit 0;
|
||||
|
|
|
@ -82,6 +82,7 @@ user_query("select * from mysql.user where user = '$opt_user'");
|
|||
user_query("select * from mysql.db where user = '$opt_user'");
|
||||
safe_query("grant select on *.* to $user,$user");
|
||||
safe_query("show grants for $user");
|
||||
user_connect(0);
|
||||
|
||||
# The following should fail
|
||||
user_query("insert into mysql.user (host,user) values ('error','$opt_user')",1);
|
||||
|
@ -95,16 +96,21 @@ safe_query("grant select on $opt_database.not_exists to $opt_user",1);
|
|||
safe_query("grant FILE on $opt_database.test to $opt_user",1);
|
||||
safe_query("grant select on *.* to wrong___________user_name",1);
|
||||
safe_query("grant select on $opt_database.* to wrong___________user_name",1);
|
||||
user_connect(0);
|
||||
user_query("grant select on $opt_database.test to $opt_user with grant option",1);
|
||||
safe_query("set password FOR ''\@''=''",1);
|
||||
user_query("set password FOR root\@$opt_host = password('test')",1);
|
||||
|
||||
# Change privileges for user
|
||||
safe_query("revoke select on *.* from $user");
|
||||
safe_query("grant create on *.* to $user");
|
||||
safe_query("grant create,update on *.* to $user");
|
||||
user_connect(0);
|
||||
safe_query("flush privileges");
|
||||
user_query("create table $opt_database.test (a int,b int)");
|
||||
|
||||
user_query("update $opt_database.test set b=b+1 where a > 0",1);
|
||||
safe_query("show grants for $user");
|
||||
safe_query("revoke update on *.* from $user");
|
||||
user_connect(0);
|
||||
safe_query("grant select(c) on $opt_database.test to $user",1);
|
||||
safe_query("revoke select(c) on $opt_database.test from $user",1);
|
||||
safe_query("grant select on $opt_database.test to wrong___________user_name",1);
|
||||
|
@ -223,8 +229,21 @@ user_query("update $opt_database.test set b=b+1",1);
|
|||
safe_query("grant SELECT on *.* to $user");
|
||||
user_connect(0);
|
||||
user_query("update $opt_database.test set b=b+1");
|
||||
user_query("update $opt_database.test set b=b+1 where a > 0");
|
||||
safe_query("revoke SELECT on *.* from $user");
|
||||
safe_query("grant SELECT on $opt_database.* to $user");
|
||||
user_connect(0);
|
||||
user_query("update $opt_database.test set b=b+1");
|
||||
user_query("update $opt_database.test set b=b+1 where a > 0");
|
||||
safe_query("grant UPDATE on *.* to $user");
|
||||
user_connect(0);
|
||||
user_query("update $opt_database.test set b=b+1");
|
||||
user_query("update $opt_database.test set b=b+1 where a > 0");
|
||||
safe_query("revoke UPDATE on *.* from $user");
|
||||
safe_query("revoke SELECT on $opt_database.* from $user");
|
||||
user_connect(0);
|
||||
user_query("update $opt_database.test set b=b+1 where a > 0",1);
|
||||
user_query("update $opt_database.test set b=b+1",1);
|
||||
|
||||
# Add one privilege at a time until the user has all privileges
|
||||
user_query("select * from test",1);
|
||||
|
|
|
@ -28,6 +28,7 @@ grant select on *.* to grant_user@localhost,grant_user@localhost
|
|||
show grants for grant_user@localhost
|
||||
GRANT SELECT ON *.* TO 'grant_user'@'localhost'
|
||||
|
||||
Connecting grant_user
|
||||
insert into mysql.user (host,user) values ('error','grant_user')
|
||||
Error in execute: insert command denied to user: 'grant_user@localhost' for table 'user'
|
||||
update mysql.user set host='error' WHERE user='grant_user'
|
||||
|
@ -50,6 +51,7 @@ grant select on *.* to wrong___________user_name
|
|||
Error in execute: The host or user argument to GRANT is too long
|
||||
grant select on grant_test.* to wrong___________user_name
|
||||
Error in execute: The host or user argument to GRANT is too long
|
||||
Connecting grant_user
|
||||
grant select on grant_test.test to grant_user with grant option
|
||||
Error in execute: grant command denied to user: 'grant_user@localhost' for table 'test'
|
||||
set password FOR ''@''=''
|
||||
|
@ -57,9 +59,17 @@ Error in execute: Can't find any matching row in the user table
|
|||
set password FOR root@localhost = password('test')
|
||||
Error in execute: Access denied for user: 'grant_user@localhost' to database 'mysql'
|
||||
revoke select on *.* from grant_user@localhost
|
||||
grant create on *.* to grant_user@localhost
|
||||
grant create,update on *.* to grant_user@localhost
|
||||
Connecting grant_user
|
||||
flush privileges
|
||||
create table grant_test.test (a int,b int)
|
||||
update grant_test.test set b=b+1 where a > 0
|
||||
Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
|
||||
show grants for grant_user@localhost
|
||||
GRANT UPDATE, CREATE ON *.* TO 'grant_user'@'localhost'
|
||||
|
||||
revoke update on *.* from grant_user@localhost
|
||||
Connecting grant_user
|
||||
grant select(c) on grant_test.test to grant_user@localhost
|
||||
Error in execute: Unknown column 'c' in 'test'
|
||||
revoke select(c) on grant_test.test from grant_user@localhost
|
||||
|
@ -200,8 +210,23 @@ Error in execute: SELECT command denied to user: 'grant_user@localhost' for colu
|
|||
grant SELECT on *.* to grant_user@localhost
|
||||
Connecting grant_user
|
||||
update grant_test.test set b=b+1
|
||||
update grant_test.test set b=b+1 where a > 0
|
||||
revoke SELECT on *.* from grant_user@localhost
|
||||
grant SELECT on grant_test.* to grant_user@localhost
|
||||
Connecting grant_user
|
||||
update grant_test.test set b=b+1
|
||||
update grant_test.test set b=b+1 where a > 0
|
||||
grant UPDATE on *.* to grant_user@localhost
|
||||
Connecting grant_user
|
||||
update grant_test.test set b=b+1
|
||||
update grant_test.test set b=b+1 where a > 0
|
||||
revoke UPDATE on *.* from grant_user@localhost
|
||||
revoke SELECT on grant_test.* from grant_user@localhost
|
||||
Connecting grant_user
|
||||
update grant_test.test set b=b+1 where a > 0
|
||||
Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'a' in table 'test'
|
||||
update grant_test.test set b=b+1
|
||||
Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
|
||||
select * from test
|
||||
Error in execute: select command denied to user: 'grant_user@localhost' for table 'test'
|
||||
grant select on grant_test.test to grant_user@localhost
|
||||
|
@ -489,7 +514,7 @@ Error in execute: Access denied for user: 'grant_user@localhost' to database 'gr
|
|||
grant LOCK TABLES on *.* to grant_user@localhost
|
||||
show grants for grant_user@localhost
|
||||
GRANT LOCK TABLES ON *.* TO 'grant_user'@'localhost'
|
||||
GRANT SELECT, INSERT ON grant_test.test3 TO 'grant_user'@'localhost'
|
||||
GRANT SELECT, INSERT ON `grant_test`.`test3` TO 'grant_user'@'localhost'
|
||||
|
||||
select * from mysql.user where user='grant_user'
|
||||
127.0.0.1 grant_user 7f70e8b858ee6782 N N N N N N N N N N N N N N N N N N N N N 0 0 0
|
||||
|
|
|
@ -66,13 +66,6 @@ $dbh = $server->connect();
|
|||
####
|
||||
|
||||
$table_name="bench1";
|
||||
<<<<<<< table_types.pl
|
||||
||||||| 1.2
|
||||
test("n","type=isam","char"); test("m","type=myisam pack_keys=1","char"); exit(1);
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> /tmp/T4a17019
|
||||
test($table_name,"type=isam","char");
|
||||
test($table_name,"type=myisam pack_keys=0","char");
|
||||
test($table_name,"type=myisam pack_keys=0","char");
|
||||
|
@ -91,7 +84,7 @@ exit (0);
|
|||
|
||||
sub test {
|
||||
my ($name,$options,$chartype)=@_;
|
||||
|
||||
|
||||
print "\nTesting with options: '$options'\n";
|
||||
$dbh->do("drop table $name");
|
||||
do_many($dbh,$server->create("$name",
|
||||
|
@ -102,23 +95,23 @@ sub test {
|
|||
["primary key (id,id2)",
|
||||
"index index_id3 (id3)"],
|
||||
$options));
|
||||
|
||||
|
||||
if ($opt_lock_tables)
|
||||
{
|
||||
$sth = $dbh->do("LOCK TABLES $name WRITE") || die $DBI::errstr;
|
||||
}
|
||||
|
||||
|
||||
if ($opt_fast && defined($server->{vacuum}))
|
||||
{
|
||||
$server->vacuum(\$dbh,1);
|
||||
}
|
||||
|
||||
|
||||
####
|
||||
#### Insert $total_rows records in order, in reverse order and random.
|
||||
####
|
||||
|
||||
|
||||
$loop_time=new Benchmark;
|
||||
|
||||
|
||||
if ($opt_fast_insert)
|
||||
{
|
||||
$query="insert into $name values ";
|
||||
|
@ -127,11 +120,11 @@ sub test {
|
|||
{
|
||||
$query="insert into $name (id,id2,id3,dummy1) values ";
|
||||
}
|
||||
|
||||
|
||||
if (($opt_fast || $opt_fast_insert) && $limits->{'multi_value_insert'})
|
||||
{
|
||||
$query_size=$server->{'limits'}->{'query_size'};
|
||||
|
||||
|
||||
print "Inserting $opt_loop_count multiple-value rows in order\n";
|
||||
$res=$query;
|
||||
for ($i=0 ; $i < $opt_loop_count ; $i++)
|
||||
|
@ -186,7 +179,7 @@ sub test {
|
|||
{
|
||||
$sth = $dbh->do($query . "($i,$i,$i,'ABCDEFGHIJ')") or die $DBI::errstr;
|
||||
}
|
||||
|
||||
|
||||
print "Inserting $opt_loop_count rows in reverse order\n";
|
||||
for ($i=0 ; $i < $opt_loop_count ; $i++)
|
||||
{
|
||||
|
@ -195,25 +188,25 @@ sub test {
|
|||
($total_rows-1-$i) . ",'BCDEFGHIJK')")
|
||||
or die $DBI::errstr;
|
||||
}
|
||||
|
||||
|
||||
print "Inserting $opt_loop_count rows in random order\n";
|
||||
|
||||
|
||||
for ($i=0 ; $i < $opt_loop_count ; $i++)
|
||||
{
|
||||
$sth = $dbh->do($query . "(". $random[$i] . "," . $random[$i] .
|
||||
"," . $random[$i] . ",'CDEFGHIJKL')") or die $DBI::errstr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$end_time=new Benchmark;
|
||||
print "Time for insert (" . ($total_rows) . "): " .
|
||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||
|
||||
|
||||
if ($opt_fast && defined($server->{vacuum}))
|
||||
{
|
||||
$server->vacuum(\$dbh,1);
|
||||
}
|
||||
|
||||
|
||||
$sth=$dbh->prepare("show table status like '$name'");
|
||||
$sth->execute || die "Show table status returned error: $DBI::errstr\n";
|
||||
while (@row = $sth->fetchrow_array)
|
||||
|
|
Loading…
Add table
Reference in a new issue