Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/mysql_src/mysql-4.1-clean
This commit is contained in:
guilhem@mysql.com 2005-01-13 15:35:36 +01:00
commit a02601ecc5
45 changed files with 389 additions and 93 deletions

View file

@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 4.1.9)
AM_INIT_AUTOMAKE(mysql, 4.1.10)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10

View file

@ -146,3 +146,4 @@ EXPORTS
mysql_rpl_query_type
mysql_slave_query
mysql_embedded
get_defaults_files

View file

@ -157,3 +157,4 @@ EXPORTS
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_field_count
get_defaults_files

View file

@ -0,0 +1,15 @@
#
# Set desired charset_connection and collation_collation
# before including this file.
#
# The next query creates a LONGTEXT column
# using the current character_set_connection
# and collation_connection.
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
drop table t1;

View file

@ -56,3 +56,24 @@ DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET NAMES big5;
SET collation_connection='big5_chinese_ci';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
big5_chinese_ci 6109
big5_chinese_ci 61
big5_chinese_ci 6120
drop table t1;
SET collation_connection='big5_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
big5_bin 6109
big5_bin 61
big5_bin 6120
drop table t1;

View file

@ -305,3 +305,23 @@ select 'a' regexp 'A' collate latin1_general_cs;
select 'a' regexp 'A' collate latin1_bin;
'a' regexp 'A' collate latin1_bin
0
SET collation_connection='latin1_swedish_ci';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
latin1_swedish_ci 6109
latin1_swedish_ci 61
latin1_swedish_ci 6120
drop table t1;
SET collation_connection='latin1_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
latin1_bin 6109
latin1_bin 61
latin1_bin 6120
drop table t1;

View file

@ -317,3 +317,12 @@ FIELD('ue',s1) FIELD('
1 1 1 1
1 1 1 1
DROP TABLE t1;
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
latin1_german2_ci 6109
latin1_german2_ci 61
latin1_german2_ci 6120
drop table t1;

View file

@ -71,3 +71,23 @@ B1
B2
B3
drop table t1;
SET collation_connection='sjis_japanese_ci';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
sjis_japanese_ci 6109
sjis_japanese_ci 61
sjis_japanese_ci 6120
drop table t1;
SET collation_connection='sjis_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
sjis_bin 6109
sjis_bin 61
sjis_bin 6120
drop table t1;

View file

@ -2937,3 +2937,23 @@ Screensaver 2 2002-01-22 491 0 519 0 0
3 http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg Jaso
n X Wallpapers 1 2002-05-31 579 0 1091 0 0
DROP TABLE t1;
SET collation_connection='tis620_thai_ci';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
tis620_thai_ci 6109
tis620_thai_ci 61
tis620_thai_ci 6120
drop table t1;
SET collation_connection='tis620_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
tis620_bin 6109
tis620_bin 61
tis620_bin 6120
drop table t1;

View file

@ -2386,3 +2386,13 @@ a 1
b 0
c 0
drop table t1;
SET collation_connection='utf8_unicode_ci';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
utf8_unicode_ci 6109
utf8_unicode_ci 61
utf8_unicode_ci 6120
drop table t1;

View file

@ -592,3 +592,24 @@ a NULL
b NULL
c NULL
drop table t1;
SET collation_connection='ucs2_general_ci';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
ucs2_general_ci 00610009
ucs2_general_ci 0061
ucs2_general_ci 00610020
drop table t1;
SET NAMES latin1;
SET collation_connection='ucs2_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
ucs2_bin 00610009
ucs2_bin 0061
ucs2_bin 00610020
drop table t1;

View file

@ -2207,3 +2207,23 @@ F4FC
F4FD
F4FE
DROP TABLE t1;
SET collation_connection='ujis_japanese_ci';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
ujis_japanese_ci 6109
ujis_japanese_ci 61
ujis_japanese_ci 6120
drop table t1;
SET collation_connection='ujis_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
ujis_bin 6109
ujis_bin 61
ujis_bin 6120
drop table t1;

View file

@ -829,3 +829,23 @@ select * from t1 where soundex(a) = soundex('test');
id a
1 Test
drop table t1;
SET collation_connection='utf8_general_ci';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
utf8_general_ci 6109
utf8_general_ci 61
utf8_general_ci 6120
drop table t1;
SET collation_connection='utf8_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a) hex(a)
utf8_bin 6109
utf8_bin 61
utf8_bin 6120
drop table t1;

View file

@ -291,7 +291,7 @@ execute stmt4;
prepare stmt4 from ' show full processlist ';
execute stmt4;
Id User Host db Command Time State Info
number root localhost test Query 0 NULL show full processlist
number root localhost test Query time NULL show full processlist
prepare stmt4 from ' show grants for user ';
prepare stmt4 from ' show create table t2 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet

View file

@ -10,3 +10,9 @@ drop table if exists t1;
SET @test_character_set= 'big5';
SET @test_collation= 'big5_chinese_ci';
-- source include/ctype_common.inc
SET NAMES big5;
SET collation_connection='big5_chinese_ci';
-- source include/ctype_filesort.inc
SET collation_connection='big5_bin';
-- source include/ctype_filesort.inc

View file

@ -60,3 +60,9 @@ DROP TABLE t1;
select 'a' regexp 'A' collate latin1_general_ci;
select 'a' regexp 'A' collate latin1_general_cs;
select 'a' regexp 'A' collate latin1_bin;
SET collation_connection='latin1_swedish_ci';
-- source include/ctype_filesort.inc
SET collation_connection='latin1_bin';
-- source include/ctype_filesort.inc

View file

@ -114,3 +114,5 @@ SELECT s1,COUNT(*) FROM t1 GROUP BY s1;
SELECT COUNT(DISTINCT s1) FROM t1;
SELECT FIELD('ue',s1), FIELD('Ü',s1), s1='ue', s1='Ü' FROM t1;
DROP TABLE t1;
-- source include/ctype_filesort.inc

View file

@ -62,3 +62,9 @@ CREATE TABLE t1 (
insert into t1 values(0xb1),(0xb2),(0xb3);
select hex(c) from t1;
drop table t1;
SET collation_connection='sjis_japanese_ci';
-- source include/ctype_filesort.inc
SET collation_connection='sjis_bin';
-- source include/ctype_filesort.inc

View file

@ -151,3 +151,9 @@ INSERT INTO t1 VALUES
n X Wallpapers',1,'','2002-05-31','',579,0,'',1091,0,0,'');
select * from t1 order by id;
DROP TABLE t1;
SET collation_connection='tis620_thai_ci';
-- source include/ctype_filesort.inc
SET collation_connection='tis620_bin';
-- source include/ctype_filesort.inc

View file

@ -452,3 +452,6 @@ create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
select a, a regexp '[a]' from t1 order by binary a;
drop table t1;
SET collation_connection='utf8_unicode_ci';
-- source include/ctype_filesort.inc

View file

@ -384,3 +384,9 @@ alter table t1 add b char(1);
show warnings;
select * from t1 order by a;
drop table t1;
SET collation_connection='ucs2_general_ci';
-- source include/ctype_filesort.inc
SET NAMES latin1;
SET collation_connection='ucs2_bin';
-- source include/ctype_filesort.inc

View file

@ -1141,3 +1141,9 @@ INSERT INTO t1 VALUES(0xF4FD);
INSERT INTO t1 VALUES(0xF4FE);
SELECT HEX(c) FROM t1 ORDER BY BINARY c;
DROP TABLE t1;
SET collation_connection='ujis_japanese_ci';
-- source include/ctype_filesort.inc
SET collation_connection='ujis_bin';
-- source include/ctype_filesort.inc

View file

@ -675,3 +675,9 @@ select * from t1 where soundex(a) = soundex('Test');
select * from t1 where soundex(a) = soundex('TEST');
select * from t1 where soundex(a) = soundex('test');
drop table t1;
SET collation_connection='utf8_general_ci';
-- source include/ctype_filesort.inc
SET collation_connection='utf8_bin';
-- source include/ctype_filesort.inc

View file

@ -317,7 +317,7 @@ prepare stmt4 from ' show engine bdb logs ';
execute stmt4;
--enable_result_log
prepare stmt4 from ' show full processlist ';
--replace_column 1 number
--replace_column 1 number 6 time
execute stmt4;
prepare stmt4 from ' show grants for user ';
--error 1295

View file

@ -632,14 +632,11 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_FRAG, &cnoOfFragrec));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_OP_RECS, &cnoOfOprec));
// MemorySpaceTuples is specified in 8k pages, divide by 4 for 32k pages
Uint32 tmp;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE, &tmp));
Uint64 pages = (tmp * 2048 + (ZWORDS_ON_PAGE - 1))/ (Uint64)ZWORDS_ON_PAGE;
cnoOfPage = (Uint32)pages;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE, &cnoOfPage));
Uint32 noOfTriggers= 0;
Uint32 tmp= 0;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE_RANGE, &tmp));
initPageRangeSize(tmp);
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_TABLE, &cnoOfTablerec));

View file

@ -521,7 +521,7 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
ERROR_SET(fatal, ERR_INVALID_CONFIG, msg, buf);
}
noOfDataPages = (dataMem / 8192);
noOfDataPages = (dataMem / 32768);
noOfIndexPages = (indexMem / 8192);
for(unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){

View file

@ -2,7 +2,7 @@
# ****************************
package MySQLaccess;
#use strict;
use POSIX qw(tmpnam);
use File::Temp qw(tempfile tmpnam);
use Fcntl;
BEGIN {
@ -32,7 +32,6 @@ BEGIN {
$ACCESS_U_BCK = 'user_backup';
$ACCESS_D_BCK = 'db_backup';
$DIFF = '/usr/bin/diff';
$TMP_PATH = '/tmp'; #path to writable tmp-directory
$MYSQLDUMP = '@bindir@/mysqldump';
#path to mysqldump executable
@ -431,7 +430,7 @@ use IPC::Open3;
# no caching on STDOUT
$|=1;
$MYSQL_CNF = POSIX::tmpnam();
$MYSQL_CNF = tmpnam();
%MYSQL_CNF = (client => { },
mysql => { },
mysqldump => { },
@ -576,8 +575,6 @@ if (!defined($Param{'host'})) { $Param{'host'}='localhost'; }
push(@MySQLaccess::Grant::Error,'not_found_mysql') if !(-x $MYSQL);
push(@MySQLaccess::Grant::Error,'not_found_diff') if !(-x $DIFF);
push(@MySQLaccess::Grant::Error,'not_found_mysqldump') if !(-x $MYSQLDUMP);
push(@MySQLaccess::Grant::Error,'not_found_tmp') if !(-d $TMP_PATH);
push(@MySQLaccess::Grant::Error,'write_err_tmp') if !(-w $TMP_PATH);
if (@MySQLaccess::Grant::Error) {
MySQLaccess::Report::Print_Error_Messages() ;
exit 0;
@ -1776,17 +1773,15 @@ sub Diff_Privileges {
@before = sort(@before);
@after = sort(@after);
$before = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.before.$$";
$after = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.after.$$";
#$after = "/tmp/t0";
open(BEFORE,"> $before") ||
push(@MySQLaccess::Report::Errors,"Can't open temporary file $before for writing");
open(AFTER,"> $after") ||
push(@MySQLaccess::Report::Errors,"Can't open temporary file $after for writing");
print BEFORE join("\n",@before);
print AFTER join("\n",@after);
close(BEFORE);
close(AFTER);
($hb, $before) = tempfile("$MySQLaccess::script.XXXXXX") or
push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
($ha, $after) = tempfile("$MySQLaccess::script.XXXXXX") or
push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
print $hb join("\n",@before);
print $ha join("\n",@after);
close $hb;
close $ha;
# ----------------------------------
# compute difference
@ -1799,8 +1794,8 @@ sub Diff_Privileges {
# ----------------------------------
# cleanup temp. files
unlink(BEFORE);
unlink(AFTER);
unlink($before);
unlink($after);
return \@diffs;
}
@ -2315,14 +2310,6 @@ BEGIN {
=> "The diff program <$MySQLaccess::DIFF> could not be found.\n"
."+ Check your path, or\n"
."+ edit the source of this script to point \$DIFF to the diff program.\n"
,'not_found_tmp'
=> "The temporary directory <$MySQLaccess::TMP_PATH> could not be found.\n"
."+ create this directory (writeable!), or\n"
."+ edit the source of this script to point \$TMP_PATH to the right directory.\n"
,'write_err_tmp'
=> "The temporary directory <$MySQLaccess::TMP_PATH> is not writable.\n"
."+ make this directory writeable!, or\n"
."+ edit the source of this script to point \$TMP_PATH to another directory.\n"
,'Unrecognized_option'
=> "Sorry,\n"
."You are using an old version of the mysql-program,\n"

View file

@ -4393,8 +4393,7 @@ void Field_string::sort_string(char *to,uint length)
uint tmp=my_strnxfrm(field_charset,
(unsigned char *) to, length,
(unsigned char *) ptr, field_length);
if (tmp < length)
field_charset->cset->fill(field_charset, to + tmp, length - tmp, ' ');
DBUG_ASSERT(tmp == length);
}
@ -4596,9 +4595,7 @@ void Field_varstring::sort_string(char *to,uint length)
(uchar*) to, length,
(uchar*) ptr+HA_KEY_BLOB_LENGTH,
tot_length);
if (tot_length < length)
field_charset->cset->fill(field_charset, to+tot_length,length-tot_length,
binary() ? (char) 0 : ' ');
DBUG_ASSERT(tot_length == length);
}
@ -5116,10 +5113,7 @@ void Field_blob::sort_string(char *to,uint length)
blob_length=my_strnxfrm(field_charset,
(uchar*) to, length,
(uchar*) blob, blob_length);
if (blob_length < length)
field_charset->cset->fill(field_charset, to+blob_length,
length-blob_length,
binary() ? (char) 0 : ' ');
DBUG_ASSERT(blob_length == length);
}
}

View file

@ -622,10 +622,7 @@ static void make_sortkey(register SORTPARAM *param,
}
uint tmp_length=my_strnxfrm(cs,to,sort_field->length,
(unsigned char *) from, length);
if (tmp_length < sort_field->length)
cs->cset->fill(cs, (char*) to+tmp_length,
sort_field->length-tmp_length,
fill_char);
DBUG_ASSERT(tmp_length == sort_field->length);
}
else
{

View file

@ -64,7 +64,7 @@ const char *command_name[]={
"Drop DB", "Refresh", "Shutdown", "Statistics", "Processlist",
"Connect","Kill","Debug","Ping","Time","Delayed insert","Change user",
"Binlog Dump","Table Dump", "Connect Out", "Register Slave",
"Prepare", "Prepare Execute", "Long Data", "Close stmt",
"Prepare", "Execute", "Long Data", "Close stmt",
"Reset stmt", "Set option",
"Error" // Last command number
};

View file

@ -1592,7 +1592,7 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
DBUG_RETURN(1);
}
mysql_log.write(thd, COM_PREPARE, "%s", packet);
mysql_log.write(thd, COM_PREPARE, "[%lu] %s", stmt->id, packet);
thd->current_arena= stmt;
mysql_init_query(thd, (uchar *) thd->query, thd->query_length);
@ -1792,6 +1792,9 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
if (stmt->param_count && stmt->set_params_data(stmt, &expanded_query))
goto set_params_data_err;
#endif
mysql_log.write(thd, COM_EXECUTE, "[%lu] %s", stmt->id,
expanded_query.length() ? expanded_query.c_ptr() :
stmt->query);
thd->protocol= &thd->protocol_prep; // Switch to binary protocol
execute_stmt(thd, stmt, &expanded_query, TRUE);
thd->protocol= &thd->protocol_simple; // Use normal protocol

View file

@ -298,6 +298,7 @@ static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
const uchar * src, uint srclen)
{
uint16 e;
uint dstlen= len;
len = srclen;
while (len--)
@ -312,7 +313,9 @@ static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
} else
*dest++ = sort_order_big5[(uchar) *src++];
}
return srclen;
if (dstlen > srclen)
bfill(dest, dstlen - srclen, ' ');
return dstlen;
}
#if 0

View file

@ -341,13 +341,27 @@ static int my_wildcmp_bin(CHARSET_INFO *cs,
static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar *src,
uint srclen __attribute__((unused)))
uchar * dest, uint dstlen,
const uchar *src, uint srclen)
{
if (dest != src)
memcpy(dest,src,len= min(len,srclen));
return len;
memcpy(dest, src, min(dstlen,srclen));
if (dstlen > srclen)
bfill(dest + srclen, dstlen - srclen, 0);
return dstlen;
}
static
int my_strnxfrm_8bit_bin(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint dstlen,
const uchar *src, uint srclen)
{
if (dest != src)
memcpy(dest, src, min(dstlen,srclen));
if (dstlen > srclen)
bfill(dest + srclen, dstlen - srclen, ' ');
return dstlen;
}
@ -417,7 +431,7 @@ MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
NULL, /* init */
my_strnncoll_8bit_bin,
my_strnncollsp_8bit_bin,
my_strnxfrm_bin,
my_strnxfrm_8bit_bin,
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,

View file

@ -296,16 +296,18 @@ static int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)),
int value;
const uchar * p, * store;
int pass = 0;
int totlen = 0;
uint totlen = 0;
p = src; store = src;
do
{
NEXT_CMP_VALUE(src, p, store, pass, value, (int)srclen);
ADD_TO_RESULT(dest, (int)len, totlen, value);
ADD_TO_RESULT(dest, len, totlen, value);
}
while (value);
return totlen;
if (len > totlen)
bfill(dest + totlen, len - totlen, ' ');
return len;
}
#undef IS_END

View file

@ -2659,6 +2659,7 @@ static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
const uchar * src, uint srclen)
{
uint16 e;
uint dstlen= len;
len = srclen;
while (len--)
@ -2673,7 +2674,9 @@ static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
} else
*dest++ = sort_order_gbk[(uchar) *src++];
}
return srclen;
if (dstlen > srclen)
bfill(dest, dstlen - srclen, ' ');
return dstlen;
}

View file

@ -637,7 +637,6 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen)
{
const uchar *dest_orig = dest;
const uchar *de = dest + len;
const uchar *se = src + srclen;
for ( ; src < se && dest < de ; src++)
@ -647,7 +646,9 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
if ((chr=combo2map[*src]) && dest < de)
*dest++=chr;
}
return (int) (dest - dest_orig);
if (dest < de)
bfill(dest, de - dest, ' ');
return (int) len;
}

View file

@ -412,13 +412,14 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
static int my_strnxfrm_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar *src,
uint srclen __attribute__((unused)))
uchar * dest, uint dstlen,
const uchar *src, uint srclen)
{
if (dest != src)
memcpy(dest,src,len= min(len,srclen));
return len;
memcpy(dest, src, min(dstlen, srclen));
if (dstlen > srclen)
bfill(dest + srclen, dstlen - srclen, ' ');
return dstlen;
}

View file

@ -21,27 +21,68 @@
#include "stdarg.h"
/*
Converts a string into its sort key.
SYNOPSIS
my_strnxfrm_xxx()
IMPLEMENTATION
The my_strxfrm_xxx() function transforms a string pointed to by
'src' with length 'srclen' according to the charset+collation
pair 'cs' and copies the result key into 'dest'.
Comparing two strings using memcmp() after my_strnxfrm_xxx()
is equal to comparing two original strings with my_strnncollsp_xxx().
Not more than 'dstlen' bytes are written into 'dst'.
To garantee that the whole string is transformed, 'dstlen' must be
at least srclen*cs->strnxfrm_multiply bytes long. Otherwise,
consequent memcmp() may return a non-accurate result.
If the source string is too short to fill whole 'dstlen' bytes,
then the 'dest' string is padded up to 'dstlen', ensuring that:
"a" == "a "
"a\0" < "a"
"a\0" < "a "
my_strnxfrm_simple() is implemented for 8bit charsets and
simple collations with one-to-one string->key transformation.
See also implementations for various charsets/collations in
other ctype-xxx.c files.
RETURN
Target len 'dstlen'.
*/
int my_strnxfrm_simple(CHARSET_INFO * cs,
uchar *dest, uint len,
const uchar *src, uint srclen)
{
uchar *map= cs->sort_order;
uint dstlen= len;
set_if_smaller(len, srclen);
if (dest != src)
{
const uchar *end;
for ( end=src+len; src < end ; )
*dest++= map[*src++];
return len;
}
else
{
const uchar *end;
for ( end=dest+len; dest < end ; dest++)
*dest= (char) map[(uchar) *dest];
return len;
}
if (dstlen > len)
bfill(dest, dstlen - len, ' ');
return dstlen;
}
int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen,

View file

@ -291,7 +291,9 @@ static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
else
*dest++ = sort_order_sjis[(uchar)*src++];
}
return srclen;
if (len > srclen)
bfill(dest, len - srclen, ' ');
return len;
}

View file

@ -631,9 +631,13 @@ int my_strnxfrm_tis620(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen)
{
uint dstlen= len;
len= (uint) (strmake((char*) dest, (char*) src, min(len, srclen)) -
(char*) dest);
return (int) thai2sortable(dest, len);
len= thai2sortable(dest, len);
if (dstlen > len)
bfill(dest + len, dstlen - len, ' ');
return dstlen;
}

View file

@ -7214,8 +7214,7 @@ static int my_strnxfrm_uca(CHARSET_INFO *cs,
uchar *dst, uint dstlen,
const uchar *src, uint srclen)
{
uchar *de = dst + dstlen;
const uchar *dst_orig = dst;
uchar *de = dst + (dstlen & (uint) ~1); // add even length for easier code
int s_res;
my_uca_scanner scanner;
scanner_handler->init(&scanner, cs, src, srclen);
@ -7226,8 +7225,17 @@ static int my_strnxfrm_uca(CHARSET_INFO *cs,
dst[1]= s_res & 0xFF;
dst+= 2;
}
for ( ; dst < de; *dst++='\0');
return dst - dst_orig;
s_res= cs->sort_order_big[0][0x20 * cs->sort_order[0]];
while (dst < de)
{
dst[0]= s_res >> 8;
dst[1]= s_res & 0xFF;
dst+= 2;
}
if (dstlen & 1) // if odd number then fill the last char
*dst= '\0';
return dstlen;
}

View file

@ -347,7 +347,6 @@ static int my_strnxfrm_ucs2(CHARSET_INFO *cs,
int plane;
uchar *de = dst + dstlen;
const uchar *se = src + srclen;
const uchar *dst_orig = dst;
while( src < se && dst < de )
{
@ -367,7 +366,9 @@ static int my_strnxfrm_ucs2(CHARSET_INFO *cs,
}
dst+=res;
}
return dst - dst_orig;
if (dst < de)
cs->cset->fill(cs, dst, de - dst, ' ');
return dstlen;
}
@ -1377,7 +1378,9 @@ int my_strnxfrm_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
{
if (dst != src)
memcpy(dst,src,srclen= min(dstlen,srclen));
return srclen;
if (dstlen > srclen)
cs->cset->fill(cs, dst + srclen, dstlen - srclen, ' ');
return dstlen;
}

View file

@ -2228,7 +2228,6 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
int plane;
uchar *de = dst + dstlen;
const uchar *se = src + srclen;
const uchar *dst_orig = dst;
while( src < se && dst < de )
{
@ -2248,7 +2247,9 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
}
dst+=res;
}
return dst - dst_orig;
if (dst < de)
bfill(dst, de - dst, ' ');
return dstlen;
}
static int my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)

View file

@ -503,7 +503,9 @@ static int my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)),
dest[totlen] = value;
totlen++;
} while (value) ;
return totlen;
if (len > totlen)
bfill(dest + totlen, len - totlen, ' ');
return len;
}
#undef IS_END

View file

@ -26,7 +26,8 @@
#
# Change this to match the version of the shared libs you want to include
#
%define version4 @MYSQL_NO_DASH_VERSION@
%define version41 @MYSQL_NO_DASH_VERSION@
%define version40 4.0.23
%define version3 3.23.58
Name: MySQL-shared-compat
@ -36,26 +37,31 @@ License: GPL
Group: Applications/Databases
URL: http://www.mysql.com/
Autoreqprov: on
Version: %{version4}
Version: %{version41}
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Obsoletes: MySQL-shared, mysql-shared
Provides: MySQL-shared
Summary: MySQL shared libraries for MySQL %{version4} and %{version3}
Source0: MySQL-shared-%{version4}-0.%{_arch}.rpm
Source1: MySQL-shared-%{version3}-1.%{_arch}.rpm
Summary: MySQL shared client libraries for MySQL %{version41}, %{version40} and %{version3}
# We simply use the "MySQL-shared" subpackages as input sources instead of
# rebuilding all from source
Source0: MySQL-shared-%{version41}-0.%{_arch}.rpm
Source1: MySQL-shared-%{version40}-0.%{_arch}.rpm
Source2: MySQL-shared-%{version3}-1.%{_arch}.rpm
# No need to include the RPMs once more - they can be downloaded seperately
# if you want to rebuild this package
NoSource: 0
NoSource: 1
NoSource: 2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
This package includes the shared libraries for both MySQL %{version3} and
MySQL %{version4}. Install this package instead of "MySQL-shared", if you
have applications installed that are dynamically linked against MySQL
3.23.xx but you want to upgrade to MySQL 4.0.xx without breaking the library
dependencies.
This package includes the shared libraries for both MySQL %{version3},
MySQL %{version40} as well as MySQL %{version41}.
Install this package instead of "MySQL-shared", if you have applications
installed that are dynamically linked against older versions of the MySQL
client library but you want to upgrade to MySQL 4.1.xx without breaking the
library dependencies.
%install
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
@ -63,6 +69,8 @@ mkdir -p $RPM_BUILD_ROOT
cd $RPM_BUILD_ROOT
rpm2cpio %{SOURCE0} | cpio -iv --make-directories
rpm2cpio %{SOURCE1} | cpio -iv --make-directories
rpm2cpio %{SOURCE2} | cpio -iv --make-directories
/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;