mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
Merge bk-internal:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
This commit is contained in:
commit
a4025168c7
25 changed files with 175 additions and 43 deletions
|
@ -27,6 +27,7 @@ then
|
|||
fi
|
||||
|
||||
CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet`
|
||||
CSETKEY=`bk -R prs -r+ -h -d':KEY:' ChangeSet`
|
||||
BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/\1/p'`
|
||||
WL=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Ww][Ll] *# *\([0-9][0-9]*\).*$/ WL#\1/p'`
|
||||
|
||||
|
@ -52,6 +53,7 @@ List-ID: <bk.mysql-$VERSION>
|
|||
From: $FROM
|
||||
To: $TO
|
||||
Subject: bk commit - $VERSION tree ($CHANGESET)${BS}${WL}
|
||||
X-CSetKey: <$CSETKEY>
|
||||
$BH
|
||||
EOF
|
||||
bk changes -v -r+
|
||||
|
@ -68,6 +70,7 @@ List-ID: <bk.mysql-$VERSION>
|
|||
From: $FROM
|
||||
To: $INTERNALS
|
||||
Subject: bk commit into $VERSION tree ($CHANGESET)$BS
|
||||
X-CSetKey: <$CSETKEY>
|
||||
$BH
|
||||
Below is the list of changes that have just been committed into a local
|
||||
$VERSION repository of $USER. When $USER does a push these changes will
|
||||
|
|
|
@ -149,7 +149,8 @@ typedef struct my_charset_handler_st
|
|||
uint (*numchars)(struct charset_info_st *, const char *b, const char *e);
|
||||
uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
|
||||
uint (*well_formed_len)(struct charset_info_st *,
|
||||
const char *b,const char *e, uint nchars);
|
||||
const char *b,const char *e,
|
||||
uint nchars, int *error);
|
||||
uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
|
||||
uint (*numcells)(struct charset_info_st *, const char *b, const char *e);
|
||||
|
||||
|
@ -349,7 +350,8 @@ int my_wildcmp_8bit(CHARSET_INFO *,
|
|||
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
|
||||
uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
|
||||
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
||||
uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
||||
uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e,
|
||||
uint pos, int *error);
|
||||
int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
|
||||
|
||||
|
||||
|
@ -367,7 +369,8 @@ int my_wildcmp_mb(CHARSET_INFO *,
|
|||
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
|
||||
uint my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
|
||||
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
||||
uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
||||
uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e,
|
||||
uint pos, int *error);
|
||||
uint my_instr_mb(struct charset_info_st *,
|
||||
const char *b, uint b_length,
|
||||
const char *s, uint s_length,
|
||||
|
|
|
@ -14,6 +14,7 @@ Created 2/23/1996 Heikki Tuuri
|
|||
|
||||
#include "ut0byte.h"
|
||||
#include "rem0cmp.h"
|
||||
#include "trx0trx.h"
|
||||
|
||||
/******************************************************************
|
||||
Allocates memory for a persistent cursor object and initializes the cursor. */
|
||||
|
@ -206,7 +207,14 @@ btr_pcur_restore_position(
|
|||
|
||||
ut_a(cursor->pos_state == BTR_PCUR_WAS_POSITIONED
|
||||
|| cursor->pos_state == BTR_PCUR_IS_POSITIONED);
|
||||
ut_a(cursor->old_stored == BTR_PCUR_OLD_STORED);
|
||||
if (cursor->old_stored != BTR_PCUR_OLD_STORED) {
|
||||
ut_print_buf(stderr, (const byte*)cursor, sizeof(btr_pcur_t));
|
||||
if (cursor->trx_if_known) {
|
||||
trx_print(stderr, cursor->trx_if_known);
|
||||
}
|
||||
|
||||
ut_a(0);
|
||||
}
|
||||
|
||||
if (cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|
||||
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) {
|
||||
|
|
|
@ -478,6 +478,10 @@ struct btr_pcur_struct{
|
|||
BTR_PCUR_WAS_POSITIONED,
|
||||
BTR_PCUR_NOT_POSITIONED */
|
||||
ulint search_mode; /* PAGE_CUR_G, ... */
|
||||
trx_t* trx_if_known; /* the transaction, if we know it;
|
||||
otherwise this field is not defined;
|
||||
can ONLY BE USED in error prints in
|
||||
fatal assertion failures! */
|
||||
/*-----------------------------*/
|
||||
/* NOTE that the following fields may possess dynamically allocated
|
||||
memory which should be freed if not needed anymore! */
|
||||
|
|
|
@ -493,6 +493,8 @@ btr_pcur_open(
|
|||
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
|
||||
btr_cursor, 0, mtr);
|
||||
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
|
||||
|
||||
cursor->trx_if_known = NULL;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -535,6 +537,8 @@ btr_pcur_open_with_no_init(
|
|||
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
|
||||
|
||||
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
|
||||
|
||||
cursor->trx_if_known = NULL;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -568,6 +572,8 @@ btr_pcur_open_at_index_side(
|
|||
pcur->pos_state = BTR_PCUR_IS_POSITIONED;
|
||||
|
||||
pcur->old_stored = BTR_PCUR_OLD_NOT_STORED;
|
||||
|
||||
pcur->trx_if_known = NULL;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -592,6 +598,8 @@ btr_pcur_open_at_rnd_pos(
|
|||
btr_pcur_get_btr_cur(cursor), mtr);
|
||||
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
|
||||
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
|
||||
|
||||
cursor->trx_if_known = NULL;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -617,4 +625,6 @@ btr_pcur_close(
|
|||
|
||||
cursor->latch_mode = BTR_NO_LATCHES;
|
||||
cursor->pos_state = BTR_PCUR_NOT_POSITIONED;
|
||||
|
||||
cursor->trx_if_known = NULL;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ log. */
|
|||
#define OS_FILE_OVERWRITE 53
|
||||
#define OS_FILE_OPEN_RAW 54
|
||||
#define OS_FILE_CREATE_PATH 55
|
||||
#define OS_FILE_OPEN_RETRY 56 /* for os_file_create() on
|
||||
the first ibdata file */
|
||||
|
||||
#define OS_FILE_READ_ONLY 333
|
||||
#define OS_FILE_READ_WRITE 444
|
||||
|
|
|
@ -413,8 +413,6 @@ os_file_lock(
|
|||
"InnoDB: using the same InnoDB data or log files.\n");
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
@ -989,6 +987,7 @@ try_again:
|
|||
} else if (access_type == OS_FILE_READ_WRITE
|
||||
&& os_file_lock(file, name)) {
|
||||
*success = FALSE;
|
||||
close(file);
|
||||
file = -1;
|
||||
#endif
|
||||
} else {
|
||||
|
@ -1101,6 +1100,7 @@ os_file_create_simple_no_error_handling(
|
|||
} else if (access_type == OS_FILE_READ_WRITE
|
||||
&& os_file_lock(file, name)) {
|
||||
*success = FALSE;
|
||||
close(file);
|
||||
file = -1;
|
||||
#endif
|
||||
} else {
|
||||
|
@ -1152,7 +1152,8 @@ try_again:
|
|||
if (create_mode == OS_FILE_OPEN_RAW) {
|
||||
create_flag = OPEN_EXISTING;
|
||||
share_mode = FILE_SHARE_WRITE;
|
||||
} else if (create_mode == OS_FILE_OPEN) {
|
||||
} else if (create_mode == OS_FILE_OPEN
|
||||
|| create_mode == OS_FILE_OPEN_RETRY) {
|
||||
create_flag = OPEN_EXISTING;
|
||||
} else if (create_mode == OS_FILE_CREATE) {
|
||||
create_flag = CREATE_NEW;
|
||||
|
@ -1243,7 +1244,8 @@ try_again:
|
|||
try_again:
|
||||
ut_a(name);
|
||||
|
||||
if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW) {
|
||||
if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW
|
||||
|| create_mode == OS_FILE_OPEN_RETRY) {
|
||||
mode_str = "OPEN";
|
||||
create_flag = O_RDWR;
|
||||
} else if (create_mode == OS_FILE_CREATE) {
|
||||
|
@ -1316,6 +1318,23 @@ try_again:
|
|||
} else if (create_mode != OS_FILE_OPEN_RAW
|
||||
&& os_file_lock(file, name)) {
|
||||
*success = FALSE;
|
||||
if (create_mode == OS_FILE_OPEN_RETRY) {
|
||||
int i;
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: Retrying to lock the first data file\n",
|
||||
stderr);
|
||||
for (i = 0; i < 100; i++) {
|
||||
os_thread_sleep(1000000);
|
||||
if (!os_file_lock(file, name)) {
|
||||
*success = TRUE;
|
||||
return(file);
|
||||
}
|
||||
}
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: Unable to open the first data file\n",
|
||||
stderr);
|
||||
}
|
||||
close(file);
|
||||
file = -1;
|
||||
#endif
|
||||
} else {
|
||||
|
|
|
@ -2644,6 +2644,8 @@ row_sel_get_clust_rec_for_mysql(
|
|||
|
||||
clust_rec = btr_pcur_get_rec(prebuilt->clust_pcur);
|
||||
|
||||
prebuilt->clust_pcur->trx_if_known = trx;
|
||||
|
||||
/* Note: only if the search ends up on a non-infimum record is the
|
||||
low_match value the real match to the search tuple */
|
||||
|
||||
|
@ -3406,6 +3408,8 @@ shortcut_fails_too_big_rec:
|
|||
btr_pcur_open_with_no_init(index, search_tuple, mode,
|
||||
BTR_SEARCH_LEAF,
|
||||
pcur, 0, &mtr);
|
||||
|
||||
pcur->trx_if_known = trx;
|
||||
} else {
|
||||
if (mode == PAGE_CUR_G) {
|
||||
btr_pcur_open_at_index_side(TRUE, index,
|
||||
|
|
|
@ -789,6 +789,11 @@ open_or_create_data_files(
|
|||
files[i] = os_file_create(
|
||||
name, OS_FILE_OPEN_RAW, OS_FILE_NORMAL,
|
||||
OS_DATA_FILE, &ret);
|
||||
} else if (i == 0) {
|
||||
files[i] = os_file_create(
|
||||
name, OS_FILE_OPEN_RETRY,
|
||||
OS_FILE_NORMAL,
|
||||
OS_DATA_FILE, &ret);
|
||||
} else {
|
||||
files[i] = os_file_create(
|
||||
name, OS_FILE_OPEN, OS_FILE_NORMAL,
|
||||
|
|
|
@ -179,3 +179,6 @@ set @v1=null, @v2=1, @v3=1.1, @v4=now();
|
|||
select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4);
|
||||
coercibility(@v1) coercibility(@v2) coercibility(@v3) coercibility(@v4)
|
||||
2 2 2 2
|
||||
set session @honk=99;
|
||||
set one_shot @honk=99;
|
||||
ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
|
||||
|
|
|
@ -112,3 +112,10 @@ select FIELD( @var,'1it','Hit') as my_column;
|
|||
select @v, coercibility(@v);
|
||||
set @v1=null, @v2=1, @v3=1.1, @v4=now();
|
||||
select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4);
|
||||
|
||||
#
|
||||
# Bug #9286 SESSION/GLOBAL should be disallowed for user variables
|
||||
#
|
||||
set session @honk=99;
|
||||
--error 1382
|
||||
set one_shot @honk=99;
|
||||
|
|
|
@ -658,6 +658,7 @@ private:
|
|||
// Release all cursor operations in connection
|
||||
void releaseOps(NdbOperation*);
|
||||
void releaseScanOperations(NdbIndexScanOperation*);
|
||||
void releaseExecutedScanOperation(NdbIndexScanOperation*);
|
||||
|
||||
// Set the transaction identity of the transaction
|
||||
void setTransactionId(Uint64 aTransactionId);
|
||||
|
|
|
@ -813,6 +813,7 @@ Dbtup::updateFixedSizeTHManyWordNotNULL(Uint32* inBuffer,
|
|||
ndbrequire(i < regTabPtr->noOfCharsets);
|
||||
// not const in MySQL
|
||||
CHARSET_INFO* cs = regTabPtr->charsetArray[i];
|
||||
int not_used;
|
||||
const char* ssrc = (const char*)&inBuffer[tInBufIndex + 1];
|
||||
Uint32 lb, len;
|
||||
if (! NdbSqlUtil::get_var_length(typeId, ssrc, bytes, lb, len)) {
|
||||
|
@ -822,7 +823,7 @@ Dbtup::updateFixedSizeTHManyWordNotNULL(Uint32* inBuffer,
|
|||
}
|
||||
// fast fix bug#7340
|
||||
if (typeId != NDB_TYPE_TEXT &&
|
||||
(*cs->cset->well_formed_len)(cs, ssrc + lb, ssrc + lb + len, ZNIL) != len) {
|
||||
(*cs->cset->well_formed_len)(cs, ssrc + lb, ssrc + lb + len, ZNIL, ¬_used) != len) {
|
||||
ljam();
|
||||
terrorCode = ZINVALID_CHAR_FORMAT;
|
||||
return false;
|
||||
|
|
|
@ -948,6 +948,37 @@ NdbTransaction::releaseScanOperations(NdbIndexScanOperation* cursorOp)
|
|||
}
|
||||
}//NdbTransaction::releaseScanOperations()
|
||||
|
||||
/*****************************************************************************
|
||||
void releaseExecutedScanOperation();
|
||||
|
||||
Remark: Release scan op when hupp'ed trans closed (save memory)
|
||||
******************************************************************************/
|
||||
void
|
||||
NdbConnection::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
|
||||
{
|
||||
DBUG_ENTER("NdbConnection::releaseExecutedScanOperation");
|
||||
DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp))
|
||||
|
||||
// here is one reason to make op lists doubly linked
|
||||
if (m_firstExecutedScanOp == cursorOp) {
|
||||
m_firstExecutedScanOp = (NdbIndexScanOperation*)cursorOp->theNext;
|
||||
cursorOp->release();
|
||||
theNdb->releaseScanOperation(cursorOp);
|
||||
} else if (m_firstExecutedScanOp != NULL) {
|
||||
NdbIndexScanOperation* tOp = m_firstExecutedScanOp;
|
||||
while (tOp->theNext != NULL) {
|
||||
if (tOp->theNext == cursorOp) {
|
||||
tOp->theNext = cursorOp->theNext;
|
||||
cursorOp->release();
|
||||
theNdb->releaseScanOperation(cursorOp);
|
||||
break;
|
||||
}
|
||||
tOp = (NdbIndexScanOperation*)tOp->theNext;
|
||||
}
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}//NdbConnection::releaseExecutedScanOperation()
|
||||
|
||||
/*****************************************************************************
|
||||
NdbOperation* getNdbOperation(const char* aTableName);
|
||||
|
||||
|
|
23
sql/field.cc
23
sql/field.cc
|
@ -5777,7 +5777,7 @@ void Field_datetime::sql_type(String &res) const
|
|||
|
||||
int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||
{
|
||||
int error= 0;
|
||||
int error= 0, well_formed_error;
|
||||
uint32 not_used;
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
||||
|
@ -5802,9 +5802,10 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
as well as don't copy a malformed data.
|
||||
*/
|
||||
copy_length= field_charset->cset->well_formed_len(field_charset,
|
||||
from,from+length,
|
||||
field_length/
|
||||
field_charset->mbmaxlen);
|
||||
from,from+length,
|
||||
field_length/
|
||||
field_charset->mbmaxlen,
|
||||
&well_formed_error);
|
||||
memcpy(ptr,from,copy_length);
|
||||
if (copy_length < field_length) // Append spaces if shorter
|
||||
field_charset->cset->fill(field_charset,ptr+copy_length,
|
||||
|
@ -6152,7 +6153,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
uint32 not_used, copy_length;
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
||||
int error_code= 0;
|
||||
int error_code= 0, well_formed_error;
|
||||
enum MYSQL_ERROR::enum_warning_level level= MYSQL_ERROR::WARN_LEVEL_WARN;
|
||||
|
||||
/* Convert character set if necessary */
|
||||
|
@ -6172,7 +6173,8 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
copy_length= field_charset->cset->well_formed_len(field_charset,
|
||||
from,from+length,
|
||||
field_length/
|
||||
field_charset->mbmaxlen);
|
||||
field_charset->mbmaxlen,
|
||||
&well_formed_error);
|
||||
memcpy(ptr + length_bytes, from, copy_length);
|
||||
if (length_bytes == 1)
|
||||
*ptr= (uchar) copy_length;
|
||||
|
@ -6746,7 +6748,7 @@ void Field_blob::put_length(char *pos, uint32 length)
|
|||
|
||||
int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||
{
|
||||
int error= 0;
|
||||
int error= 0, well_formed_error;
|
||||
if (!length)
|
||||
{
|
||||
bzero(ptr,Field_blob::pack_length());
|
||||
|
@ -6778,9 +6780,10 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
the 'min()' call below.
|
||||
*/
|
||||
copy_length= field_charset->cset->well_formed_len(field_charset,
|
||||
from,from +
|
||||
min(length, copy_length),
|
||||
copy_length);
|
||||
from,from +
|
||||
min(length, copy_length),
|
||||
copy_length,
|
||||
&well_formed_error);
|
||||
if (copy_length < length)
|
||||
error= 1;
|
||||
Field_blob::store_length(copy_length);
|
||||
|
|
|
@ -505,10 +505,16 @@ void ha_close_connection(THD* thd)
|
|||
"beginning of transaction" and "beginning of statement").
|
||||
Only storage engines registered for the transaction/statement
|
||||
will know when to commit/rollback it.
|
||||
|
||||
NOTE
|
||||
trans_register_ha is idempotent - storage engine may register many
|
||||
times per transaction.
|
||||
|
||||
*/
|
||||
void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
|
||||
{
|
||||
THD_TRANS *trans;
|
||||
handlerton **ht;
|
||||
DBUG_ENTER("trans_register_ha");
|
||||
DBUG_PRINT("enter",("%s", all ? "all" : "stmt"));
|
||||
|
||||
|
@ -520,15 +526,12 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
|
|||
else
|
||||
trans= &thd->transaction.stmt;
|
||||
|
||||
handlerton **ht=trans->ht;
|
||||
while (*ht)
|
||||
{
|
||||
for (ht=trans->ht; *ht; ht++)
|
||||
if (*ht == ht_arg)
|
||||
DBUG_VOID_RETURN; /* already registered, return */
|
||||
ht++;
|
||||
}
|
||||
|
||||
trans->ht[trans->nht++]=ht_arg;
|
||||
DBUG_ASSERT(*ht == ht_arg);
|
||||
trans->no_2pc|=(ht_arg->prepare==0);
|
||||
if (thd->transaction.xid.is_null())
|
||||
thd->transaction.xid.set(thd->query_id);
|
||||
|
|
|
@ -7020,9 +7020,10 @@ IDENT_sys:
|
|||
if (thd->charset_is_system_charset)
|
||||
{
|
||||
CHARSET_INFO *cs= system_charset_info;
|
||||
int dummy_error;
|
||||
uint wlen= cs->cset->well_formed_len(cs, $1.str,
|
||||
$1.str+$1.length,
|
||||
$1.length);
|
||||
$1.length, &dummy_error);
|
||||
if (wlen < $1.length)
|
||||
{
|
||||
my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
|
||||
|
|
|
@ -6294,10 +6294,13 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*/
|
||||
static
|
||||
uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *b, const char *e, uint pos)
|
||||
const char *b, const char *e,
|
||||
uint pos, int *error)
|
||||
{
|
||||
const char *b0= b;
|
||||
const char *emb= e - 1; /* Last possible end of an MB character */
|
||||
|
||||
*error= 0;
|
||||
while (pos && b < e)
|
||||
{
|
||||
if ((uchar) b[0] < 128)
|
||||
|
@ -6313,6 +6316,7 @@ uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)),
|
|||
else
|
||||
{
|
||||
/* Wrong byte sequence */
|
||||
*error= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5413,9 +5413,10 @@ uint my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*/
|
||||
static
|
||||
uint my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *b, const char *e, uint pos)
|
||||
const char *b, const char *e, uint pos, int *error)
|
||||
{
|
||||
const char *b0= b;
|
||||
*error= 0;
|
||||
while (pos && b < e)
|
||||
{
|
||||
/*
|
||||
|
@ -5441,6 +5442,7 @@ uint my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
|||
else
|
||||
{
|
||||
/* Wrong byte sequence */
|
||||
*error= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8380,17 +8380,18 @@ my_jisx0212_uni_onechar(int code){
|
|||
|
||||
/*
|
||||
EUC-JP encoding subcomponents:
|
||||
[x00-x7F] # ASCII/JIS-Roman (one-byte/character)
|
||||
[x8E][xA0-xDF] # half-width katakana (two bytes/char)
|
||||
[x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 (three bytes/char)
|
||||
[x00-x7F] # ASCII/JIS-Roman (one-byte/character)
|
||||
[x8E][xA0-xDF] # half-width katakana (two bytes/char)
|
||||
[x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 (three bytes/char)
|
||||
[xA1-xFE][xA1-xFE] # JIS X 0208:1997 (two bytes/char)
|
||||
*/
|
||||
|
||||
static
|
||||
uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *beg, const char *end, uint pos)
|
||||
const char *beg, const char *end, uint pos, int *error)
|
||||
{
|
||||
const uchar *b= (uchar *) beg;
|
||||
*error=0;
|
||||
|
||||
for ( ; pos && b < (uchar*) end; pos--, b++)
|
||||
{
|
||||
|
@ -8408,6 +8409,7 @@ uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)),
|
|||
{
|
||||
if (*b >= 0xA0 && *b <= 0xDF)
|
||||
continue;
|
||||
*error=1;
|
||||
return chbeg - beg; /* invalid sequence */
|
||||
}
|
||||
|
||||
|
@ -8421,6 +8423,7 @@ uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)),
|
|||
if (ch >= 0xA1 && ch <= 0xFE &&
|
||||
*b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */
|
||||
continue;
|
||||
*error=1;
|
||||
return chbeg - beg; /* invalid sequence */
|
||||
}
|
||||
return b - (uchar *) beg;
|
||||
|
|
|
@ -264,18 +264,21 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
|
|||
}
|
||||
|
||||
|
||||
uint my_well_formed_len_mb(CHARSET_INFO *cs,
|
||||
const char *b, const char *e, uint pos)
|
||||
uint my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e,
|
||||
uint pos, int *error)
|
||||
{
|
||||
const char *b_start= b;
|
||||
|
||||
*error= 0;
|
||||
while (pos)
|
||||
{
|
||||
my_wc_t wc;
|
||||
int mblen;
|
||||
|
||||
if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0)
|
||||
{
|
||||
*error= b < e ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
b+= mblen;
|
||||
pos--;
|
||||
}
|
||||
|
|
|
@ -1122,11 +1122,11 @@ uint my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
|
||||
uint my_well_formed_len_8bit(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *start,
|
||||
const char *end,
|
||||
uint nchars)
|
||||
const char *start, const char *end,
|
||||
uint nchars, int *error)
|
||||
{
|
||||
uint nbytes= (uint) (end-start);
|
||||
*error= 0;
|
||||
return min(nbytes, nchars);
|
||||
}
|
||||
|
||||
|
|
|
@ -4586,9 +4586,11 @@ uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*/
|
||||
static
|
||||
uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *b, const char *e, uint pos)
|
||||
const char *b, const char *e,
|
||||
uint pos, int *error)
|
||||
{
|
||||
const char *b0= b;
|
||||
*error= 0;
|
||||
while (pos && b < e)
|
||||
{
|
||||
if ((uchar) b[0] < 128)
|
||||
|
@ -4609,6 +4611,7 @@ uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
else
|
||||
{
|
||||
/* Wrong byte sequence */
|
||||
*error= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1273,11 +1273,11 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
static
|
||||
uint my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *b,
|
||||
const char *e,
|
||||
uint nchars)
|
||||
const char *b, const char *e,
|
||||
uint nchars, int *error)
|
||||
{
|
||||
uint nbytes= (e-b) & ~ (uint)1;
|
||||
*error= 0;
|
||||
nchars*= 2;
|
||||
return min(nbytes, nchars);
|
||||
}
|
||||
|
|
|
@ -8253,11 +8253,12 @@ my_jisx0212_uni_onechar(int code){
|
|||
|
||||
static
|
||||
uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *beg, const char *end, uint pos)
|
||||
const char *beg, const char *end,
|
||||
uint pos, int *error)
|
||||
{
|
||||
const uchar *b= (uchar *) beg;
|
||||
|
||||
for ( ; pos && b < (uchar*) end; pos--, b++)
|
||||
for ( *error= 0 ; pos && b < (uchar*) end; pos--, b++)
|
||||
{
|
||||
char *chbeg;
|
||||
uint ch= *b;
|
||||
|
@ -8267,12 +8268,16 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
chbeg= (char *) b++;
|
||||
if (b >= (uchar *) end) /* need more bytes */
|
||||
{
|
||||
*error= 1;
|
||||
return chbeg - beg; /* unexpected EOL */
|
||||
}
|
||||
|
||||
if (ch == 0x8E) /* [x8E][xA0-xDF] */
|
||||
{
|
||||
if (*b >= 0xA0 && *b <= 0xDF)
|
||||
continue;
|
||||
*error= 1;
|
||||
return chbeg - beg; /* invalid sequence */
|
||||
}
|
||||
|
||||
|
@ -8280,12 +8285,16 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
{
|
||||
ch= *b++;
|
||||
if (b >= (uchar*) end)
|
||||
{
|
||||
*error= 1;
|
||||
return chbeg - beg; /* unexpected EOL */
|
||||
}
|
||||
}
|
||||
|
||||
if (ch >= 0xA1 && ch <= 0xFE &&
|
||||
*b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */
|
||||
continue;
|
||||
*error= 1;
|
||||
return chbeg - beg; /* invalid sequence */
|
||||
}
|
||||
return b - (uchar *) beg;
|
||||
|
|
Loading…
Reference in a new issue