Commit 4bf86d9e authored by unknown's avatar unknown

Merge paul@bk-internal.mysql.com:/home/bk/mysql-5.0

into kite-hub.kitebird.com:/src/extern/MySQL/bk/mysql-5.0

parents 507dbe23 d0676959
...@@ -47,7 +47,7 @@ my_bool _hash_init(HASH *hash, CHARSET_INFO *charset, ...@@ -47,7 +47,7 @@ my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
uint key_length, hash_get_key get_key, uint key_length, hash_get_key get_key,
void (*free_element)(void*), uint flags CALLER_INFO_PROTO); void (*free_element)(void*), uint flags CALLER_INFO_PROTO);
void hash_free(HASH *tree); void hash_free(HASH *tree);
void hash_reset(HASH *hash); void my_hash_reset(HASH *hash);
byte *hash_element(HASH *hash,uint idx); byte *hash_element(HASH *hash,uint idx);
gptr hash_search(HASH *info,const byte *key,uint length); gptr hash_search(HASH *info,const byte *key,uint length);
gptr hash_next(HASH *info,const byte *key,uint length); gptr hash_next(HASH *info,const byte *key,uint length);
......
...@@ -1300,7 +1300,7 @@ insert into t1 values('+ ', '+ ', '+ '); ...@@ -1300,7 +1300,7 @@ insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20); set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings: Warnings:
Warning 1265 Data truncated for column 'v' at row 1 Note 1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1; select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*') concat('*',v,'*',c,'*',t,'*')
*+ *+*+ * *+ *+*+ *
...@@ -1346,7 +1346,7 @@ t1 CREATE TABLE `t1` ( ...@@ -1346,7 +1346,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 ) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10); alter table t1 modify t varchar(10);
Warnings: Warnings:
Warning 1265 Data truncated for column 't' at row 2 Note 1265 Data truncated for column 't' at row 2
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -255,7 +255,7 @@ insert into t1 values('+ ', '+ ', '+ '); ...@@ -255,7 +255,7 @@ insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20); set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings: Warnings:
Warning 1265 Data truncated for column 'v' at row 1 Note 1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1; select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*') concat('*',v,'*',c,'*',t,'*')
*+ *+*+ * *+ *+*+ *
......
...@@ -571,7 +571,7 @@ insert into t1 values('+ ', '+ ', '+ '); ...@@ -571,7 +571,7 @@ insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20); set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings: Warnings:
Warning 1265 Data truncated for column 'v' at row 1 Note 1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1; select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*') concat('*',v,'*',c,'*',t,'*')
*+ *+*+ * *+ *+*+ *
...@@ -617,7 +617,7 @@ t1 CREATE TABLE `t1` ( ...@@ -617,7 +617,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10); alter table t1 modify t varchar(10);
Warnings: Warnings:
Warning 1265 Data truncated for column 't' at row 2 Note 1265 Data truncated for column 't' at row 2
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -529,3 +529,19 @@ count(*)-8 ...@@ -529,3 +529,19 @@ count(*)-8
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59'; select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
count(*)-9 count(*)-9
0 0
drop table t1;
create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2);
set autocommit=0;
begin;
select count(*) from t1;
count(*)
2
ALTER TABLE t1 ADD COLUMN c int;
select a from t1 where b = 2;
a
2
show tables;
Tables_in_test
t1
drop table t1;
...@@ -818,7 +818,6 @@ ERROR 01000: Data truncated for column 'col1' at row 1 ...@@ -818,7 +818,6 @@ ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('hellobob'); INSERT INTO t1 (col2) VALUES ('hellobob');
ERROR 01000: Data truncated for column 'col2' at row 1 ERROR 01000: Data truncated for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES ('hello '); INSERT INTO t1 (col2) VALUES ('hello ');
ERROR 01000: Data truncated for column 'col2' at row 1
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he'; UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
ERROR 01000: Data truncated for column 'col1' at row 2 ERROR 01000: Data truncated for column 'col1' at row 2
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he'; UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
...@@ -835,6 +834,7 @@ col1 col2 ...@@ -835,6 +834,7 @@ col1 col2
hello hello hello hello
he hellot he hellot
hello hello hello hello
NULL hello
hello hellob hello hellob
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (col1 enum('red','blue','green')); CREATE TABLE t1 (col1 enum('red','blue','green'));
......
...@@ -267,3 +267,21 @@ select count(*)-5 from t1 use index (ti) where ti < '10:11:11'; ...@@ -267,3 +267,21 @@ select count(*)-5 from t1 use index (ti) where ti < '10:11:11';
select count(*)-6 from t1 use index (ti) where ti <= '10:11:11'; select count(*)-6 from t1 use index (ti) where ti <= '10:11:11';
select count(*)-8 from t1 use index (ti) where ti < '23:59:59'; select count(*)-8 from t1 use index (ti) where ti < '23:59:59';
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59'; select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
drop table t1;
# bug#7798
create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2);
connect (con1,localhost,,,test);
connect (con2,localhost,,,test);
connection con1;
set autocommit=0;
begin;
select count(*) from t1;
connection con2;
ALTER TABLE t1 ADD COLUMN c int;
connection con1;
select a from t1 where b = 2;
show tables;
drop table t1;
...@@ -122,13 +122,13 @@ void hash_free(HASH *hash) ...@@ -122,13 +122,13 @@ void hash_free(HASH *hash)
Delete all elements from the hash (the hash itself is to be reused). Delete all elements from the hash (the hash itself is to be reused).
SYNOPSIS SYNOPSIS
hash_reset() my_hash_reset()
hash the hash to delete elements of hash the hash to delete elements of
*/ */
void hash_reset(HASH *hash) void my_hash_reset(HASH *hash)
{ {
DBUG_ENTER("hash_reset"); DBUG_ENTER("my_hash_reset");
DBUG_PRINT("enter",("hash: 0x%lxd",hash)); DBUG_PRINT("enter",("hash: 0x%lxd",hash));
hash_free_elements(hash); hash_free_elements(hash);
......
...@@ -54,7 +54,11 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, ...@@ -54,7 +54,11 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
strnmov(tmpThread->thread_name,p_thread_name,sizeof(tmpThread->thread_name)); strnmov(tmpThread->thread_name,p_thread_name,sizeof(tmpThread->thread_name));
pthread_attr_init(&thread_attr); pthread_attr_init(&thread_attr);
#if (SIZEOF_CHARP == 8)
pthread_attr_setstacksize(&thread_attr, 2*thread_stack_size);
#else
pthread_attr_setstacksize(&thread_attr, thread_stack_size); pthread_attr_setstacksize(&thread_attr, thread_stack_size);
#endif
#ifdef USE_PTHREAD_EXTRAS #ifdef USE_PTHREAD_EXTRAS
/* Guard stack overflow with a 2k databuffer */ /* Guard stack overflow with a 2k databuffer */
pthread_attr_setguardsize(&thread_attr, 2048); pthread_attr_setguardsize(&thread_attr, 2048);
......
...@@ -1419,6 +1419,6 @@ NdbOut & operator <<(NdbOut & out, SignalHeader & sh){ ...@@ -1419,6 +1419,6 @@ NdbOut & operator <<(NdbOut & out, SignalHeader & sh){
Transporter* Transporter*
TransporterRegistry::get_transporter(NodeId nodeId) { TransporterRegistry::get_transporter(NodeId nodeId) {
return theTransporters[nodeId]; return theTransporters[nodeId];
}; }
template class Vector<TransporterRegistry::Transporter_interface>; template class Vector<TransporterRegistry::Transporter_interface>;
...@@ -1920,7 +1920,6 @@ void Dbtc::packKeyData000Lab(Signal* signal, ...@@ -1920,7 +1920,6 @@ void Dbtc::packKeyData000Lab(Signal* signal,
Uint32 totalLen) Uint32 totalLen)
{ {
CacheRecord * const regCachePtr = cachePtr.p; CacheRecord * const regCachePtr = cachePtr.p;
UintR Tmp;
jam(); jam();
Uint32 len = 0; Uint32 len = 0;
...@@ -8646,14 +8645,16 @@ void Dbtc::execSCAN_TABREQ(Signal* signal) ...@@ -8646,14 +8645,16 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
apiConnectptr.i = scanTabReq->apiConnectPtr; apiConnectptr.i = scanTabReq->apiConnectPtr;
tabptr.i = scanTabReq->tableId; tabptr.i = scanTabReq->tableId;
if (apiConnectptr.i >= capiConnectFilesize || if (apiConnectptr.i >= capiConnectFilesize)
tabptr.i >= ctabrecFilesize) { {
jam(); jam();
warningHandlerLab(signal); warningHandlerLab(signal);
return; return;
}//if }//if
ptrAss(apiConnectptr, apiConnectRecord); ptrAss(apiConnectptr, apiConnectRecord);
ApiConnectRecord * transP = apiConnectptr.p; ApiConnectRecord * transP = apiConnectptr.p;
if (transP->apiConnectstate != CS_CONNECTED) { if (transP->apiConnectstate != CS_CONNECTED) {
jam(); jam();
// could be left over from TCKEYREQ rollback // could be left over from TCKEYREQ rollback
...@@ -8667,9 +8668,16 @@ void Dbtc::execSCAN_TABREQ(Signal* signal) ...@@ -8667,9 +8668,16 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
} else { } else {
jam(); jam();
errCode = ZSTATE_ERROR; errCode = ZSTATE_ERROR;
goto SCAN_TAB_error; goto SCAN_TAB_error_no_state_change;
} }
} }
if(tabptr.i >= ctabrecFilesize)
{
errCode = ZUNKNOWN_TABLE_ERROR;
goto SCAN_TAB_error;
}
ptrAss(tabptr, tableRecord); ptrAss(tabptr, tableRecord);
if ((aiLength == 0) || if ((aiLength == 0) ||
(!tabptr.p->checkTable(schemaVersion)) || (!tabptr.p->checkTable(schemaVersion)) ||
...@@ -8766,8 +8774,18 @@ void Dbtc::execSCAN_TABREQ(Signal* signal) ...@@ -8766,8 +8774,18 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
errCode = ZNO_SCANREC_ERROR; errCode = ZNO_SCANREC_ERROR;
goto SCAN_TAB_error; goto SCAN_TAB_error;
SCAN_TAB_error: SCAN_TAB_error:
jam(); jam();
/**
* Prepare for up coming ATTRINFO/KEYINFO
*/
transP->apiConnectstate = CS_ABORTING;
transP->abortState = AS_IDLE;
transP->transid[0] = transid1;
transP->transid[1] = transid2;
SCAN_TAB_error_no_state_change:
ScanTabRef * ref = (ScanTabRef*)&signal->theData[0]; ScanTabRef * ref = (ScanTabRef*)&signal->theData[0];
ref->apiConnectPtr = transP->ndbapiConnect; ref->apiConnectPtr = transP->ndbapiConnect;
ref->transId1 = transid1; ref->transId1 = transid1;
......
...@@ -14,19 +14,11 @@ ...@@ -14,19 +14,11 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/**
* O_DIRECT
*/
#if 0
//#ifdef NDB_LINUX
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#endif
#include <ndb_global.h> #include <ndb_global.h>
#include <my_sys.h>
#include <my_pthread.h>
#include "Error.hpp" #include <Error.hpp>
#include "AsyncFile.hpp" #include "AsyncFile.hpp"
#include <ErrorHandlingMacros.hpp> #include <ErrorHandlingMacros.hpp>
...@@ -35,15 +27,6 @@ ...@@ -35,15 +27,6 @@
#include <NdbThread.h> #include <NdbThread.h>
#include <signaldata/FsOpenReq.hpp> #include <signaldata/FsOpenReq.hpp>
#if 0
#ifdef HAVE_PREAD
// This is for pread and pwrite
#ifndef __USE_UNIX98
#define __USE_UNIX98
#endif
#endif
#endif
#if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE #if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE
#else #else
// For readv and writev // For readv and writev
...@@ -91,6 +74,7 @@ static int numAsyncFiles = 0; ...@@ -91,6 +74,7 @@ static int numAsyncFiles = 0;
extern "C" void * runAsyncFile(void* arg) extern "C" void * runAsyncFile(void* arg)
{ {
my_thread_init();
((AsyncFile*)arg)->run(); ((AsyncFile*)arg)->run();
return (NULL); return (NULL);
} }
...@@ -419,7 +403,7 @@ AsyncFile::readBuffer(char * buf, size_t size, off_t offset){ ...@@ -419,7 +403,7 @@ AsyncFile::readBuffer(char * buf, size_t size, off_t offset){
#elif defined NDB_OSE || defined NDB_SOFTOSE #elif defined NDB_OSE || defined NDB_SOFTOSE
return_value = ::read(theFd, buf, size); return_value = ::read(theFd, buf, size);
#else // UNIX #else // UNIX
return_value = ::pread(theFd, buf, size, offset); return_value = my_pread(theFd, buf, size, offset,0);
#endif #endif
#ifndef NDB_WIN32 #ifndef NDB_WIN32
if (return_value == -1 && errno == EINTR) { if (return_value == -1 && errno == EINTR) {
...@@ -653,7 +637,7 @@ AsyncFile::writeBuffer(const char * buf, size_t size, off_t offset, ...@@ -653,7 +637,7 @@ AsyncFile::writeBuffer(const char * buf, size_t size, off_t offset,
#elif defined NDB_OSE || defined NDB_SOFTOSE #elif defined NDB_OSE || defined NDB_SOFTOSE
return_value = ::write(theFd, buf, bytes_to_write); return_value = ::write(theFd, buf, bytes_to_write);
#else // UNIX #else // UNIX
return_value = ::pwrite(theFd, buf, bytes_to_write, offset); return_value = my_pwrite(theFd, buf, bytes_to_write, offset, 0);
#endif #endif
#ifndef NDB_WIN32 #ifndef NDB_WIN32
if (return_value == -1 && errno == EINTR) { if (return_value == -1 && errno == EINTR) {
...@@ -889,6 +873,7 @@ void AsyncFile::endReq() ...@@ -889,6 +873,7 @@ void AsyncFile::endReq()
{ {
// Thread is ended with return // Thread is ended with return
if (theWriteBuffer) NdbMem_Free(theWriteBuffer); if (theWriteBuffer) NdbMem_Free(theWriteBuffer);
my_thread_end();
NdbThread_Exit(0); NdbThread_Exit(0);
} }
......
...@@ -318,8 +318,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, ...@@ -318,8 +318,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
{ {
net->last_errno=CR_NAMEDPIPEOPEN_ERROR; net->last_errno=CR_NAMEDPIPEOPEN_ERROR;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
sprintf(net->last_error,ER(net->last_errno),host, unix_socket, my_snprintf(net->last_error, sizeof(net->last_error)-1,
(ulong) GetLastError()); ER(net->last_errno), host, unix_socket,
(ulong) GetLastError());
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
/* wait for for an other instance */ /* wait for for an other instance */
...@@ -327,8 +328,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, ...@@ -327,8 +328,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
{ {
net->last_errno=CR_NAMEDPIPEWAIT_ERROR; net->last_errno=CR_NAMEDPIPEWAIT_ERROR;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
sprintf(net->last_error,ER(net->last_errno),host, unix_socket, my_snprintf(net->last_error, sizeof(net->last_error)-1,
(ulong) GetLastError()); ER(net->last_errno), host, unix_socket,
(ulong) GetLastError());
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
} }
...@@ -336,8 +338,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, ...@@ -336,8 +338,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
{ {
net->last_errno=CR_NAMEDPIPEOPEN_ERROR; net->last_errno=CR_NAMEDPIPEOPEN_ERROR;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
sprintf(net->last_error,ER(net->last_errno),host, unix_socket, my_snprintf(net->last_error, sizeof(net->last_error)-1,
(ulong) GetLastError()); ER(net->last_errno), host, unix_socket,
(ulong) GetLastError());
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
dwMode = PIPE_READMODE_BYTE | PIPE_WAIT; dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
...@@ -346,8 +349,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, ...@@ -346,8 +349,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
CloseHandle( hPipe ); CloseHandle( hPipe );
net->last_errno=CR_NAMEDPIPESETSTATE_ERROR; net->last_errno=CR_NAMEDPIPESETSTATE_ERROR;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
sprintf(net->last_error,ER(net->last_errno),host, unix_socket, my_snprintf(net->last_error, sizeof(net->last_error)-1,
(ulong) GetLastError()); ER(net->last_errno),host, unix_socket,
(ulong) GetLastError());
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
*arg_host=host ; *arg_unix_socket=unix_socket; /* connect arg */ *arg_host=host ; *arg_unix_socket=unix_socket; /* connect arg */
...@@ -560,9 +564,11 @@ err: ...@@ -560,9 +564,11 @@ err:
net->last_errno=error_allow; net->last_errno=error_allow;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
if (error_allow == CR_SHARED_MEMORY_EVENT_ERROR) if (error_allow == CR_SHARED_MEMORY_EVENT_ERROR)
sprintf(net->last_error,ER(net->last_errno),suffix_pos,error_code); my_snprintf(net->last_error,sizeof(net->last_error)-1,
ER(net->last_errno),suffix_pos,error_code);
else else
sprintf(net->last_error,ER(net->last_errno),error_code); my_snprintf(net->last_error,sizeof(net->last_error)-1,
ER(net->last_errno),error_code);
return(INVALID_HANDLE_VALUE); return(INVALID_HANDLE_VALUE);
} }
return(handle_map); return(handle_map);
...@@ -792,7 +798,8 @@ static int check_license(MYSQL *mysql) ...@@ -792,7 +798,8 @@ static int check_license(MYSQL *mysql)
if (net->last_errno == ER_UNKNOWN_SYSTEM_VARIABLE) if (net->last_errno == ER_UNKNOWN_SYSTEM_VARIABLE)
{ {
net->last_errno= CR_WRONG_LICENSE; net->last_errno= CR_WRONG_LICENSE;
sprintf(net->last_error, ER(net->last_errno), required_license); my_snprintf(net->last_error, sizeof(net->last_error)-1,
ER(net->last_errno), required_license);
} }
return 1; return 1;
} }
...@@ -809,7 +816,8 @@ static int check_license(MYSQL *mysql) ...@@ -809,7 +816,8 @@ static int check_license(MYSQL *mysql)
strncmp(row[0], required_license, sizeof(required_license)))) strncmp(row[0], required_license, sizeof(required_license))))
{ {
net->last_errno= CR_WRONG_LICENSE; net->last_errno= CR_WRONG_LICENSE;
sprintf(net->last_error, ER(net->last_errno), required_license); my_snprintf(net->last_error, sizeof(net->last_error)-1,
ER(net->last_errno), required_license);
} }
mysql_free_result(res); mysql_free_result(res);
return net->last_errno; return net->last_errno;
...@@ -1647,7 +1655,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1647,7 +1655,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
sock=0; sock=0;
unix_socket = 0; unix_socket = 0;
host=mysql->options.shared_memory_base_name; host=mysql->options.shared_memory_base_name;
sprintf(host_info=buff, ER(CR_SHARED_MEMORY_CONNECTION), host); my_snprintf(host_info=buff, sizeof(buff)-1,
ER(CR_SHARED_MEMORY_CONNECTION), host);
} }
} }
#endif /* HAVE_SMEM */ #endif /* HAVE_SMEM */
...@@ -1667,7 +1676,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1667,7 +1676,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
{ {
net->last_errno=CR_SOCKET_CREATE_ERROR; net->last_errno=CR_SOCKET_CREATE_ERROR;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
sprintf(net->last_error,ER(net->last_errno),socket_errno); my_snprintf(net->last_error,sizeof(net->last_error)-1,
ER(net->last_errno),socket_errno);
goto error; goto error;
} }
net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE); net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE);
...@@ -1681,7 +1691,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1681,7 +1691,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
socket_errno)); socket_errno));
net->last_errno=CR_CONNECTION_ERROR; net->last_errno=CR_CONNECTION_ERROR;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno); my_snprintf(net->last_error,sizeof(net->last_error)-1,
ER(net->last_errno),unix_socket,socket_errno);
goto error; goto error;
} }
mysql->options.protocol=MYSQL_PROTOCOL_SOCKET; mysql->options.protocol=MYSQL_PROTOCOL_SOCKET;
...@@ -1711,7 +1722,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1711,7 +1722,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
else else
{ {
net->vio=vio_new_win32pipe(hPipe); net->vio=vio_new_win32pipe(hPipe);
sprintf(host_info=buff, ER(CR_NAMEDPIPE_CONNECTION), unix_socket); my_snprintf(host_info=buff, sizeof(buff)-1,
ER(CR_NAMEDPIPE_CONNECTION), unix_socket);
} }
} }
#endif #endif
...@@ -1724,7 +1736,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1724,7 +1736,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
port=mysql_port; port=mysql_port;
if (!host) if (!host)
host=LOCAL_HOST; host=LOCAL_HOST;
sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host); my_snprintf(host_info=buff,sizeof(buff)-1,ER(CR_TCP_CONNECTION),host);
DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port)); DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
thr_alarm_init(&alarmed); thr_alarm_init(&alarmed);
...@@ -1739,7 +1751,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1739,7 +1751,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
{ {
net->last_errno=CR_IPSOCK_ERROR; net->last_errno=CR_IPSOCK_ERROR;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
sprintf(net->last_error,ER(net->last_errno),socket_errno); my_snprintf(net->last_error,sizeof(net->last_error)-1,
ER(net->last_errno),socket_errno);
goto error; goto error;
} }
net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE); net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE);
...@@ -1766,7 +1779,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1766,7 +1779,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
my_gethostbyname_r_free(); my_gethostbyname_r_free();
net->last_errno=CR_UNKNOWN_HOST; net->last_errno=CR_UNKNOWN_HOST;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno); my_snprintf(net->last_error, sizeof(net->last_error)-1,
ER(CR_UNKNOWN_HOST), host, tmp_errno);
goto error; goto error;
} }
memcpy(&sock_addr.sin_addr, hp->h_addr, memcpy(&sock_addr.sin_addr, hp->h_addr,
...@@ -1781,7 +1795,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1781,7 +1795,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
host)); host));
net->last_errno= CR_CONN_HOST_ERROR; net->last_errno= CR_CONN_HOST_ERROR;
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno); my_snprintf(net->last_error, sizeof(net->last_error)-1,
ER(CR_CONN_HOST_ERROR), host, socket_errno);
goto error; goto error;
} }
} }
...@@ -1834,8 +1849,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1834,8 +1849,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
{ {
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
net->last_errno= CR_VERSION_ERROR; net->last_errno= CR_VERSION_ERROR;
sprintf(net->last_error, ER(CR_VERSION_ERROR), mysql->protocol_version, my_snprintf(net->last_error, sizeof(net->last_error)-1,
PROTOCOL_VERSION); ER(CR_VERSION_ERROR), mysql->protocol_version,
PROTOCOL_VERSION);
goto error; goto error;
} }
end=strend((char*) net->read_pos+1); end=strend((char*) net->read_pos+1);
......
...@@ -333,10 +333,8 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table) ...@@ -333,10 +333,8 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table)
if ((share->archive_write= gzopen(share->data_file_name, "ab")) == NULL) if ((share->archive_write= gzopen(share->data_file_name, "ab")) == NULL)
goto error2; goto error2;
if (my_hash_insert(&archive_open_tables, (byte*) share)) if (my_hash_insert(&archive_open_tables, (byte*) share))
goto error2;
thr_lock_init(&share->lock);
if (pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST))
goto error3; goto error3;
thr_lock_init(&share->lock);
} }
share->use_count++; share->use_count++;
pthread_mutex_unlock(&archive_mutex); pthread_mutex_unlock(&archive_mutex);
...@@ -344,14 +342,13 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table) ...@@ -344,14 +342,13 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table)
return share; return share;
error3: error3:
VOID(pthread_mutex_destroy(&share->mutex));
thr_lock_delete(&share->lock);
/* We close, but ignore errors since we already have errors */ /* We close, but ignore errors since we already have errors */
(void)gzclose(share->archive_write); (void)gzclose(share->archive_write);
error2: error2:
my_close(share->meta_file,MYF(0)); my_close(share->meta_file,MYF(0));
error: error:
pthread_mutex_unlock(&archive_mutex); pthread_mutex_unlock(&archive_mutex);
VOID(pthread_mutex_destroy(&share->mutex));
my_free((gptr) share, MYF(0)); my_free((gptr) share, MYF(0));
return NULL; return NULL;
...@@ -485,23 +482,30 @@ int ha_archive::create(const char *name, TABLE *table_arg, ...@@ -485,23 +482,30 @@ int ha_archive::create(const char *name, TABLE *table_arg,
if ((archive= gzdopen(create_file, "ab")) == NULL) if ((archive= gzdopen(create_file, "ab")) == NULL)
{ {
error= errno; error= errno;
delete_table(name); goto error2;
goto error;
} }
if (write_data_header(archive)) if (write_data_header(archive))
{ {
gzclose(archive); error= errno;
goto error2; goto error3;
} }
if (gzclose(archive)) if (gzclose(archive))
{
error= errno;
goto error2; goto error2;
}
my_close(create_file, MYF(0));
DBUG_RETURN(0); DBUG_RETURN(0);
error3:
/* We already have an error, so ignore results of gzclose. */
(void)gzclose(archive);
error2: error2:
error= errno; my_close(create_file, MYF(0));
delete_table(name); delete_table(name);
error: error:
/* Return error number, if we got one */ /* Return error number, if we got one */
DBUG_RETURN(error ? error : -1); DBUG_RETURN(error ? error : -1);
...@@ -751,7 +755,7 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt) ...@@ -751,7 +755,7 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt)
if ((rebuild_file= gzopen(data_file_name, "rb")) == NULL) if ((rebuild_file= gzopen(data_file_name, "rb")) == NULL)
DBUG_RETURN(errno ? errno : -1); DBUG_RETURN(errno ? errno : -1);
if (rc= read_data_header(rebuild_file)) if ((rc= read_data_header(rebuild_file)))
goto error; goto error;
/* /*
...@@ -823,7 +827,7 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) ...@@ -823,7 +827,7 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
while (read= gzread(reader, block, IO_SIZE)) while ((read= gzread(reader, block, IO_SIZE)))
gzwrite(writer, block, read); gzwrite(writer, block, read);
gzclose(reader); gzclose(reader);
......
...@@ -1386,7 +1386,7 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) ...@@ -1386,7 +1386,7 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
error= 1; error= 1;
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int2store(ptr,tmp); int2store(ptr,tmp);
} }
...@@ -1437,7 +1437,7 @@ int Field_short::store(double nr) ...@@ -1437,7 +1437,7 @@ int Field_short::store(double nr)
res=(int16) (int) nr; res=(int16) (int) nr;
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int2store(ptr,res); int2store(ptr,res);
} }
...@@ -1486,7 +1486,7 @@ int Field_short::store(longlong nr) ...@@ -1486,7 +1486,7 @@ int Field_short::store(longlong nr)
res=(int16) nr; res=(int16) nr;
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int2store(ptr,res); int2store(ptr,res);
} }
...@@ -1501,7 +1501,7 @@ double Field_short::val_real(void) ...@@ -1501,7 +1501,7 @@ double Field_short::val_real(void)
{ {
short j; short j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint2korr(ptr); j=sint2korr(ptr);
else else
#endif #endif
...@@ -1513,7 +1513,7 @@ longlong Field_short::val_int(void) ...@@ -1513,7 +1513,7 @@ longlong Field_short::val_int(void)
{ {
short j; short j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint2korr(ptr); j=sint2korr(ptr);
else else
#endif #endif
...@@ -1532,7 +1532,7 @@ String *Field_short::val_str(String *val_buffer, ...@@ -1532,7 +1532,7 @@ String *Field_short::val_str(String *val_buffer,
char *to=(char*) val_buffer->ptr(); char *to=(char*) val_buffer->ptr();
short j; short j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint2korr(ptr); j=sint2korr(ptr);
else else
#endif #endif
...@@ -1560,7 +1560,7 @@ int Field_short::cmp(const char *a_ptr, const char *b_ptr) ...@@ -1560,7 +1560,7 @@ int Field_short::cmp(const char *a_ptr, const char *b_ptr)
{ {
short a,b; short a,b;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
a=sint2korr(a_ptr); a=sint2korr(a_ptr);
b=sint2korr(b_ptr); b=sint2korr(b_ptr);
...@@ -1581,7 +1581,7 @@ int Field_short::cmp(const char *a_ptr, const char *b_ptr) ...@@ -1581,7 +1581,7 @@ int Field_short::cmp(const char *a_ptr, const char *b_ptr)
void Field_short::sort_string(char *to,uint length __attribute__((unused))) void Field_short::sort_string(char *to,uint length __attribute__((unused)))
{ {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (!table->db_low_byte_first) if (!table->s->db_low_byte_first)
{ {
if (unsigned_flag) if (unsigned_flag)
to[0] = ptr[0]; to[0] = ptr[0];
...@@ -1886,7 +1886,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) ...@@ -1886,7 +1886,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
store_tmp= (long) tmp; store_tmp= (long) tmp;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr, store_tmp); int4store(ptr, store_tmp);
} }
...@@ -1937,7 +1937,7 @@ int Field_long::store(double nr) ...@@ -1937,7 +1937,7 @@ int Field_long::store(double nr)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,res); int4store(ptr,res);
} }
...@@ -1988,7 +1988,7 @@ int Field_long::store(longlong nr) ...@@ -1988,7 +1988,7 @@ int Field_long::store(longlong nr)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,res); int4store(ptr,res);
} }
...@@ -2003,7 +2003,7 @@ double Field_long::val_real(void) ...@@ -2003,7 +2003,7 @@ double Field_long::val_real(void)
{ {
int32 j; int32 j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint4korr(ptr); j=sint4korr(ptr);
else else
#endif #endif
...@@ -2017,7 +2017,7 @@ longlong Field_long::val_int(void) ...@@ -2017,7 +2017,7 @@ longlong Field_long::val_int(void)
/* See the comment in Field_long::store(long long) */ /* See the comment in Field_long::store(long long) */
DBUG_ASSERT(table->in_use == current_thd); DBUG_ASSERT(table->in_use == current_thd);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint4korr(ptr); j=sint4korr(ptr);
else else
#endif #endif
...@@ -2035,7 +2035,7 @@ String *Field_long::val_str(String *val_buffer, ...@@ -2035,7 +2035,7 @@ String *Field_long::val_str(String *val_buffer,
char *to=(char*) val_buffer->ptr(); char *to=(char*) val_buffer->ptr();
int32 j; int32 j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint4korr(ptr); j=sint4korr(ptr);
else else
#endif #endif
...@@ -2061,7 +2061,7 @@ int Field_long::cmp(const char *a_ptr, const char *b_ptr) ...@@ -2061,7 +2061,7 @@ int Field_long::cmp(const char *a_ptr, const char *b_ptr)
{ {
int32 a,b; int32 a,b;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
a=sint4korr(a_ptr); a=sint4korr(a_ptr);
b=sint4korr(b_ptr); b=sint4korr(b_ptr);
...@@ -2080,7 +2080,7 @@ int Field_long::cmp(const char *a_ptr, const char *b_ptr) ...@@ -2080,7 +2080,7 @@ int Field_long::cmp(const char *a_ptr, const char *b_ptr)
void Field_long::sort_string(char *to,uint length __attribute__((unused))) void Field_long::sort_string(char *to,uint length __attribute__((unused)))
{ {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (!table->db_low_byte_first) if (!table->s->db_low_byte_first)
{ {
if (unsigned_flag) if (unsigned_flag)
to[0] = ptr[0]; to[0] = ptr[0];
...@@ -2146,7 +2146,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs) ...@@ -2146,7 +2146,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
check_int(from,len,end,cs)) check_int(from,len,end,cs))
error= 1; error= 1;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int8store(ptr,tmp); int8store(ptr,tmp);
} }
...@@ -2197,7 +2197,7 @@ int Field_longlong::store(double nr) ...@@ -2197,7 +2197,7 @@ int Field_longlong::store(double nr)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int8store(ptr,res); int8store(ptr,res);
} }
...@@ -2211,7 +2211,7 @@ int Field_longlong::store(double nr) ...@@ -2211,7 +2211,7 @@ int Field_longlong::store(double nr)
int Field_longlong::store(longlong nr) int Field_longlong::store(longlong nr)
{ {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int8store(ptr,nr); int8store(ptr,nr);
} }
...@@ -2226,7 +2226,7 @@ double Field_longlong::val_real(void) ...@@ -2226,7 +2226,7 @@ double Field_longlong::val_real(void)
{ {
longlong j; longlong j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
j=sint8korr(ptr); j=sint8korr(ptr);
} }
...@@ -2247,7 +2247,7 @@ longlong Field_longlong::val_int(void) ...@@ -2247,7 +2247,7 @@ longlong Field_longlong::val_int(void)
{ {
longlong j; longlong j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint8korr(ptr); j=sint8korr(ptr);
else else
#endif #endif
...@@ -2266,7 +2266,7 @@ String *Field_longlong::val_str(String *val_buffer, ...@@ -2266,7 +2266,7 @@ String *Field_longlong::val_str(String *val_buffer,
char *to=(char*) val_buffer->ptr(); char *to=(char*) val_buffer->ptr();
longlong j; longlong j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint8korr(ptr); j=sint8korr(ptr);
else else
#endif #endif
...@@ -2291,7 +2291,7 @@ int Field_longlong::cmp(const char *a_ptr, const char *b_ptr) ...@@ -2291,7 +2291,7 @@ int Field_longlong::cmp(const char *a_ptr, const char *b_ptr)
{ {
longlong a,b; longlong a,b;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
a=sint8korr(a_ptr); a=sint8korr(a_ptr);
b=sint8korr(b_ptr); b=sint8korr(b_ptr);
...@@ -2311,7 +2311,7 @@ int Field_longlong::cmp(const char *a_ptr, const char *b_ptr) ...@@ -2311,7 +2311,7 @@ int Field_longlong::cmp(const char *a_ptr, const char *b_ptr)
void Field_longlong::sort_string(char *to,uint length __attribute__((unused))) void Field_longlong::sort_string(char *to,uint length __attribute__((unused)))
{ {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (!table->db_low_byte_first) if (!table->s->db_low_byte_first)
{ {
if (unsigned_flag) if (unsigned_flag)
to[0] = ptr[0]; to[0] = ptr[0];
...@@ -2427,7 +2427,7 @@ int Field_float::store(double nr) ...@@ -2427,7 +2427,7 @@ int Field_float::store(double nr)
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float4store(ptr,j); float4store(ptr,j);
} }
...@@ -2448,7 +2448,7 @@ double Field_float::val_real(void) ...@@ -2448,7 +2448,7 @@ double Field_float::val_real(void)
{ {
float j; float j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float4get(j,ptr); float4get(j,ptr);
} }
...@@ -2462,7 +2462,7 @@ longlong Field_float::val_int(void) ...@@ -2462,7 +2462,7 @@ longlong Field_float::val_int(void)
{ {
float j; float j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float4get(j,ptr); float4get(j,ptr);
} }
...@@ -2478,7 +2478,7 @@ String *Field_float::val_str(String *val_buffer, ...@@ -2478,7 +2478,7 @@ String *Field_float::val_str(String *val_buffer,
{ {
float nr; float nr;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float4get(nr,ptr); float4get(nr,ptr);
} }
...@@ -2560,7 +2560,7 @@ int Field_float::cmp(const char *a_ptr, const char *b_ptr) ...@@ -2560,7 +2560,7 @@ int Field_float::cmp(const char *a_ptr, const char *b_ptr)
{ {
float a,b; float a,b;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float4get(a,a_ptr); float4get(a,a_ptr);
float4get(b,b_ptr); float4get(b,b_ptr);
...@@ -2580,7 +2580,7 @@ void Field_float::sort_string(char *to,uint length __attribute__((unused))) ...@@ -2580,7 +2580,7 @@ void Field_float::sort_string(char *to,uint length __attribute__((unused)))
{ {
float nr; float nr;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float4get(nr,ptr); float4get(nr,ptr);
} }
...@@ -2709,7 +2709,7 @@ int Field_double::store(double nr) ...@@ -2709,7 +2709,7 @@ int Field_double::store(double nr)
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float8store(ptr,nr); float8store(ptr,nr);
} }
...@@ -2730,7 +2730,7 @@ double Field_double::val_real(void) ...@@ -2730,7 +2730,7 @@ double Field_double::val_real(void)
{ {
double j; double j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float8get(j,ptr); float8get(j,ptr);
} }
...@@ -2744,7 +2744,7 @@ longlong Field_double::val_int(void) ...@@ -2744,7 +2744,7 @@ longlong Field_double::val_int(void)
{ {
double j; double j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float8get(j,ptr); float8get(j,ptr);
} }
...@@ -2760,7 +2760,7 @@ String *Field_double::val_str(String *val_buffer, ...@@ -2760,7 +2760,7 @@ String *Field_double::val_str(String *val_buffer,
{ {
double nr; double nr;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float8get(nr,ptr); float8get(nr,ptr);
} }
...@@ -2848,7 +2848,7 @@ int Field_double::cmp(const char *a_ptr, const char *b_ptr) ...@@ -2848,7 +2848,7 @@ int Field_double::cmp(const char *a_ptr, const char *b_ptr)
{ {
double a,b; double a,b;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float8get(a,a_ptr); float8get(a,a_ptr);
float8get(b,b_ptr); float8get(b,b_ptr);
...@@ -2871,7 +2871,7 @@ void Field_double::sort_string(char *to,uint length __attribute__((unused))) ...@@ -2871,7 +2871,7 @@ void Field_double::sort_string(char *to,uint length __attribute__((unused)))
{ {
double nr; double nr;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
float8get(nr,ptr); float8get(nr,ptr);
} }
...@@ -3047,7 +3047,7 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs) ...@@ -3047,7 +3047,7 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,tmp); int4store(ptr,tmp);
} }
...@@ -3106,7 +3106,7 @@ int Field_timestamp::store(longlong nr) ...@@ -3106,7 +3106,7 @@ int Field_timestamp::store(longlong nr)
nr, MYSQL_TIMESTAMP_DATETIME, 1); nr, MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,timestamp); int4store(ptr,timestamp);
} }
...@@ -3130,7 +3130,7 @@ longlong Field_timestamp::val_int(void) ...@@ -3130,7 +3130,7 @@ longlong Field_timestamp::val_int(void)
THD *thd= table->in_use; THD *thd= table->in_use;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
temp=uint4korr(ptr); temp=uint4korr(ptr);
else else
#endif #endif
...@@ -3160,7 +3160,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr) ...@@ -3160,7 +3160,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
val_buffer->length(field_length); val_buffer->length(field_length);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
temp=uint4korr(ptr); temp=uint4korr(ptr);
else else
#endif #endif
...@@ -3225,7 +3225,7 @@ bool Field_timestamp::get_date(TIME *ltime, uint fuzzydate) ...@@ -3225,7 +3225,7 @@ bool Field_timestamp::get_date(TIME *ltime, uint fuzzydate)
long temp; long temp;
THD *thd= table->in_use; THD *thd= table->in_use;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
temp=uint4korr(ptr); temp=uint4korr(ptr);
else else
#endif #endif
...@@ -3262,7 +3262,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr) ...@@ -3262,7 +3262,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr)
{ {
int32 a,b; int32 a,b;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
a=sint4korr(a_ptr); a=sint4korr(a_ptr);
b=sint4korr(b_ptr); b=sint4korr(b_ptr);
...@@ -3280,7 +3280,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr) ...@@ -3280,7 +3280,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr)
void Field_timestamp::sort_string(char *to,uint length __attribute__((unused))) void Field_timestamp::sort_string(char *to,uint length __attribute__((unused)))
{ {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (!table->db_low_byte_first) if (!table->s->db_low_byte_first)
{ {
to[0] = ptr[0]; to[0] = ptr[0];
to[1] = ptr[1]; to[1] = ptr[1];
...@@ -3309,7 +3309,7 @@ void Field_timestamp::set_time() ...@@ -3309,7 +3309,7 @@ void Field_timestamp::set_time()
long tmp= (long) table->in_use->query_start(); long tmp= (long) table->in_use->query_start();
set_notnull(); set_notnull();
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,tmp); int4store(ptr,tmp);
} }
...@@ -3702,7 +3702,7 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs) ...@@ -3702,7 +3702,7 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
from, len, MYSQL_TIMESTAMP_DATE, 1); from, len, MYSQL_TIMESTAMP_DATE, 1);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,tmp); int4store(ptr,tmp);
} }
...@@ -3730,7 +3730,7 @@ int Field_date::store(double nr) ...@@ -3730,7 +3730,7 @@ int Field_date::store(double nr)
else else
tmp=(long) rint(nr); tmp=(long) rint(nr);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,tmp); int4store(ptr,tmp);
} }
...@@ -3758,7 +3758,7 @@ int Field_date::store(longlong nr) ...@@ -3758,7 +3758,7 @@ int Field_date::store(longlong nr)
else else
tmp=(long) nr; tmp=(long) nr;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,tmp); int4store(ptr,tmp);
} }
...@@ -3784,7 +3784,7 @@ double Field_date::val_real(void) ...@@ -3784,7 +3784,7 @@ double Field_date::val_real(void)
{ {
int32 j; int32 j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint4korr(ptr); j=sint4korr(ptr);
else else
#endif #endif
...@@ -3796,7 +3796,7 @@ longlong Field_date::val_int(void) ...@@ -3796,7 +3796,7 @@ longlong Field_date::val_int(void)
{ {
int32 j; int32 j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint4korr(ptr); j=sint4korr(ptr);
else else
#endif #endif
...@@ -3811,7 +3811,7 @@ String *Field_date::val_str(String *val_buffer, ...@@ -3811,7 +3811,7 @@ String *Field_date::val_str(String *val_buffer,
val_buffer->alloc(field_length); val_buffer->alloc(field_length);
int32 tmp; int32 tmp;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
tmp=sint4korr(ptr); tmp=sint4korr(ptr);
else else
#endif #endif
...@@ -3829,7 +3829,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr) ...@@ -3829,7 +3829,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr)
{ {
int32 a,b; int32 a,b;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
a=sint4korr(a_ptr); a=sint4korr(a_ptr);
b=sint4korr(b_ptr); b=sint4korr(b_ptr);
...@@ -3847,7 +3847,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr) ...@@ -3847,7 +3847,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr)
void Field_date::sort_string(char *to,uint length __attribute__((unused))) void Field_date::sort_string(char *to,uint length __attribute__((unused)))
{ {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (!table->db_low_byte_first) if (!table->s->db_low_byte_first)
{ {
to[0] = ptr[0]; to[0] = ptr[0];
to[1] = ptr[1]; to[1] = ptr[1];
...@@ -4085,7 +4085,7 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs) ...@@ -4085,7 +4085,7 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
from, len, MYSQL_TIMESTAMP_DATETIME, 1); from, len, MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int8store(ptr,tmp); int8store(ptr,tmp);
} }
...@@ -4126,7 +4126,7 @@ int Field_datetime::store(longlong nr) ...@@ -4126,7 +4126,7 @@ int Field_datetime::store(longlong nr)
MYSQL_TIMESTAMP_DATETIME, 1); MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int8store(ptr,nr); int8store(ptr,nr);
} }
...@@ -4155,7 +4155,7 @@ int Field_datetime::store_time(TIME *ltime,timestamp_type type) ...@@ -4155,7 +4155,7 @@ int Field_datetime::store_time(TIME *ltime,timestamp_type type)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int8store(ptr,tmp); int8store(ptr,tmp);
} }
...@@ -4182,7 +4182,7 @@ longlong Field_datetime::val_int(void) ...@@ -4182,7 +4182,7 @@ longlong Field_datetime::val_int(void)
{ {
longlong j; longlong j;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
j=sint8korr(ptr); j=sint8korr(ptr);
else else
#endif #endif
...@@ -4202,7 +4202,7 @@ String *Field_datetime::val_str(String *val_buffer, ...@@ -4202,7 +4202,7 @@ String *Field_datetime::val_str(String *val_buffer,
int part3; int part3;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
tmp=sint8korr(ptr); tmp=sint8korr(ptr);
else else
#endif #endif
...@@ -4267,7 +4267,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr) ...@@ -4267,7 +4267,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr)
{ {
longlong a,b; longlong a,b;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
a=sint8korr(a_ptr); a=sint8korr(a_ptr);
b=sint8korr(b_ptr); b=sint8korr(b_ptr);
...@@ -4285,7 +4285,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr) ...@@ -4285,7 +4285,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr)
void Field_datetime::sort_string(char *to,uint length __attribute__((unused))) void Field_datetime::sort_string(char *to,uint length __attribute__((unused)))
{ {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (!table->db_low_byte_first) if (!table->s->db_low_byte_first)
{ {
to[0] = ptr[0]; to[0] = ptr[0];
to[1] = ptr[1]; to[1] = ptr[1];
...@@ -4672,6 +4672,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -4672,6 +4672,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
uint32 not_used, copy_length; uint32 not_used, copy_length;
char buff[80]; char buff[80];
String tmpstr(buff,sizeof(buff), &my_charset_bin); String tmpstr(buff,sizeof(buff), &my_charset_bin);
enum MYSQL_ERROR::enum_warning_level level= MYSQL_ERROR::WARN_LEVEL_WARN;
/* Convert character set if nesessary */ /* Convert character set if nesessary */
if (String::needs_conversion(length, cs, field_charset, &not_used)) if (String::needs_conversion(length, cs, field_charset, &not_used))
...@@ -4696,11 +4697,24 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -4696,11 +4697,24 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
*ptr= (uchar) copy_length; *ptr= (uchar) copy_length;
else else
int2store(ptr, copy_length); int2store(ptr, copy_length);
if (copy_length < length) // Check if we lost something other than just trailing spaces
if ((copy_length < length) && table->in_use->count_cuted_fields)
{
const char *end= from + length;
from+= copy_length;
from+= field_charset->cset->scan(field_charset, from, end, MY_SEQ_SPACES);
/*
If we lost only spaces then produce a NOTE, not a WARNING.
But if we have already had errors (e.g with charset conversion),
then don't reset level to NOTE.
*/
if (from == end && !error)
level= MYSQL_ERROR::WARN_LEVEL_NOTE;
error= 1; error= 1;
}
if (error) if (error)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1); set_warning(level, ER_WARN_DATA_TRUNCATED, 1);
return error; return error;
} }
...@@ -5156,7 +5170,7 @@ void Field_blob::store_length(uint32 number) ...@@ -5156,7 +5170,7 @@ void Field_blob::store_length(uint32 number)
break; break;
case 2: case 2:
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int2store(ptr,(unsigned short) number); int2store(ptr,(unsigned short) number);
} }
...@@ -5169,7 +5183,7 @@ void Field_blob::store_length(uint32 number) ...@@ -5169,7 +5183,7 @@ void Field_blob::store_length(uint32 number)
break; break;
case 4: case 4:
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,number); int4store(ptr,number);
} }
...@@ -5189,7 +5203,7 @@ uint32 Field_blob::get_length(const char *pos) ...@@ -5189,7 +5203,7 @@ uint32 Field_blob::get_length(const char *pos)
{ {
uint16 tmp; uint16 tmp;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
tmp=sint2korr(pos); tmp=sint2korr(pos);
else else
#endif #endif
...@@ -5202,7 +5216,7 @@ uint32 Field_blob::get_length(const char *pos) ...@@ -5202,7 +5216,7 @@ uint32 Field_blob::get_length(const char *pos)
{ {
uint32 tmp; uint32 tmp;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
tmp=uint4korr(pos); tmp=uint4korr(pos);
else else
#endif #endif
...@@ -5821,7 +5835,7 @@ void Field_enum::store_type(ulonglong value) ...@@ -5821,7 +5835,7 @@ void Field_enum::store_type(ulonglong value)
case 1: ptr[0]= (uchar) value; break; case 1: ptr[0]= (uchar) value; break;
case 2: case 2:
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int2store(ptr,(unsigned short) value); int2store(ptr,(unsigned short) value);
} }
...@@ -5832,7 +5846,7 @@ void Field_enum::store_type(ulonglong value) ...@@ -5832,7 +5846,7 @@ void Field_enum::store_type(ulonglong value)
case 3: int3store(ptr,(long) value); break; case 3: int3store(ptr,(long) value); break;
case 4: case 4:
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int4store(ptr,value); int4store(ptr,value);
} }
...@@ -5842,7 +5856,7 @@ void Field_enum::store_type(ulonglong value) ...@@ -5842,7 +5856,7 @@ void Field_enum::store_type(ulonglong value)
break; break;
case 8: case 8:
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
{ {
int8store(ptr,value); int8store(ptr,value);
} }
...@@ -5933,7 +5947,7 @@ longlong Field_enum::val_int(void) ...@@ -5933,7 +5947,7 @@ longlong Field_enum::val_int(void)
{ {
uint16 tmp; uint16 tmp;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
tmp=sint2korr(ptr); tmp=sint2korr(ptr);
else else
#endif #endif
...@@ -5946,7 +5960,7 @@ longlong Field_enum::val_int(void) ...@@ -5946,7 +5960,7 @@ longlong Field_enum::val_int(void)
{ {
uint32 tmp; uint32 tmp;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
tmp=uint4korr(ptr); tmp=uint4korr(ptr);
else else
#endif #endif
...@@ -5957,7 +5971,7 @@ longlong Field_enum::val_int(void) ...@@ -5957,7 +5971,7 @@ longlong Field_enum::val_int(void)
{ {
longlong tmp; longlong tmp;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
tmp=sint8korr(ptr); tmp=sint8korr(ptr);
else else
#endif #endif
......
...@@ -713,7 +713,7 @@ public: ...@@ -713,7 +713,7 @@ public:
if ((*null_value= is_null())) if ((*null_value= is_null()))
return 0; return 0;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->s->db_low_byte_first)
return sint4korr(ptr); return sint4korr(ptr);
#endif #endif
long tmp; long tmp;
......
...@@ -255,7 +255,7 @@ my_bool ...@@ -255,7 +255,7 @@ my_bool
my_net_write(NET *net,const char *packet,ulong len) my_net_write(NET *net,const char *packet,ulong len)
{ {
uchar buff[NET_HEADER_SIZE]; uchar buff[NET_HEADER_SIZE];
if (unlikely(!net->vio)) // nowhere to write if (unlikely(!net->vio)) /* nowhere to write */
return 0; return 0;
/* /*
Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH
......
...@@ -742,8 +742,8 @@ public: ...@@ -742,8 +742,8 @@ public:
/* Erase all statements (calls Statement destructor) */ /* Erase all statements (calls Statement destructor) */
void reset() void reset()
{ {
hash_reset(&names_hash); my_hash_reset(&names_hash);
hash_reset(&st_hash); my_hash_reset(&st_hash);
last_found_statement= 0; last_found_statement= 0;
} }
......
...@@ -172,7 +172,7 @@ void lex_start(THD *thd, uchar *buf,uint length) ...@@ -172,7 +172,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex->proc_list.first= 0; lex->proc_list.first= 0;
if (lex->spfuns.records) if (lex->spfuns.records)
hash_reset(&lex->spfuns); my_hash_reset(&lex->spfuns);
} }
void lex_end(LEX *lex) void lex_end(LEX *lex)
......
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