1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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

into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-marvel


client/mysqldump.c:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysys/my_malloc.c:
  Auto merged
mysys/my_static.c:
  Auto merged
mysys/safemalloc.c:
  Auto merged
ndb/src/mgmclient/CommandInterpreter.cpp:
  Auto merged
sql/ha_archive.cc:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql-common/client.c:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql-common/my_time.c:
  Auto merged
mysql-test/r/sp.result:
  Merged from main 5.0
sql/sql_load.cc:
  Merged from main 5.0
This commit is contained in:
unknown
2007-04-12 12:50:02 +03:00
153 changed files with 4347 additions and 1379 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3534,7 +3534,7 @@ void do_connect(struct st_command *command)
opt_ssl_capath, opt_ssl_cipher); opt_ssl_capath, opt_ssl_cipher);
#if MYSQL_VERSION_ID >= 50000 #if MYSQL_VERSION_ID >= 50000
/* Turn on ssl_verify_server_cert only if host is "localhost" */ /* Turn on ssl_verify_server_cert only if host is "localhost" */
opt_ssl_verify_server_cert= !strcmp(ds_connection_name.str, "localhost"); opt_ssl_verify_server_cert= !strcmp(ds_host.str, "localhost");
mysql_options(&next_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, mysql_options(&next_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert); &opt_ssl_verify_server_cert);
#endif #endif
@@ -6002,15 +6002,13 @@ int main(int argc, char **argv)
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
#if MYSQL_VERSION_ID >= 50000
opt_ssl_verify_server_cert= TRUE; /* Always on in mysqltest */
#endif
if (opt_use_ssl) if (opt_use_ssl)
{ {
mysql_ssl_set(&cur_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, mysql_ssl_set(&cur_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher); opt_ssl_capath, opt_ssl_cipher);
#if MYSQL_VERSION_ID >= 50000 #if MYSQL_VERSION_ID >= 50000
/* Turn on ssl_verify_server_cert only if host is "localhost" */
opt_ssl_verify_server_cert= opt_host && !strcmp(opt_host, "localhost");
mysql_options(&cur_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, mysql_options(&cur_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert); &opt_ssl_verify_server_cert);
#endif #endif

View File

@@ -1,3 +1,11 @@
*****************yaSSL Release notes, version 1.6.0 (2/22/07)
This release of yaSSL contains bug fixes, portability enhancements, and
better X509 support.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.5.8 (1/10/07) *****************yaSSL Release notes, version 1.5.8 (1/10/07)
This release of yaSSL contains bug fixes, portability enhancements, and This release of yaSSL contains bug fixes, portability enhancements, and

View File

@@ -49,13 +49,11 @@ const uint AUTO = 0xFEEDBEEF;
// Checking Policy should implement a check function that tests whether the // Checking Policy should implement a check function that tests whether the
// index is within the size limit of the array // index is within the size limit of the array
struct Check { struct Check {
Check() {}
void check(uint i, uint limit); void check(uint i, uint limit);
}; };
struct NoCheck { struct NoCheck {
NoCheck() {}
void check(uint, uint); void check(uint, uint);
}; };
@@ -193,7 +191,6 @@ inline void checked_delete(T* p)
// sets pointer to zero so safe for std conatiners // sets pointer to zero so safe for std conatiners
struct del_ptr_zero struct del_ptr_zero
{ {
del_ptr_zero() {}
template <typename T> template <typename T>
void operator()(T*& p) const void operator()(T*& p) const
{ {

View File

@@ -42,7 +42,6 @@ namespace yaSSL {
// Digest policy should implement a get_digest, update, and get sizes for pad // Digest policy should implement a get_digest, update, and get sizes for pad
// and digest // and digest
struct Digest : public virtual_base { struct Digest : public virtual_base {
Digest() {}
virtual void get_digest(byte*) = 0; virtual void get_digest(byte*) = 0;
virtual void get_digest(byte*, const byte*, unsigned int) = 0; virtual void get_digest(byte*, const byte*, unsigned int) = 0;
virtual void update(const byte*, unsigned int) = 0; virtual void update(const byte*, unsigned int) = 0;
@@ -54,7 +53,6 @@ struct Digest : public virtual_base {
// For use with NULL Digests // For use with NULL Digests
struct NO_MAC : public Digest { struct NO_MAC : public Digest {
NO_MAC() {}
void get_digest(byte*); void get_digest(byte*);
void get_digest(byte*, const byte*, unsigned int); void get_digest(byte*, const byte*, unsigned int);
void update(const byte*, unsigned int); void update(const byte*, unsigned int);
@@ -179,7 +177,6 @@ private:
// BulkCipher policy should implement encrypt, decrypt, get block size, // BulkCipher policy should implement encrypt, decrypt, get block size,
// and set keys for encrypt and decrypt // and set keys for encrypt and decrypt
struct BulkCipher : public virtual_base { struct BulkCipher : public virtual_base {
BulkCipher() {}
virtual void encrypt(byte*, const byte*, unsigned int) = 0; virtual void encrypt(byte*, const byte*, unsigned int) = 0;
virtual void decrypt(byte*, const byte*, unsigned int) = 0; virtual void decrypt(byte*, const byte*, unsigned int) = 0;
virtual void set_encryptKey(const byte*, const byte* = 0) = 0; virtual void set_encryptKey(const byte*, const byte* = 0) = 0;
@@ -193,7 +190,6 @@ struct BulkCipher : public virtual_base {
// For use with NULL Ciphers // For use with NULL Ciphers
struct NO_Cipher : public BulkCipher { struct NO_Cipher : public BulkCipher {
NO_Cipher() {}
void encrypt(byte*, const byte*, unsigned int) {} void encrypt(byte*, const byte*, unsigned int) {}
void decrypt(byte*, const byte*, unsigned int) {} void decrypt(byte*, const byte*, unsigned int) {}
void set_encryptKey(const byte*, const byte*) {} void set_encryptKey(const byte*, const byte*) {}
@@ -315,14 +311,12 @@ struct Auth : public virtual_base {
virtual bool verify(const byte*, unsigned int, const byte*, virtual bool verify(const byte*, unsigned int, const byte*,
unsigned int) = 0; unsigned int) = 0;
virtual uint get_signatureLength() const = 0; virtual uint get_signatureLength() const = 0;
Auth() {}
virtual ~Auth() {} virtual ~Auth() {}
}; };
// For use with NULL Authentication schemes // For use with NULL Authentication schemes
struct NO_Auth : public Auth { struct NO_Auth : public Auth {
NO_Auth() {}
void sign(byte*, const byte*, unsigned int, const RandomPool&) {} void sign(byte*, const byte*, unsigned int, const RandomPool&) {}
bool verify(const byte*, unsigned int, const byte*, unsigned int) bool verify(const byte*, unsigned int, const byte*, unsigned int)
{ return true; } { return true; }

View File

@@ -33,7 +33,8 @@
#include "opensslv.h" /* for version number */ #include "opensslv.h" /* for version number */
#include "rsa.h" #include "rsa.h"
#define YASSL_VERSION "1.5.8"
#define YASSL_VERSION "1.6.5"
#if defined(__cplusplus) #if defined(__cplusplus)
@@ -189,16 +190,17 @@ enum { /* ERR Constants */
EVP_R_BAD_DECRYPT = 2 EVP_R_BAD_DECRYPT = 2
}; };
#ifdef WIN /*
typedef SOCKET socket_t; Allow type used by SSL_set_fd to be changed, default to int
#else in order to be compatible with OpenSSL
typedef int socket_t; */
#ifndef YASSL_SOCKET_T_DEFINED
typedef int YASSL_SOCKET_T;
#endif #endif
SSL_CTX* SSL_CTX_new(SSL_METHOD*); SSL_CTX* SSL_CTX_new(SSL_METHOD*);
SSL* SSL_new(SSL_CTX*); SSL* SSL_new(SSL_CTX*);
int SSL_set_fd (SSL*, socket_t); int SSL_set_fd (SSL*, YASSL_SOCKET_T);
int SSL_connect(SSL*); int SSL_connect(SSL*);
int SSL_write(SSL*, const void*, int); int SSL_write(SSL*, const void*, int);
int SSL_read(SSL*, void*, int); int SSL_read(SSL*, void*, int);

View File

@@ -38,14 +38,16 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#include "openssl/ssl.h" /* for socket_t */
namespace yaSSL { namespace yaSSL {
typedef unsigned int uint; typedef unsigned int uint;
#ifndef _WIN32 #ifdef _WIN32
typedef SOCKET socket_t;
#else
typedef int socket_t;
const socket_t INVALID_SOCKET = -1; const socket_t INVALID_SOCKET = -1;
const int SD_RECEIVE = 0; const int SD_RECEIVE = 0;
const int SD_SEND = 1; const int SD_SEND = 1;

View File

@@ -64,7 +64,6 @@ struct RecordLayerHeader {
// base for all messages // base for all messages
struct Message : public virtual_base { struct Message : public virtual_base {
Message() {}
virtual input_buffer& set(input_buffer&) =0; virtual input_buffer& set(input_buffer&) =0;
virtual output_buffer& get(output_buffer&) const =0; virtual output_buffer& get(output_buffer&) const =0;
@@ -178,7 +177,6 @@ private:
class HandShakeBase : public virtual_base { class HandShakeBase : public virtual_base {
int length_; int length_;
public: public:
HandShakeBase() {}
int get_length() const; int get_length() const;
void set_length(int); void set_length(int);
@@ -196,7 +194,6 @@ public:
struct HelloRequest : public HandShakeBase { struct HelloRequest : public HandShakeBase {
HelloRequest() {}
input_buffer& set(input_buffer& in); input_buffer& set(input_buffer& in);
output_buffer& get(output_buffer& out) const; output_buffer& get(output_buffer& out) const;
@@ -330,7 +327,6 @@ private:
struct ServerKeyBase : public virtual_base { struct ServerKeyBase : public virtual_base {
ServerKeyBase() {}
virtual ~ServerKeyBase() {} virtual ~ServerKeyBase() {}
virtual void build(SSL&) {} virtual void build(SSL&) {}
virtual void read(SSL&, input_buffer&) {} virtual void read(SSL&, input_buffer&) {}
@@ -341,21 +337,15 @@ struct ServerKeyBase : public virtual_base {
// Server random number for FORTEZZA KEA // Server random number for FORTEZZA KEA
struct Fortezza_Server : public ServerKeyBase { struct Fortezza_Server : public ServerKeyBase {
Fortezza_Server() {}
opaque r_s_[FORTEZZA_MAX]; opaque r_s_[FORTEZZA_MAX];
}; };
struct SignatureBase : public virtual_base { struct SignatureBase : public virtual_base {
SignatureBase() {}
virtual ~SignatureBase() {} virtual ~SignatureBase() {}
}; };
struct anonymous_sa : public SignatureBase struct anonymous_sa : public SignatureBase {};
{
public:
anonymous_sa() {}
};
struct Hashes { struct Hashes {
@@ -365,13 +355,11 @@ struct Hashes {
struct rsa_sa : public SignatureBase { struct rsa_sa : public SignatureBase {
rsa_sa() {}
Hashes hashes_; Hashes hashes_;
}; };
struct dsa_sa : public SignatureBase { struct dsa_sa : public SignatureBase {
dsa_sa() {}
uint8 sha_[SHA_LEN]; uint8 sha_[SHA_LEN];
}; };
@@ -399,7 +387,6 @@ private:
// Server's RSA exchange // Server's RSA exchange
struct RSA_Server : public ServerKeyBase { struct RSA_Server : public ServerKeyBase {
RSA_Server() {}
ServerRSAParams params_; ServerRSAParams params_;
opaque* signature_; // signed rsa_sa hashes opaque* signature_; // signed rsa_sa hashes
}; };
@@ -474,7 +461,6 @@ struct PreMasterSecret {
struct ClientKeyBase : public virtual_base { struct ClientKeyBase : public virtual_base {
ClientKeyBase() {}
virtual ~ClientKeyBase() {} virtual ~ClientKeyBase() {}
virtual void build(SSL&) {} virtual void build(SSL&) {}
virtual void read(SSL&, input_buffer&) {} virtual void read(SSL&, input_buffer&) {}
@@ -505,7 +491,6 @@ private:
// Fortezza Key Parameters from page 29 // Fortezza Key Parameters from page 29
// hard code lengths cause only used here // hard code lengths cause only used here
struct FortezzaKeys : public ClientKeyBase { struct FortezzaKeys : public ClientKeyBase {
FortezzaKeys() {}
opaque y_c_ [128]; // client's Yc, public value opaque y_c_ [128]; // client's Yc, public value
opaque r_c_ [128]; // client's Rc opaque r_c_ [128]; // client's Rc
opaque y_signature_ [40]; // DSS signed public key opaque y_signature_ [40]; // DSS signed public key

View File

@@ -228,7 +228,6 @@ struct BIGNUM {
TaoCrypt::Integer), we need to explicitly state the namespace TaoCrypt::Integer), we need to explicitly state the namespace
here to let gcc 2.96 deduce the correct type. here to let gcc 2.96 deduce the correct type.
*/ */
BIGNUM() {}
yaSSL::Integer int_; yaSSL::Integer int_;
void assign(const byte* b, uint s) { int_.assign(b,s); } void assign(const byte* b, uint s) { int_.assign(b,s); }
}; };

View File

@@ -550,7 +550,6 @@ void RandomPool::Fill(opaque* dst, uint sz) const
// Implementation of DSS Authentication // Implementation of DSS Authentication
struct DSS::DSSImpl { struct DSS::DSSImpl {
DSSImpl() {}
void SetPublic (const byte*, unsigned int); void SetPublic (const byte*, unsigned int);
void SetPrivate(const byte*, unsigned int); void SetPrivate(const byte*, unsigned int);
TaoCrypt::DSA_PublicKey publicKey_; TaoCrypt::DSA_PublicKey publicKey_;
@@ -623,7 +622,6 @@ bool DSS::verify(const byte* sha_digest, unsigned int /* shaSz */,
// Implementation of RSA key interface // Implementation of RSA key interface
struct RSA::RSAImpl { struct RSA::RSAImpl {
RSAImpl() {}
void SetPublic (const byte*, unsigned int); void SetPublic (const byte*, unsigned int);
void SetPrivate(const byte*, unsigned int); void SetPrivate(const byte*, unsigned int);
TaoCrypt::RSA_PublicKey publicKey_; TaoCrypt::RSA_PublicKey publicKey_;

View File

@@ -58,6 +58,9 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
if (format != SSL_FILETYPE_ASN1 && format != SSL_FILETYPE_PEM) if (format != SSL_FILETYPE_ASN1 && format != SSL_FILETYPE_PEM)
return SSL_BAD_FILETYPE; return SSL_BAD_FILETYPE;
if (file == NULL || !file[0])
return SSL_BAD_FILE;
FILE* input = fopen(file, "rb"); FILE* input = fopen(file, "rb");
if (!input) if (!input)
return SSL_BAD_FILE; return SSL_BAD_FILE;
@@ -229,7 +232,7 @@ void SSL_free(SSL* ssl)
} }
int SSL_set_fd(SSL* ssl, socket_t fd) int SSL_set_fd(SSL* ssl, YASSL_SOCKET_T fd)
{ {
ssl->useSocket().set_fd(fd); ssl->useSocket().set_fd(fd);
return SSL_SUCCESS; return SSL_SUCCESS;
@@ -950,7 +953,7 @@ void ERR_print_errors_fp(FILE* /*fp*/)
char* ERR_error_string(unsigned long errNumber, char* buffer) char* ERR_error_string(unsigned long errNumber, char* buffer)
{ {
static char* msg = (char*) "Please supply a buffer for error string"; static char* msg = (char*)"Please supply a buffer for error string";
if (buffer) { if (buffer) {
SetErrorString(YasslError(errNumber), buffer); SetErrorString(YasslError(errNumber), buffer);

View File

@@ -1,4 +1,15 @@
TaoCrypt release 0.9.0 09/18/2006 TaoCrypt release 0.9.2 02/5/2007
This release includes bug fixes, portability enhancements, and some
optimiations.
See 0.9.0 for build instructions.
******************TaoCrypt release 0.9.0 09/18/2006
This is the first release of TaoCrypt, it was previously only included with This is the first release of TaoCrypt, it was previously only included with
yaSSL. TaoCrypt is highly portable and fast, its features include: yaSSL. TaoCrypt is highly portable and fast, its features include:

View File

@@ -65,7 +65,7 @@ int main(int argc, char** argv)
const int megs = 5; // how much to test const int megs = 5; // how much to test
const byte global_key[] = const byte key[] =
{ {
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10, 0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
@@ -81,19 +81,19 @@ const byte iv[] =
}; };
byte global_plain [1024*1024]; byte plain [1024*1024];
byte global_cipher[1024*1024]; byte cipher[1024*1024];
void bench_des() void bench_des()
{ {
DES_EDE3_CBC_Encryption enc; DES_EDE3_CBC_Encryption enc;
enc.SetKey(global_key, 16, iv); enc.SetKey(key, 16, iv);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(global_plain, global_cipher, sizeof(global_plain)); enc.Process(plain, cipher, sizeof(plain));
double total = current_time() - start; double total = current_time() - start;
@@ -107,12 +107,12 @@ void bench_des()
void bench_aes(bool show) void bench_aes(bool show)
{ {
AES_CBC_Encryption enc; AES_CBC_Encryption enc;
enc.SetKey(global_key, 16, iv); enc.SetKey(key, 16, iv);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(global_plain, global_cipher, sizeof(global_plain)); enc.Process(plain, cipher, sizeof(plain));
double total = current_time() - start; double total = current_time() - start;
@@ -127,12 +127,12 @@ void bench_aes(bool show)
void bench_twofish() void bench_twofish()
{ {
Twofish_CBC_Encryption enc; Twofish_CBC_Encryption enc;
enc.SetKey(global_key, 16, iv); enc.SetKey(key, 16, iv);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(global_plain, global_cipher, sizeof(global_plain)); enc.Process(plain, cipher, sizeof(plain));
double total = current_time() - start; double total = current_time() - start;
@@ -147,12 +147,12 @@ void bench_twofish()
void bench_blowfish() void bench_blowfish()
{ {
Blowfish_CBC_Encryption enc; Blowfish_CBC_Encryption enc;
enc.SetKey(global_key, 16, iv); enc.SetKey(key, 16, iv);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(global_plain, global_cipher, sizeof(global_plain)); enc.Process(plain, cipher, sizeof(plain));
double total = current_time() - start; double total = current_time() - start;
@@ -166,12 +166,12 @@ void bench_blowfish()
void bench_arc4() void bench_arc4()
{ {
ARC4 enc; ARC4 enc;
enc.SetKey(global_key, 16); enc.SetKey(key, 16);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(global_cipher, global_plain, sizeof(global_plain)); enc.Process(cipher, plain, sizeof(plain));
double total = current_time() - start; double total = current_time() - start;
@@ -191,7 +191,7 @@ void bench_md5()
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
hash.Update(global_plain, sizeof(global_plain)); hash.Update(plain, sizeof(plain));
hash.Final(digest); hash.Final(digest);
@@ -213,7 +213,7 @@ void bench_sha()
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
hash.Update(global_plain, sizeof(global_plain)); hash.Update(plain, sizeof(plain));
hash.Final(digest); hash.Final(digest);
@@ -241,7 +241,7 @@ void bench_ripemd()
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
hash.Update(global_plain, sizeof(global_plain)); hash.Update(plain, sizeof(plain));
hash.Final(digest); hash.Final(digest);

View File

@@ -40,7 +40,6 @@ class TAOCRYPT_NO_VTABLE AbstractGroup : public virtual_base
public: public:
typedef Integer Element; typedef Integer Element;
AbstractGroup() {}
virtual ~AbstractGroup() {} virtual ~AbstractGroup() {}
virtual bool Equal(const Element &a, const Element &b) const =0; virtual bool Equal(const Element &a, const Element &b) const =0;
@@ -95,7 +94,6 @@ private:
class MultiplicativeGroupT : public AbstractGroup class MultiplicativeGroupT : public AbstractGroup
{ {
public: public:
MultiplicativeGroupT() {}
const AbstractRing& GetRing() const const AbstractRing& GetRing() const
{return *m_pRing;} {return *m_pRing;}
@@ -147,7 +145,6 @@ class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain
: public AbstractRing : public AbstractRing
{ {
public: public:
AbstractEuclideanDomain() {}
typedef Integer Element; typedef Integer Element;
virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a, virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a,

View File

@@ -41,7 +41,6 @@ enum { DES_BLOCK_SIZE = 8, DES_KEY_SIZE = 32 };
class BasicDES { class BasicDES {
public: public:
BasicDES() {}
void SetKey(const byte*, word32, CipherDir dir); void SetKey(const byte*, word32, CipherDir dir);
void RawProcessBlock(word32&, word32&) const; void RawProcessBlock(word32&, word32&) const;
protected: protected:

View File

@@ -31,7 +31,6 @@ namespace TaoCrypt {
// HASH // HASH
class HASH : public virtual_base { class HASH : public virtual_base {
public: public:
HASH() {}
virtual ~HASH() {} virtual ~HASH() {}
virtual void Update(const byte*, word32) = 0; virtual void Update(const byte*, word32) = 0;
@@ -58,8 +57,7 @@ public:
word32 GetBitCountLo() const { return loLen_ << 3; } word32 GetBitCountLo() const { return loLen_ << 3; }
word32 GetBitCountHi() const { return (loLen_ >> (8*sizeof(loLen_) - 3)) + word32 GetBitCountHi() const { return (loLen_ >> (8*sizeof(loLen_) - 3)) +
(hiLen_ << 3); } (hiLen_ << 3); }
enum { MaxDigestSz = 8, MaxBufferSz = 64 };
enum { MaxDigestSz = 5, MaxBufferSz = 64 };
protected: protected:
typedef word32 HashLengthType; typedef word32 HashLengthType;
word32 buffLen_; // in bytes word32 buffLen_; // in bytes
@@ -74,6 +72,38 @@ protected:
}; };
#ifdef WORD64_AVAILABLE
// 64-bit HASH with Transform
class HASH64withTransform : public HASH {
public:
HASH64withTransform(word32 digSz, word32 buffSz);
virtual ~HASH64withTransform() {}
virtual ByteOrder getByteOrder() const = 0;
virtual word32 getPadSize() const = 0;
virtual void Update(const byte*, word32);
virtual void Final(byte*);
word32 GetBitCountLo() const { return loLen_ << 3; }
word32 GetBitCountHi() const { return (loLen_ >> (8*sizeof(loLen_) - 3)) +
(hiLen_ << 3); }
enum { MaxDigestSz = 8, MaxBufferSz = 128 };
protected:
typedef word32 HashLengthType;
word32 buffLen_; // in bytes
HashLengthType loLen_; // length in bytes
HashLengthType hiLen_; // length in bytes
word64 digest_[MaxDigestSz];
word64 buffer_[MaxBufferSz / sizeof(word64)];
virtual void Transform() = 0;
void AddLength(word32);
};
#endif // WORD64_AVAILABLE
} // namespace } // namespace

View File

@@ -109,11 +109,11 @@ void HMAC<T>::KeyInnerHash()
// Update // Update
template <class T> template <class T>
void HMAC<T>::Update(const byte* msg_arg, word32 length) void HMAC<T>::Update(const byte* msg, word32 length)
{ {
if (!innerHashKeyed_) if (!innerHashKeyed_)
KeyInnerHash(); KeyInnerHash();
mac_.Update(msg_arg, length); mac_.Update(msg, length);
} }

View File

@@ -464,6 +464,25 @@ inline word32 ByteReverse(word32 value)
} }
#ifdef WORD64_AVAILABLE
inline word64 ByteReverse(word64 value)
{
#ifdef TAOCRYPT_SLOW_WORD64
return (word64(ByteReverse(word32(value))) << 32) |
ByteReverse(word32(value>>32));
#else
value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) |
((value & W64LIT(0x00FF00FF00FF00FF)) << 8);
value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) |
((value & W64LIT(0x0000FFFF0000FFFF)) << 16);
return rotlFixed(value, 32U);
#endif
}
#endif // WORD64_AVAILABLE
template <typename T> template <typename T>
inline void ByteReverse(T* out, const T* in, word32 byteCount) inline void ByteReverse(T* out, const T* in, word32 byteCount)
{ {

View File

@@ -37,8 +37,8 @@ public:
typedef int RandomizationParameter; typedef int RandomizationParameter;
typedef Integer Element; typedef Integer Element;
ModularArithmetic(const Integer &modulus_arg = Integer::One()) ModularArithmetic(const Integer &modulus = Integer::One())
: modulus(modulus_arg), result((word)0, modulus_arg.reg_.size()) {} : modulus(modulus), result((word)0, modulus.reg_.size()) {}
ModularArithmetic(const ModularArithmetic &ma) ModularArithmetic(const ModularArithmetic &ma)
: AbstractRing(), : AbstractRing(),

View File

@@ -42,8 +42,8 @@ public:
{ cipher_.Process(c, p, sz); } { cipher_.Process(c, p, sz); }
void SetKey(const byte* k, word32 sz) void SetKey(const byte* k, word32 sz)
{ cipher_.SetKey(k, sz, DIR); } { cipher_.SetKey(k, sz, DIR); }
void SetKey(const byte* k, word32 sz, const byte* iv_arg) void SetKey(const byte* k, word32 sz, const byte* iv)
{ cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv_arg); } { cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv); }
private: private:
T cipher_; T cipher_;

View File

@@ -131,7 +131,6 @@ private:
// block type 2 padding // block type 2 padding
class RSA_BlockType2 { class RSA_BlockType2 {
public: public:
RSA_BlockType2() {}
void Pad(const byte*, word32, byte*, word32, void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const; RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const; word32 UnPad(const byte*, word32, byte*) const;
@@ -141,7 +140,6 @@ public:
// block type 1 padding // block type 1 padding
class RSA_BlockType1 { class RSA_BlockType1 {
public: public:
RSA_BlockType1() {}
void Pad(const byte*, word32, byte*, word32, void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const; RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const; word32 UnPad(const byte*, word32, byte*) const;
@@ -176,27 +174,25 @@ public:
// Public Encrypt // Public Encrypt
template<class Pad> template<class Pad>
void RSA_Encryptor<Pad>::Encrypt(const byte* plain_arg, word32 sz, void RSA_Encryptor<Pad>::Encrypt(const byte* plain, word32 sz, byte* cipher,
byte* cipher_arg, RandomNumberGenerator& rng)
RandomNumberGenerator& rng_arg)
{ {
PK_Lengths lengths(key_.GetModulus()); PK_Lengths lengths(key_.GetModulus());
assert(sz <= lengths.FixedMaxPlaintextLength()); assert(sz <= lengths.FixedMaxPlaintextLength());
ByteBlock paddedBlock(lengths.PaddedBlockByteLength()); ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
padding_.Pad(plain_arg, sz, paddedBlock.get_buffer(), padding_.Pad(plain, sz, paddedBlock.get_buffer(),
lengths.PaddedBlockBitLength(), rng_arg); lengths.PaddedBlockBitLength(), rng);
key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())). key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())).
Encode(cipher_arg, lengths.FixedCiphertextLength()); Encode(cipher, lengths.FixedCiphertextLength());
} }
// Private Decrypt // Private Decrypt
template<class Pad> template<class Pad>
word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher_arg, word32 sz, word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
byte* plain_arg, RandomNumberGenerator& rng)
RandomNumberGenerator& rng_arg)
{ {
PK_Lengths lengths(key_.GetModulus()); PK_Lengths lengths(key_.GetModulus());
assert(sz == lengths.FixedCiphertextLength()); assert(sz == lengths.FixedCiphertextLength());
@@ -205,29 +201,29 @@ word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher_arg, word32 sz,
return 0; return 0;
ByteBlock paddedBlock(lengths.PaddedBlockByteLength()); ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
Integer x = key_.CalculateInverse(rng_arg, Integer(cipher_arg, Integer x = key_.CalculateInverse(rng, Integer(cipher,
lengths.FixedCiphertextLength()).Ref()); lengths.FixedCiphertextLength()).Ref());
if (x.ByteCount() > paddedBlock.size()) if (x.ByteCount() > paddedBlock.size())
x = Integer::Zero(); // don't return false, prevents timing attack x = Integer::Zero(); // don't return false, prevents timing attack
x.Encode(paddedBlock.get_buffer(), paddedBlock.size()); x.Encode(paddedBlock.get_buffer(), paddedBlock.size());
return padding_.UnPad(paddedBlock.get_buffer(), return padding_.UnPad(paddedBlock.get_buffer(),
lengths.PaddedBlockBitLength(), plain_arg); lengths.PaddedBlockBitLength(), plain);
} }
// Private SSL type (block 1) Encrypt // Private SSL type (block 1) Encrypt
template<class Pad> template<class Pad>
void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig, void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig,
RandomNumberGenerator& rng_arg) RandomNumberGenerator& rng)
{ {
RSA_PublicKey inverse; RSA_PublicKey inverse;
inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent()); inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent());
RSA_Encryptor<RSA_BlockType1> enc(inverse); // SSL Type RSA_Encryptor<RSA_BlockType1> enc(inverse); // SSL Type
enc.Encrypt(message, sz, sig, rng_arg); enc.Encrypt(message, sz, sig, rng);
} }
word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain_arg); word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain);
// Public SSL type (block 1) Decrypt // Public SSL type (block 1) Decrypt
@@ -235,11 +231,11 @@ template<class Pad>
bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz, bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz,
const byte* sig) const byte* sig)
{ {
ByteBlock local_plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength()); ByteBlock plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
if (SSL_Decrypt(key_, sig, local_plain.get_buffer()) != sz) if (SSL_Decrypt(key_, sig, plain.get_buffer()) != sz)
return false; // not right justified or bad padding return false; // not right justified or bad padding
if ( (memcmp(local_plain.get_buffer(), message, sz)) == 0) if ( (memcmp(plain.get_buffer(), message, sz)) == 0)
return true; return true;
return false; return false;
} }

View File

@@ -64,6 +64,103 @@ inline void swap(SHA& a, SHA& b)
a.Swap(b); a.Swap(b);
} }
// SHA-256 digest
class SHA256 : public HASHwithTransform {
public:
enum { BLOCK_SIZE = 64, DIGEST_SIZE = 32, PAD_SIZE = 56,
TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes
SHA256() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE)
{ Init(); }
ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
word32 getBlockSize() const { return BLOCK_SIZE; }
word32 getDigestSize() const { return DIGEST_SIZE; }
word32 getPadSize() const { return PAD_SIZE; }
void Init();
SHA256(const SHA256&);
SHA256& operator= (const SHA256&);
void Swap(SHA256&);
private:
void Transform();
};
// SHA-224 digest
class SHA224 : public HASHwithTransform {
public:
enum { BLOCK_SIZE = 64, DIGEST_SIZE = 28, PAD_SIZE = 56,
TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes
SHA224() : HASHwithTransform(SHA256::DIGEST_SIZE /sizeof(word32),BLOCK_SIZE)
{ Init(); }
ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
word32 getBlockSize() const { return BLOCK_SIZE; }
word32 getDigestSize() const { return DIGEST_SIZE; }
word32 getPadSize() const { return PAD_SIZE; }
void Init();
SHA224(const SHA224&);
SHA224& operator= (const SHA224&);
void Swap(SHA224&);
private:
void Transform();
};
#ifdef WORD64_AVAILABLE
// SHA-512 digest
class SHA512 : public HASH64withTransform {
public:
enum { BLOCK_SIZE = 128, DIGEST_SIZE = 64, PAD_SIZE = 112,
TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes
SHA512() : HASH64withTransform(DIGEST_SIZE / sizeof(word64), BLOCK_SIZE)
{ Init(); }
ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
word32 getBlockSize() const { return BLOCK_SIZE; }
word32 getDigestSize() const { return DIGEST_SIZE; }
word32 getPadSize() const { return PAD_SIZE; }
void Init();
SHA512(const SHA512&);
SHA512& operator= (const SHA512&);
void Swap(SHA512&);
private:
void Transform();
};
// SHA-384 digest
class SHA384 : public HASH64withTransform {
public:
enum { BLOCK_SIZE = 128, DIGEST_SIZE = 48, PAD_SIZE = 112,
TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes
SHA384() : HASH64withTransform(SHA512::DIGEST_SIZE/ sizeof(word64),
BLOCK_SIZE)
{ Init(); }
ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
word32 getBlockSize() const { return BLOCK_SIZE; }
word32 getDigestSize() const { return DIGEST_SIZE; }
word32 getPadSize() const { return PAD_SIZE; }
void Init();
SHA384(const SHA384&);
SHA384& operator= (const SHA384&);
void Swap(SHA384&);
private:
void Transform();
};
#endif // WORD64_AVAILABLE
} // namespace } // namespace

View File

@@ -62,11 +62,7 @@ MK_FUNDAMENTAL_TYPE(unsigned long)
MK_FUNDAMENTAL_TYPE(float) MK_FUNDAMENTAL_TYPE(float)
MK_FUNDAMENTAL_TYPE( double) MK_FUNDAMENTAL_TYPE( double)
MK_FUNDAMENTAL_TYPE(long double)
#ifdef LONG_DOUBLE_IS_DISTINCT_TYPE
// Don't define by default as this gives warnings on power mac
MK_FUNDAMENTAL_TYPE(long double)
#endif
#if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE) #if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE)
MK_FUNDAMENTAL_TYPE(word64) MK_FUNDAMENTAL_TYPE(word64)

View File

@@ -46,13 +46,16 @@ typedef unsigned int word32;
#define WORD64_AVAILABLE #define WORD64_AVAILABLE
#define WORD64_IS_DISTINCT_TYPE #define WORD64_IS_DISTINCT_TYPE
typedef unsigned __int64 word64; typedef unsigned __int64 word64;
#define W64LIT(x) x##ui64
#elif SIZEOF_LONG == 8 #elif SIZEOF_LONG == 8
#define WORD64_AVAILABLE #define WORD64_AVAILABLE
typedef unsigned long word64; typedef unsigned long word64;
#define W64LIT(x) x##LL
#elif SIZEOF_LONG_LONG == 8 #elif SIZEOF_LONG_LONG == 8
#define WORD64_AVAILABLE #define WORD64_AVAILABLE
#define WORD64_IS_DISTINCT_TYPE #define WORD64_IS_DISTINCT_TYPE
typedef unsigned long long word64; typedef unsigned long long word64;
#define W64LIT(x) x##LL
#endif #endif

View File

@@ -231,7 +231,7 @@ void list<T>::push_front(T t)
template<typename T> template<typename T>
void list<T>::pop_front() void list<T>::pop_front()
{ {
node* local_front = head_; node* front = head_;
if (head_ == 0) if (head_ == 0)
return; return;
@@ -241,8 +241,8 @@ void list<T>::pop_front()
head_ = head_->next_; head_ = head_->next_;
head_->prev_ = 0; head_->prev_ = 0;
} }
destroy(local_front); destroy(front);
FreeMemory(local_front); FreeMemory(front);
--sz_; --sz_;
} }
@@ -303,13 +303,13 @@ T list<T>::back() const
template<typename T> template<typename T>
typename list<T>::node* list<T>::look_up(T t) typename list<T>::node* list<T>::look_up(T t)
{ {
node* local_list = head_; node* list = head_;
if (local_list == 0) return 0; if (list == 0) return 0;
for (; local_list; local_list = local_list->next_) for (; list; list = list->next_)
if (local_list->value_ == t) if (list->value_ == t)
return local_list; return list;
return 0; return 0;
} }

View File

@@ -90,14 +90,13 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
rounds_ = keylen/4 + 6; rounds_ = keylen/4 + 6;
word32 temp, *rk = key_; word32 temp, *rk = key_;
unsigned int i=0;
GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen); GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen);
switch(keylen) switch(keylen)
{ {
case 16: case 16:
{
unsigned int i=0;
while (true) while (true)
{ {
temp = rk[3]; temp = rk[3];
@@ -115,10 +114,8 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
rk += 4; rk += 4;
} }
break; break;
}
case 24: case 24:
{
unsigned int i=0;
while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack
{ {
temp = rk[ 5]; temp = rk[ 5];
@@ -139,10 +136,7 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
} }
break; break;
}
case 32: case 32:
{
unsigned int i=0;
while (true) while (true)
{ {
temp = rk[ 7]; temp = rk[ 7];
@@ -171,7 +165,6 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
} }
break; break;
} }
}
if (dir_ == DECRYPTION) if (dir_ == DECRYPTION)
{ {

View File

@@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
struct WindowSlider struct WindowSlider
{ {
WindowSlider(const Integer &exp_arg, bool fastNegate_arg, WindowSlider(const Integer &exp, bool fastNegate,
unsigned int windowSizeIn=0) unsigned int windowSizeIn=0)
: exp(exp_arg), windowModulus(Integer::One()), windowSize(windowSizeIn), : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn),
windowBegin(0), fastNegate(fastNegate_arg), firstTime(true), windowBegin(0), fastNegate(fastNegate), firstTime(true),
finished(false) finished(false)
{ {
if (windowSize == 0) if (windowSize == 0)

View File

@@ -737,17 +737,17 @@ void CertDecoder::GetName(NameType nt)
email = true; email = true;
source_.advance(oidSz + 1); source_.advance(oidSz + 1);
word32 length2 = GetLength(source_); word32 length = GetLength(source_);
if (email) { if (email) {
memcpy(&ptr[idx], "/emailAddress=", 14); memcpy(&ptr[idx], "/emailAddress=", 14);
idx += 14; idx += 14;
memcpy(&ptr[idx], source_.get_current(), length2); memcpy(&ptr[idx], source_.get_current(), length);
idx += length2; idx += length;
} }
source_.advance(length2); source_.advance(length);
} }
} }
ptr[idx++] = 0; ptr[idx++] = 0;

View File

@@ -108,4 +108,89 @@ void HASHwithTransform::Final(byte* hash)
Init(); // reset state Init(); // reset state
} }
#ifdef WORD64_AVAILABLE
HASH64withTransform::HASH64withTransform(word32 digSz, word32 buffSz)
{
assert(digSz <= MaxDigestSz);
assert(buffSz <= MaxBufferSz);
}
void HASH64withTransform::AddLength(word32 len)
{
HashLengthType tmp = loLen_;
if ( (loLen_ += len) < tmp)
hiLen_++; // carry low to high
hiLen_ += SafeRightShift<8*sizeof(HashLengthType)>(len);
}
// Update digest with data of size len, do in blocks
void HASH64withTransform::Update(const byte* data, word32 len)
{
// do block size increments
word32 blockSz = getBlockSize();
byte* local = reinterpret_cast<byte*>(buffer_);
while (len) {
word32 add = min(len, blockSz - buffLen_);
memcpy(&local[buffLen_], data, add);
buffLen_ += add;
data += add;
len -= add;
if (buffLen_ == blockSz) {
ByteReverseIf(buffer_, buffer_, blockSz, getByteOrder());
Transform();
AddLength(blockSz);
buffLen_ = 0;
}
}
}
// Final process, place digest in hash
void HASH64withTransform::Final(byte* hash)
{
word32 blockSz = getBlockSize();
word32 digestSz = getDigestSize();
word32 padSz = getPadSize();
ByteOrder order = getByteOrder();
AddLength(buffLen_); // before adding pads
HashLengthType preLoLen = GetBitCountLo();
HashLengthType preHiLen = GetBitCountHi();
byte* local = reinterpret_cast<byte*>(buffer_);
local[buffLen_++] = 0x80; // add 1
// pad with zeros
if (buffLen_ > padSz) {
memset(&local[buffLen_], 0, blockSz - buffLen_);
buffLen_ += blockSz - buffLen_;
ByteReverseIf(buffer_, buffer_, blockSz, order);
Transform();
buffLen_ = 0;
}
memset(&local[buffLen_], 0, padSz - buffLen_);
ByteReverseIf(buffer_, buffer_, padSz, order);
buffer_[blockSz / sizeof(word64) - 2] = order ? preHiLen : preLoLen;
buffer_[blockSz / sizeof(word64) - 1] = order ? preLoLen : preHiLen;
Transform();
ByteReverseIf(digest_, digest_, digestSz, order);
memcpy(hash, digest_, digestSz);
Init(); // reset state
}
#endif // WORD64_AVAILABLE
} // namespace } // namespace

View File

@@ -3390,7 +3390,7 @@ void Integer::DivideByPowerOf2(Integer &r, Integer &q, const Integer &a,
CopyWords(r.reg_.get_buffer(), a.reg_.get_buffer(), wordCount); CopyWords(r.reg_.get_buffer(), a.reg_.get_buffer(), wordCount);
SetWords(r.reg_+wordCount, 0, r.reg_.size()-wordCount); SetWords(r.reg_+wordCount, 0, r.reg_.size()-wordCount);
if (n % WORD_BITS != 0) if (n % WORD_BITS != 0)
r.reg_[wordCount-1] %= ((word) 1 << (n % WORD_BITS)); r.reg_[wordCount-1] %= (word(1) << (n % WORD_BITS));
} }
else else
{ {

View File

@@ -69,6 +69,77 @@ void SHA::Init()
hiLen_ = 0; hiLen_ = 0;
} }
void SHA256::Init()
{
digest_[0] = 0x6A09E667L;
digest_[1] = 0xBB67AE85L;
digest_[2] = 0x3C6EF372L;
digest_[3] = 0xA54FF53AL;
digest_[4] = 0x510E527FL;
digest_[5] = 0x9B05688CL;
digest_[6] = 0x1F83D9ABL;
digest_[7] = 0x5BE0CD19L;
buffLen_ = 0;
loLen_ = 0;
hiLen_ = 0;
}
void SHA224::Init()
{
digest_[0] = 0xc1059ed8;
digest_[1] = 0x367cd507;
digest_[2] = 0x3070dd17;
digest_[3] = 0xf70e5939;
digest_[4] = 0xffc00b31;
digest_[5] = 0x68581511;
digest_[6] = 0x64f98fa7;
digest_[7] = 0xbefa4fa4;
buffLen_ = 0;
loLen_ = 0;
hiLen_ = 0;
}
#ifdef WORD64_AVAILABLE
void SHA512::Init()
{
digest_[0] = W64LIT(0x6a09e667f3bcc908);
digest_[1] = W64LIT(0xbb67ae8584caa73b);
digest_[2] = W64LIT(0x3c6ef372fe94f82b);
digest_[3] = W64LIT(0xa54ff53a5f1d36f1);
digest_[4] = W64LIT(0x510e527fade682d1);
digest_[5] = W64LIT(0x9b05688c2b3e6c1f);
digest_[6] = W64LIT(0x1f83d9abfb41bd6b);
digest_[7] = W64LIT(0x5be0cd19137e2179);
buffLen_ = 0;
loLen_ = 0;
hiLen_ = 0;
}
void SHA384::Init()
{
digest_[0] = W64LIT(0xcbbb9d5dc1059ed8);
digest_[1] = W64LIT(0x629a292a367cd507);
digest_[2] = W64LIT(0x9159015a3070dd17);
digest_[3] = W64LIT(0x152fecd8f70e5939);
digest_[4] = W64LIT(0x67332667ffc00b31);
digest_[5] = W64LIT(0x8eb44a8768581511);
digest_[6] = W64LIT(0xdb0c2e0d64f98fa7);
digest_[7] = W64LIT(0x47b5481dbefa4fa4);
buffLen_ = 0;
loLen_ = 0;
hiLen_ = 0;
}
#endif // WORD64_AVAILABLE
SHA::SHA(const SHA& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32), SHA::SHA(const SHA& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32),
BLOCK_SIZE) BLOCK_SIZE)
@@ -81,6 +152,59 @@ SHA::SHA(const SHA& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32),
memcpy(buffer_, that.buffer_, BLOCK_SIZE); memcpy(buffer_, that.buffer_, BLOCK_SIZE);
} }
SHA256::SHA256(const SHA256& that) : HASHwithTransform(DIGEST_SIZE /
sizeof(word32), BLOCK_SIZE)
{
buffLen_ = that.buffLen_;
loLen_ = that.loLen_;
hiLen_ = that.hiLen_;
memcpy(digest_, that.digest_, DIGEST_SIZE);
memcpy(buffer_, that.buffer_, BLOCK_SIZE);
}
SHA224::SHA224(const SHA224& that) : HASHwithTransform(SHA256::DIGEST_SIZE /
sizeof(word32), BLOCK_SIZE)
{
buffLen_ = that.buffLen_;
loLen_ = that.loLen_;
hiLen_ = that.hiLen_;
memcpy(digest_, that.digest_, DIGEST_SIZE);
memcpy(buffer_, that.buffer_, BLOCK_SIZE);
}
#ifdef WORD64_AVAILABLE
SHA512::SHA512(const SHA512& that) : HASH64withTransform(DIGEST_SIZE /
sizeof(word64), BLOCK_SIZE)
{
buffLen_ = that.buffLen_;
loLen_ = that.loLen_;
hiLen_ = that.hiLen_;
memcpy(digest_, that.digest_, DIGEST_SIZE);
memcpy(buffer_, that.buffer_, BLOCK_SIZE);
}
SHA384::SHA384(const SHA384& that) : HASH64withTransform(SHA512::DIGEST_SIZE /
sizeof(word64), BLOCK_SIZE)
{
buffLen_ = that.buffLen_;
loLen_ = that.loLen_;
hiLen_ = that.hiLen_;
memcpy(digest_, that.digest_, DIGEST_SIZE);
memcpy(buffer_, that.buffer_, BLOCK_SIZE);
}
#endif // WORD64_AVAILABLE
SHA& SHA::operator= (const SHA& that) SHA& SHA::operator= (const SHA& that)
{ {
SHA tmp(that); SHA tmp(that);
@@ -90,6 +214,46 @@ SHA& SHA::operator= (const SHA& that)
} }
SHA256& SHA256::operator= (const SHA256& that)
{
SHA256 tmp(that);
Swap(tmp);
return *this;
}
SHA224& SHA224::operator= (const SHA224& that)
{
SHA224 tmp(that);
Swap(tmp);
return *this;
}
#ifdef WORD64_AVAILABLE
SHA512& SHA512::operator= (const SHA512& that)
{
SHA512 tmp(that);
Swap(tmp);
return *this;
}
SHA384& SHA384::operator= (const SHA384& that)
{
SHA384 tmp(that);
Swap(tmp);
return *this;
}
#endif // WORD64_AVAILABLE
void SHA::Swap(SHA& other) void SHA::Swap(SHA& other)
{ {
STL::swap(loLen_, other.loLen_); STL::swap(loLen_, other.loLen_);
@@ -101,6 +265,53 @@ void SHA::Swap(SHA& other)
} }
void SHA256::Swap(SHA256& other)
{
STL::swap(loLen_, other.loLen_);
STL::swap(hiLen_, other.hiLen_);
STL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
}
void SHA224::Swap(SHA224& other)
{
STL::swap(loLen_, other.loLen_);
STL::swap(hiLen_, other.hiLen_);
STL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
}
#ifdef WORD64_AVAILABLE
void SHA512::Swap(SHA512& other)
{
STL::swap(loLen_, other.loLen_);
STL::swap(hiLen_, other.hiLen_);
STL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
}
void SHA384::Swap(SHA384& other)
{
STL::swap(loLen_, other.loLen_);
STL::swap(hiLen_, other.hiLen_);
STL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
}
#endif // WORD64_AVIALABLE
#ifdef DO_SHA_ASM #ifdef DO_SHA_ASM
@@ -203,6 +414,205 @@ void SHA::Transform()
} }
#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
#define Ch(x,y,z) (z^(x&(y^z)))
#define Maj(x,y,z) ((x&y)|(z&(x|y)))
#define a(i) T[(0-i)&7]
#define b(i) T[(1-i)&7]
#define c(i) T[(2-i)&7]
#define d(i) T[(3-i)&7]
#define e(i) T[(4-i)&7]
#define f(i) T[(5-i)&7]
#define g(i) T[(6-i)&7]
#define h(i) T[(7-i)&7]
#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+K[i+j]+(j?blk2(i):blk0(i));\
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
// for SHA256
#define S0(x) (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22))
#define S1(x) (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25))
#define s0(x) (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3))
#define s1(x) (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10))
static const word32 K256[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
};
static void Transform256(word32* digest_, word32* buffer_)
{
const word32* K = K256;
word32 W[16];
word32 T[8];
// Copy digest to working vars
memcpy(T, digest_, sizeof(T));
// 64 operations, partially loop unrolled
for (unsigned int j = 0; j < 64; j += 16) {
R( 0); R( 1); R( 2); R( 3);
R( 4); R( 5); R( 6); R( 7);
R( 8); R( 9); R(10); R(11);
R(12); R(13); R(14); R(15);
}
// Add the working vars back into digest
digest_[0] += a(0);
digest_[1] += b(0);
digest_[2] += c(0);
digest_[3] += d(0);
digest_[4] += e(0);
digest_[5] += f(0);
digest_[6] += g(0);
digest_[7] += h(0);
// Wipe variables
memset(W, 0, sizeof(W));
memset(T, 0, sizeof(T));
}
// undef for 256
#undef S0
#undef S1
#undef s0
#undef s1
void SHA256::Transform()
{
Transform256(digest_, buffer_);
}
void SHA224::Transform()
{
Transform256(digest_, buffer_);
}
#ifdef WORD64_AVAILABLE
static const word64 K512[80] = {
W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd),
W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc),
W64LIT(0x3956c25bf348b538), W64LIT(0x59f111f1b605d019),
W64LIT(0x923f82a4af194f9b), W64LIT(0xab1c5ed5da6d8118),
W64LIT(0xd807aa98a3030242), W64LIT(0x12835b0145706fbe),
W64LIT(0x243185be4ee4b28c), W64LIT(0x550c7dc3d5ffb4e2),
W64LIT(0x72be5d74f27b896f), W64LIT(0x80deb1fe3b1696b1),
W64LIT(0x9bdc06a725c71235), W64LIT(0xc19bf174cf692694),
W64LIT(0xe49b69c19ef14ad2), W64LIT(0xefbe4786384f25e3),
W64LIT(0x0fc19dc68b8cd5b5), W64LIT(0x240ca1cc77ac9c65),
W64LIT(0x2de92c6f592b0275), W64LIT(0x4a7484aa6ea6e483),
W64LIT(0x5cb0a9dcbd41fbd4), W64LIT(0x76f988da831153b5),
W64LIT(0x983e5152ee66dfab), W64LIT(0xa831c66d2db43210),
W64LIT(0xb00327c898fb213f), W64LIT(0xbf597fc7beef0ee4),
W64LIT(0xc6e00bf33da88fc2), W64LIT(0xd5a79147930aa725),
W64LIT(0x06ca6351e003826f), W64LIT(0x142929670a0e6e70),
W64LIT(0x27b70a8546d22ffc), W64LIT(0x2e1b21385c26c926),
W64LIT(0x4d2c6dfc5ac42aed), W64LIT(0x53380d139d95b3df),
W64LIT(0x650a73548baf63de), W64LIT(0x766a0abb3c77b2a8),
W64LIT(0x81c2c92e47edaee6), W64LIT(0x92722c851482353b),
W64LIT(0xa2bfe8a14cf10364), W64LIT(0xa81a664bbc423001),
W64LIT(0xc24b8b70d0f89791), W64LIT(0xc76c51a30654be30),
W64LIT(0xd192e819d6ef5218), W64LIT(0xd69906245565a910),
W64LIT(0xf40e35855771202a), W64LIT(0x106aa07032bbd1b8),
W64LIT(0x19a4c116b8d2d0c8), W64LIT(0x1e376c085141ab53),
W64LIT(0x2748774cdf8eeb99), W64LIT(0x34b0bcb5e19b48a8),
W64LIT(0x391c0cb3c5c95a63), W64LIT(0x4ed8aa4ae3418acb),
W64LIT(0x5b9cca4f7763e373), W64LIT(0x682e6ff3d6b2b8a3),
W64LIT(0x748f82ee5defb2fc), W64LIT(0x78a5636f43172f60),
W64LIT(0x84c87814a1f0ab72), W64LIT(0x8cc702081a6439ec),
W64LIT(0x90befffa23631e28), W64LIT(0xa4506cebde82bde9),
W64LIT(0xbef9a3f7b2c67915), W64LIT(0xc67178f2e372532b),
W64LIT(0xca273eceea26619c), W64LIT(0xd186b8c721c0c207),
W64LIT(0xeada7dd6cde0eb1e), W64LIT(0xf57d4f7fee6ed178),
W64LIT(0x06f067aa72176fba), W64LIT(0x0a637dc5a2c898a6),
W64LIT(0x113f9804bef90dae), W64LIT(0x1b710b35131c471b),
W64LIT(0x28db77f523047d84), W64LIT(0x32caab7b40c72493),
W64LIT(0x3c9ebe0a15c9bebc), W64LIT(0x431d67c49c100d4c),
W64LIT(0x4cc5d4becb3e42b6), W64LIT(0x597f299cfc657e2a),
W64LIT(0x5fcb6fab3ad6faec), W64LIT(0x6c44198c4a475817)
};
// for SHA512
#define S0(x) (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39))
#define S1(x) (rotrFixed(x,14)^rotrFixed(x,18)^rotrFixed(x,41))
#define s0(x) (rotrFixed(x,1)^rotrFixed(x,8)^(x>>7))
#define s1(x) (rotrFixed(x,19)^rotrFixed(x,61)^(x>>6))
static void Transform512(word64* digest_, word64* buffer_)
{
const word64* K = K512;
word64 W[16];
word64 T[8];
// Copy digest to working vars
memcpy(T, digest_, sizeof(T));
// 64 operations, partially loop unrolled
for (unsigned int j = 0; j < 80; j += 16) {
R( 0); R( 1); R( 2); R( 3);
R( 4); R( 5); R( 6); R( 7);
R( 8); R( 9); R(10); R(11);
R(12); R(13); R(14); R(15);
}
// Add the working vars back into digest
digest_[0] += a(0);
digest_[1] += b(0);
digest_[2] += c(0);
digest_[3] += d(0);
digest_[4] += e(0);
digest_[5] += f(0);
digest_[6] += g(0);
digest_[7] += h(0);
// Wipe variables
memset(W, 0, sizeof(W));
memset(T, 0, sizeof(T));
}
void SHA512::Transform()
{
Transform512(digest_, buffer_);
}
void SHA384::Transform()
{
Transform512(digest_, buffer_);
}
#endif // WORD64_AVIALABLE
#ifdef DO_SHA_ASM #ifdef DO_SHA_ASM
// f1(x,y,z) (z^(x &(y^z))) // f1(x,y,z) (z^(x &(y^z)))

View File

@@ -29,6 +29,12 @@
using TaoCrypt::byte; using TaoCrypt::byte;
using TaoCrypt::word32; using TaoCrypt::word32;
using TaoCrypt::SHA; using TaoCrypt::SHA;
using TaoCrypt::SHA256;
using TaoCrypt::SHA224;
#ifdef WORD64_AVAILABLE
using TaoCrypt::SHA512;
using TaoCrypt::SHA384;
#endif
using TaoCrypt::MD5; using TaoCrypt::MD5;
using TaoCrypt::MD2; using TaoCrypt::MD2;
using TaoCrypt::MD4; using TaoCrypt::MD4;
@@ -88,8 +94,13 @@ struct testVector {
output_((byte*)out), inLen_(strlen(in)), outLen_(strlen(out)) {} output_((byte*)out), inLen_(strlen(in)), outLen_(strlen(out)) {}
}; };
void file_test(int, char**);
int sha_test(); int sha_test();
int sha256_test();
#ifdef WORD64_AVAILABLE
int sha512_test();
int sha384_test();
#endif
int sha224_test();
int md5_test(); int md5_test();
int md2_test(); int md2_test();
int md4_test(); int md4_test();
@@ -139,20 +150,20 @@ const byte msgTmp[] = { // "now is the time for all " w/o trailing 0
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
}; };
byte* global_msg = 0; // for block cipher input byte* msg = 0; // for block cipher input
byte* global_plain = 0; // for cipher decrypt comparison byte* plain = 0; // for cipher decrypt comparison
byte* global_cipher = 0; // block output byte* cipher = 0; // block output
void taocrypt_test(void* args) void taocrypt_test(void* args)
{ {
((func_args*)args)->return_code = -1; // error state ((func_args*)args)->return_code = -1; // error state
global_msg = NEW_TC byte[24]; msg = NEW_TC byte[24];
global_plain = NEW_TC byte[24]; plain = NEW_TC byte[24];
global_cipher = NEW_TC byte[24]; cipher = NEW_TC byte[24];
memcpy(global_msg, msgTmp, 24); memcpy(msg, msgTmp, 24);
int ret = 0; int ret = 0;
if ( (ret = sha_test()) ) if ( (ret = sha_test()) )
@@ -160,6 +171,30 @@ void taocrypt_test(void* args)
else else
printf( "SHA test passed!\n"); printf( "SHA test passed!\n");
if ( (ret = sha256_test()) )
err_sys("SHA-256 test failed!\n", ret);
else
printf( "SHA-256 test passed!\n");
if ( (ret = sha224_test()) )
err_sys("SHA-224 test failed!\n", ret);
else
printf( "SHA-224 test passed!\n");
#ifdef WORD64_AVAILABLE
if ( (ret = sha512_test()) )
err_sys("SHA-512 test failed!\n", ret);
else
printf( "SHA-512 test passed!\n");
if ( (ret = sha384_test()) )
err_sys("SHA-384 test failed!\n", ret);
else
printf( "SHA-384 test passed!\n");
#endif
if ( (ret = md5_test()) ) if ( (ret = md5_test()) )
err_sys("MD5 test failed!\n", ret); err_sys("MD5 test failed!\n", ret);
else else
@@ -237,9 +272,9 @@ void taocrypt_test(void* args)
printf( "PKCS12 test passed!\n"); printf( "PKCS12 test passed!\n");
*/ */
tcArrayDelete(global_cipher); tcArrayDelete(cipher);
tcArrayDelete(global_plain); tcArrayDelete(plain);
tcArrayDelete(global_msg); tcArrayDelete(msg);
((func_args*)args)->return_code = ret; ((func_args*)args)->return_code = ret;
} }
@@ -264,7 +299,7 @@ void taocrypt_test(void* args)
#endif // NO_MAIN_DRIVER #endif // NO_MAIN_DRIVER
void file_test(char* file, byte* check) void file_test(const char* file, byte* check)
{ {
FILE* f; FILE* f;
int i(0); int i(0);
@@ -328,6 +363,136 @@ int sha_test()
} }
int sha256_test()
{
SHA256 sha;
byte hash[SHA256::DIGEST_SIZE];
testVector test_sha[] =
{
testVector("abc",
"\xBA\x78\x16\xBF\x8F\x01\xCF\xEA\x41\x41\x40\xDE\x5D\xAE\x22"
"\x23\xB0\x03\x61\xA3\x96\x17\x7A\x9C\xB4\x10\xFF\x61\xF2\x00"
"\x15\xAD"),
testVector("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
"\x24\x8D\x6A\x61\xD2\x06\x38\xB8\xE5\xC0\x26\x93\x0C\x3E\x60"
"\x39\xA3\x3C\xE4\x59\x64\xFF\x21\x67\xF6\xEC\xED\xD4\x19\xDB"
"\x06\xC1")
};
int times( sizeof(test_sha) / sizeof(testVector) );
for (int i = 0; i < times; ++i) {
sha.Update(test_sha[i].input_, test_sha[i].inLen_);
sha.Final(hash);
if (memcmp(hash, test_sha[i].output_, SHA256::DIGEST_SIZE) != 0)
return -1 - i;
}
return 0;
}
#ifdef WORD64_AVAILABLE
int sha512_test()
{
SHA512 sha;
byte hash[SHA512::DIGEST_SIZE];
testVector test_sha[] =
{
testVector("abc",
"\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41"
"\x31\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55"
"\xd3\x9a\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3"
"\xfe\xeb\xbd\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f"
"\xa5\x4c\xa4\x9f"),
testVector("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
"jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
"\x8e\x95\x9b\x75\xda\xe3\x13\xda\x8c\xf4\xf7\x28\x14\xfc\x14"
"\x3f\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1\x72\x99\xae\xad\xb6\x88"
"\x90\x18\x50\x1d\x28\x9e\x49\x00\xf7\xe4\x33\x1b\x99\xde\xc4"
"\xb5\x43\x3a\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b"
"\x87\x4b\xe9\x09")
};
int times( sizeof(test_sha) / sizeof(testVector) );
for (int i = 0; i < times; ++i) {
sha.Update(test_sha[i].input_, test_sha[i].inLen_);
sha.Final(hash);
if (memcmp(hash, test_sha[i].output_, SHA512::DIGEST_SIZE) != 0)
return -1 - i;
}
return 0;
}
int sha384_test()
{
SHA384 sha;
byte hash[SHA384::DIGEST_SIZE];
testVector test_sha[] =
{
testVector("abc",
"\xcb\x00\x75\x3f\x45\xa3\x5e\x8b\xb5\xa0\x3d\x69\x9a\xc6\x50"
"\x07\x27\x2c\x32\xab\x0e\xde\xd1\x63\x1a\x8b\x60\x5a\x43\xff"
"\x5b\xed\x80\x86\x07\x2b\xa1\xe7\xcc\x23\x58\xba\xec\xa1\x34"
"\xc8\x25\xa7"),
testVector("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
"jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
"\x09\x33\x0c\x33\xf7\x11\x47\xe8\x3d\x19\x2f\xc7\x82\xcd\x1b"
"\x47\x53\x11\x1b\x17\x3b\x3b\x05\xd2\x2f\xa0\x80\x86\xe3\xb0"
"\xf7\x12\xfc\xc7\xc7\x1a\x55\x7e\x2d\xb9\x66\xc3\xe9\xfa\x91"
"\x74\x60\x39")
};
int times( sizeof(test_sha) / sizeof(testVector) );
for (int i = 0; i < times; ++i) {
sha.Update(test_sha[i].input_, test_sha[i].inLen_);
sha.Final(hash);
if (memcmp(hash, test_sha[i].output_, SHA384::DIGEST_SIZE) != 0)
return -1 - i;
}
return 0;
}
#endif // WORD64_AVAILABLE
int sha224_test()
{
SHA224 sha;
byte hash[SHA224::DIGEST_SIZE];
testVector test_sha[] =
{
testVector("abc",
"\x23\x09\x7d\x22\x34\x05\xd8\x22\x86\x42\xa4\x77\xbd\xa2\x55"
"\xb3\x2a\xad\xbc\xe4\xbd\xa0\xb3\xf7\xe3\x6c\x9d\xa7"),
testVector("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
"\x75\x38\x8b\x16\x51\x27\x76\xcc\x5d\xba\x5d\xa1\xfd\x89\x01"
"\x50\xb0\xc6\x45\x5c\xb4\xf5\x8b\x19\x52\x52\x25\x25")
};
int times( sizeof(test_sha) / sizeof(testVector) );
for (int i = 0; i < times; ++i) {
sha.Update(test_sha[i].input_, test_sha[i].inLen_);
sha.Final(hash);
if (memcmp(hash, test_sha[i].output_, SHA224::DIGEST_SIZE) != 0)
return -1 - i;
}
return 0;
}
int md5_test() int md5_test()
{ {
MD5 md5; MD5 md5;
@@ -606,11 +771,11 @@ int des_test()
const byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef }; const byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef };
enc.SetKey(key, sizeof(key)); enc.SetKey(key, sizeof(key));
enc.Process(global_cipher, global_msg, sz); enc.Process(cipher, msg, sz);
dec.SetKey(key, sizeof(key)); dec.SetKey(key, sizeof(key));
dec.Process(global_plain, global_cipher, sz); dec.Process(plain, cipher, sz);
if (memcmp(global_plain, global_msg, sz)) if (memcmp(plain, msg, sz))
return -50; return -50;
const byte verify1[] = const byte verify1[] =
@@ -620,7 +785,7 @@ int des_test()
0x89,0x3d,0x51,0xec,0x4b,0x56,0x3b,0x53 0x89,0x3d,0x51,0xec,0x4b,0x56,0x3b,0x53
}; };
if (memcmp(global_cipher, verify1, sz)) if (memcmp(cipher, verify1, sz))
return -51; return -51;
// CBC mode // CBC mode
@@ -628,11 +793,11 @@ int des_test()
DES_CBC_Decryption dec2; DES_CBC_Decryption dec2;
enc2.SetKey(key, sizeof(key), iv); enc2.SetKey(key, sizeof(key), iv);
enc2.Process(global_cipher, global_msg, sz); enc2.Process(cipher, msg, sz);
dec2.SetKey(key, sizeof(key), iv); dec2.SetKey(key, sizeof(key), iv);
dec2.Process(global_plain, global_cipher, sz); dec2.Process(plain, cipher, sz);
if (memcmp(global_plain, global_msg, sz)) if (memcmp(plain, msg, sz))
return -52; return -52;
const byte verify2[] = const byte verify2[] =
@@ -642,7 +807,7 @@ int des_test()
0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b 0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
}; };
if (memcmp(global_cipher, verify2, sz)) if (memcmp(cipher, verify2, sz))
return -53; return -53;
// EDE3 CBC mode // EDE3 CBC mode
@@ -664,11 +829,11 @@ int des_test()
}; };
enc3.SetKey(key3, sizeof(key3), iv3); enc3.SetKey(key3, sizeof(key3), iv3);
enc3.Process(global_cipher, global_msg, sz); enc3.Process(cipher, msg, sz);
dec3.SetKey(key3, sizeof(key3), iv3); dec3.SetKey(key3, sizeof(key3), iv3);
dec3.Process(global_plain, global_cipher, sz); dec3.Process(plain, cipher, sz);
if (memcmp(global_plain, global_msg, sz)) if (memcmp(plain, msg, sz))
return -54; return -54;
const byte verify3[] = const byte verify3[] =
@@ -678,7 +843,7 @@ int des_test()
0x18,0xbc,0xbb,0x6d,0xd2,0xb1,0x16,0xda 0x18,0xbc,0xbb,0x6d,0xd2,0xb1,0x16,0xda
}; };
if (memcmp(global_cipher, verify3, sz)) if (memcmp(cipher, verify3, sz))
return -55; return -55;
return 0; return 0;
@@ -697,10 +862,10 @@ int aes_test()
enc.SetKey(key, bs, iv); enc.SetKey(key, bs, iv);
dec.SetKey(key, bs, iv); dec.SetKey(key, bs, iv);
enc.Process(global_cipher, global_msg, bs); enc.Process(cipher, msg, bs);
dec.Process(global_plain, global_cipher, bs); dec.Process(plain, cipher, bs);
if (memcmp(global_plain, global_msg, bs)) if (memcmp(plain, msg, bs))
return -60; return -60;
const byte verify[] = const byte verify[] =
@@ -709,7 +874,7 @@ int aes_test()
0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb 0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
}; };
if (memcmp(global_cipher, verify, bs)) if (memcmp(cipher, verify, bs))
return -61; return -61;
AES_ECB_Encryption enc2; AES_ECB_Encryption enc2;
@@ -718,10 +883,10 @@ int aes_test()
enc2.SetKey(key, bs, iv); enc2.SetKey(key, bs, iv);
dec2.SetKey(key, bs, iv); dec2.SetKey(key, bs, iv);
enc2.Process(global_cipher, global_msg, bs); enc2.Process(cipher, msg, bs);
dec2.Process(global_plain, global_cipher, bs); dec2.Process(plain, cipher, bs);
if (memcmp(global_plain, global_msg, bs)) if (memcmp(plain, msg, bs))
return -62; return -62;
const byte verify2[] = const byte verify2[] =
@@ -730,7 +895,7 @@ int aes_test()
0xc8,0x8c,0x33,0x3b,0xb5,0x8f,0x85,0xd1 0xc8,0x8c,0x33,0x3b,0xb5,0x8f,0x85,0xd1
}; };
if (memcmp(global_cipher, verify2, bs)) if (memcmp(cipher, verify2, bs))
return -63; return -63;
return 0; return 0;
@@ -749,10 +914,10 @@ int twofish_test()
enc.SetKey(key, bs, iv); enc.SetKey(key, bs, iv);
dec.SetKey(key, bs, iv); dec.SetKey(key, bs, iv);
enc.Process(global_cipher, global_msg, bs); enc.Process(cipher, msg, bs);
dec.Process(global_plain, global_cipher, bs); dec.Process(plain, cipher, bs);
if (memcmp(global_plain, global_msg, bs)) if (memcmp(plain, msg, bs))
return -60; return -60;
const byte verify[] = const byte verify[] =
@@ -761,7 +926,7 @@ int twofish_test()
0x21,0x03,0x58,0x79,0x5F,0x02,0x27,0x2C 0x21,0x03,0x58,0x79,0x5F,0x02,0x27,0x2C
}; };
if (memcmp(global_cipher, verify, bs)) if (memcmp(cipher, verify, bs))
return -61; return -61;
Twofish_ECB_Encryption enc2; Twofish_ECB_Encryption enc2;
@@ -770,10 +935,10 @@ int twofish_test()
enc2.SetKey(key, bs, iv); enc2.SetKey(key, bs, iv);
dec2.SetKey(key, bs, iv); dec2.SetKey(key, bs, iv);
enc2.Process(global_cipher, global_msg, bs); enc2.Process(cipher, msg, bs);
dec2.Process(global_plain, global_cipher, bs); dec2.Process(plain, cipher, bs);
if (memcmp(global_plain, global_msg, bs)) if (memcmp(plain, msg, bs))
return -62; return -62;
const byte verify2[] = const byte verify2[] =
@@ -782,7 +947,7 @@ int twofish_test()
0xC4,0xCD,0x6B,0x91,0x14,0xC5,0x3A,0x09 0xC4,0xCD,0x6B,0x91,0x14,0xC5,0x3A,0x09
}; };
if (memcmp(global_cipher, verify2, bs)) if (memcmp(cipher, verify2, bs))
return -63; return -63;
return 0; return 0;
@@ -801,10 +966,10 @@ int blowfish_test()
enc.SetKey(key, 16, iv); enc.SetKey(key, 16, iv);
dec.SetKey(key, 16, iv); dec.SetKey(key, 16, iv);
enc.Process(global_cipher, global_msg, bs * 2); enc.Process(cipher, msg, bs * 2);
dec.Process(global_plain, global_cipher, bs * 2); dec.Process(plain, cipher, bs * 2);
if (memcmp(global_plain, global_msg, bs)) if (memcmp(plain, msg, bs))
return -60; return -60;
const byte verify[] = const byte verify[] =
@@ -813,7 +978,7 @@ int blowfish_test()
0xBC,0xD9,0x08,0xC4,0x94,0x6C,0x89,0xA3 0xBC,0xD9,0x08,0xC4,0x94,0x6C,0x89,0xA3
}; };
if (memcmp(global_cipher, verify, bs)) if (memcmp(cipher, verify, bs))
return -61; return -61;
Blowfish_ECB_Encryption enc2; Blowfish_ECB_Encryption enc2;
@@ -822,10 +987,10 @@ int blowfish_test()
enc2.SetKey(key, 16, iv); enc2.SetKey(key, 16, iv);
dec2.SetKey(key, 16, iv); dec2.SetKey(key, 16, iv);
enc2.Process(global_cipher, global_msg, bs * 2); enc2.Process(cipher, msg, bs * 2);
dec2.Process(global_plain, global_cipher, bs * 2); dec2.Process(plain, cipher, bs * 2);
if (memcmp(global_plain, global_msg, bs)) if (memcmp(plain, msg, bs))
return -62; return -62;
const byte verify2[] = const byte verify2[] =
@@ -834,7 +999,7 @@ int blowfish_test()
0x8F,0xCE,0x39,0x32,0xDE,0xD7,0xBC,0x5B 0x8F,0xCE,0x39,0x32,0xDE,0xD7,0xBC,0x5B
}; };
if (memcmp(global_cipher, verify2, bs)) if (memcmp(cipher, verify2, bs))
return -63; return -63;
return 0; return 0;

View File

@@ -7,7 +7,7 @@
typedef unsigned char byte; typedef unsigned char byte;
void taocrypt_test(void*); void taocrypt_test(void*);
void file_test(char*, byte*); void file_test(const char*, byte*);
void client_test(void*); void client_test(void*);
void echoclient_test(void*); void echoclient_test(void*);
@@ -86,8 +86,8 @@ int main(int argc, char** argv)
// input output compare // input output compare
byte input[TaoCrypt::MD5::DIGEST_SIZE]; byte input[TaoCrypt::MD5::DIGEST_SIZE];
byte output[TaoCrypt::MD5::DIGEST_SIZE]; byte output[TaoCrypt::MD5::DIGEST_SIZE];
file_test((char*) "input", input); file_test("input", input);
file_test((char*) "output", output); file_test("output", output);
assert(memcmp(input, output, sizeof(input)) == 0); assert(memcmp(input, output, sizeof(input)) == 0);
printf("\nAll tests passed!\n"); printf("\nAll tests passed!\n");
@@ -141,17 +141,16 @@ int test_openSSL_des()
/* test des encrypt/decrypt */ /* test des encrypt/decrypt */
char data[] = "this is my data "; char data[] = "this is my data ";
int dataSz = strlen(data); int dataSz = strlen(data);
DES_key_schedule local_key[3]; DES_key_schedule key[3];
byte iv[8]; byte iv[8];
EVP_BytesToKey(EVP_des_ede3_cbc(), EVP_md5(), NULL, (byte*)data, dataSz, 1, EVP_BytesToKey(EVP_des_ede3_cbc(), EVP_md5(), NULL, (byte*)data, dataSz, 1,
(byte*)local_key, iv); (byte*)key, iv);
byte cipher[16]; byte cipher[16];
DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz, DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz, &key[0], &key[1],
&local_key[0], &local_key[1], &key[2], &iv, true);
&local_key[2], &iv, true);
byte plain[16]; byte plain[16];
DES_ede3_cbc_encrypt(cipher, plain, 16, &local_key[0], &local_key[1], DES_ede3_cbc_encrypt(cipher, plain, 16, &key[0], &key[1], &key[2],
&local_key[2], &iv, false); &iv, false);
return 0; return 0;
} }

View File

@@ -160,7 +160,15 @@ enum ha_extra_function {
Off by default. Off by default.
*/ */
HA_EXTRA_WRITE_CAN_REPLACE, HA_EXTRA_WRITE_CAN_REPLACE,
HA_EXTRA_WRITE_CANNOT_REPLACE HA_EXTRA_WRITE_CANNOT_REPLACE,
/*
Inform handler that delete_row()/update_row() cannot batch deletes/updates
and should perform them immediately. This may be needed when table has
AFTER DELETE/UPDATE triggers which access to subject table.
These flags are reset by the handler::extra(HA_EXTRA_RESET) call.
*/
HA_EXTRA_DELETE_CANNOT_BATCH,
HA_EXTRA_UPDATE_CANNOT_BATCH
}; };
/* The following is parameter to ha_panic() */ /* The following is parameter to ha_panic() */

View File

@@ -102,6 +102,9 @@ void vio_timeout(Vio *vio,uint which, uint timeout);
#define HEADER_DES_LOCL_H dummy_something #define HEADER_DES_LOCL_H dummy_something
#define YASSL_MYSQL_COMPATIBLE #define YASSL_MYSQL_COMPATIBLE
#define YASSL_PREFIX #define YASSL_PREFIX
/* Set yaSSL to use same type as MySQL do for socket handles */
typedef my_socket YASSL_SOCKET_T;
#define YASSL_SOCKET_T_DEFINED
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h> #include <openssl/err.h>

View File

@@ -628,7 +628,8 @@ dict_table_get_on_id(
CREATE, for example, we already have the mutex! */ CREATE, for example, we already have the mutex! */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex))
|| trx->dict_operation_lock_mode == RW_X_LATCH);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
return(dict_table_get_on_id_low(table_id, trx)); return(dict_table_get_on_id_low(table_id, trx));
@@ -2139,9 +2140,12 @@ dict_foreign_find_index(
ulint n_cols, /* in: number of columns */ ulint n_cols, /* in: number of columns */
dict_index_t* types_idx, /* in: NULL or an index to whose types the dict_index_t* types_idx, /* in: NULL or an index to whose types the
column types must match */ column types must match */
ibool check_charsets) /* in: whether to check charsets. ibool check_charsets, /* in: whether to check charsets.
only has an effect if types_idx != only has an effect if types_idx !=
NULL. */ NULL. */
ulint check_null)
/* in: nonzero if none of the columns must
be declared NOT NULL */
{ {
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
dict_index_t* index; dict_index_t* index;
@@ -2154,10 +2158,11 @@ dict_foreign_find_index(
if (dict_index_get_n_fields(index) >= n_cols) { if (dict_index_get_n_fields(index) >= n_cols) {
for (i = 0; i < n_cols; i++) { for (i = 0; i < n_cols; i++) {
col_name = dict_index_get_nth_field(index, i) dict_field_t* field
->col->name; = dict_index_get_nth_field(index, i);
if (dict_index_get_nth_field(index, i)
->prefix_len != 0) { col_name = field->col->name;
if (field->prefix_len != 0) {
/* We do not accept column prefix /* We do not accept column prefix
indexes here */ indexes here */
@@ -2169,6 +2174,13 @@ dict_foreign_find_index(
break; break;
} }
if (check_null
&& (field->col->type.prtype
& DATA_NOT_NULL)) {
return(NULL);
}
if (types_idx && !cmp_types_are_equal( if (types_idx && !cmp_types_are_equal(
dict_index_get_nth_type(index, i), dict_index_get_nth_type(index, i),
dict_index_get_nth_type(types_idx, i), dict_index_get_nth_type(types_idx, i),
@@ -2290,7 +2302,7 @@ dict_foreign_add_to_cache(
index = dict_foreign_find_index(ref_table, index = dict_foreign_find_index(ref_table,
(const char**) for_in_cache->referenced_col_names, (const char**) for_in_cache->referenced_col_names,
for_in_cache->n_fields, for_in_cache->n_fields,
for_in_cache->foreign_index, check_charsets); for_in_cache->foreign_index, check_charsets, FALSE);
if (index == NULL) { if (index == NULL) {
dict_foreign_error_report(ef, for_in_cache, dict_foreign_error_report(ef, for_in_cache,
@@ -2317,13 +2329,17 @@ dict_foreign_add_to_cache(
index = dict_foreign_find_index(for_table, index = dict_foreign_find_index(for_table,
(const char**) for_in_cache->foreign_col_names, (const char**) for_in_cache->foreign_col_names,
for_in_cache->n_fields, for_in_cache->n_fields,
for_in_cache->referenced_index, check_charsets); for_in_cache->referenced_index, check_charsets,
for_in_cache->type
& (DICT_FOREIGN_ON_DELETE_SET_NULL
| DICT_FOREIGN_ON_UPDATE_SET_NULL));
if (index == NULL) { if (index == NULL) {
dict_foreign_error_report(ef, for_in_cache, dict_foreign_error_report(ef, for_in_cache,
"there is no index in the table which would contain\n" "there is no index in the table which would contain\n"
"the columns as the first columns, or the data types in the\n" "the columns as the first columns, or the data types in the\n"
"table do not match to the ones in the referenced table."); "table do not match to the ones in the referenced table\n"
"or one of the ON ... SET NULL columns is declared NOT NULL.");
if (for_in_cache == foreign) { if (for_in_cache == foreign) {
if (added_to_referenced_list) { if (added_to_referenced_list) {
@@ -3125,7 +3141,8 @@ col_loop1:
/* Try to find an index which contains the columns /* Try to find an index which contains the columns
as the first fields and in the right order */ as the first fields and in the right order */
index = dict_foreign_find_index(table, column_names, i, NULL, TRUE); index = dict_foreign_find_index(table, column_names, i,
NULL, TRUE, FALSE);
if (!index) { if (!index) {
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
@@ -3390,7 +3407,7 @@ try_find_index:
if (referenced_table) { if (referenced_table) {
index = dict_foreign_find_index(referenced_table, index = dict_foreign_find_index(referenced_table,
column_names, i, foreign->foreign_index, TRUE); column_names, i, foreign->foreign_index, TRUE, FALSE);
if (!index) { if (!index) {
dict_foreign_free(foreign); dict_foreign_free(foreign);
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);

View File

@@ -982,6 +982,9 @@ rec_offs_nth_size(
{ {
ut_ad(rec_offs_validate(NULL, NULL, offsets)); ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets)); ut_ad(n < rec_offs_n_fields(offsets));
if (!n) {
return(rec_offs_base(offsets)[1 + n] & REC_OFFS_MASK);
}
return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n]) return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n])
& REC_OFFS_MASK); & REC_OFFS_MASK);
} }

View File

@@ -6,6 +6,16 @@ Mutex, the basic synchronization primitive
Created 9/5/1995 Heikki Tuuri Created 9/5/1995 Heikki Tuuri
*******************************************************/ *******************************************************/
#if defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
/* %z0: Use the size of operand %0 which in our case is *m to determine
instruction size, it should end up as xchgl. "1" in the input constraint,
says that "in" has to go in the same place as "out".*/
#define TAS(m, in, out) \
asm volatile ("xchg%z0 %2, %0" \
: "=g" (*(m)), "=r" (out) \
: "1" (in)) /* Note: "1" here refers to "=r" (out) */
#endif
/********************************************************************** /**********************************************************************
Sets the waiters field in a mutex. */ Sets the waiters field in a mutex. */
@@ -85,20 +95,10 @@ mutex_test_and_set(
return(res); return(res);
#elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86) #elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
ulint* lw;
ulint res; ulint res;
lw = &(mutex->lock_word); TAS(&mutex->lock_word, 1, res);
/* In assembly we use the so-called AT & T syntax where
the order of operands is inverted compared to the ordinary Intel
syntax. The 'l' after the mnemonics denotes a 32-bit operation.
The line after the code tells which values come out of the asm
code, and the second line tells the input to the asm code. */
asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
"=eax" (res), "=m" (*lw) :
"ecx" (lw));
return(res); return(res);
#else #else
ibool ret; ibool ret;
@@ -137,20 +137,9 @@ mutex_reset_lock_word(
__asm MOV ECX, lw __asm MOV ECX, lw
__asm XCHG EDX, DWORD PTR [ECX] __asm XCHG EDX, DWORD PTR [ECX]
#elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86) #elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
ulint* lw; ulint res;
lw = &(mutex->lock_word); TAS(&mutex->lock_word, 0, res);
/* In assembly we use the so-called AT & T syntax where
the order of operands is inverted compared to the ordinary Intel
syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" :
"=m" (*lw) :
"ecx" (lw) :
"eax"); /* gcc does not seem to understand
that our asm code resets eax: tell it
explicitly that after the third ':' */
#else #else
mutex->lock_word = 0; mutex->lock_word = 0;

View File

@@ -3259,12 +3259,6 @@ lock_deadlock_recursive(
*cost = *cost + 1; *cost = *cost + 1;
if ((depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK)
|| (*cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK)) {
return(LOCK_VICTIM_IS_START);
}
lock = wait_lock; lock = wait_lock;
if (lock_get_type(wait_lock) == LOCK_REC) { if (lock_get_type(wait_lock) == LOCK_REC) {
@@ -3296,11 +3290,18 @@ lock_deadlock_recursive(
if (lock_has_to_wait(wait_lock, lock)) { if (lock_has_to_wait(wait_lock, lock)) {
ibool too_far
= depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK
|| *cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK;
lock_trx = lock->trx; lock_trx = lock->trx;
if (lock_trx == start) { if (lock_trx == start || too_far) {
/* We came back to the recursion starting /* We came back to the recursion starting
point: a deadlock detected */ point: a deadlock detected; or we have
searched the waits-for graph too long */
FILE* ef = lock_latest_err_file; FILE* ef = lock_latest_err_file;
rewind(ef); rewind(ef);
@@ -3342,9 +3343,20 @@ lock_deadlock_recursive(
} }
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (lock_print_waits) { if (lock_print_waits) {
fputs("Deadlock detected\n", stderr); fputs("Deadlock detected"
" or too long search\n",
stderr);
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
if (too_far) {
fputs("TOO DEEP OR LONG SEARCH"
" IN THE LOCK TABLE"
" WAITS-FOR GRAPH\n", ef);
return(LOCK_VICTIM_IS_START);
}
if (ut_dulint_cmp(wait_lock->trx->undo_no, if (ut_dulint_cmp(wait_lock->trx->undo_no,
start->undo_no) >= 0) { start->undo_no) >= 0) {
/* Our recursion starting point /* Our recursion starting point

View File

@@ -920,14 +920,14 @@ try_again:
} }
file = CreateFile((LPCTSTR) name, file = CreateFile((LPCTSTR) name,
access, access,
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
/* file can be read ansd written also /* file can be read and written also
by other processes */ by other processes */
NULL, /* default security attributes */ NULL, /* default security attributes */
create_flag, create_flag,
attributes, attributes,
NULL); /* no template file */ NULL); /* no template file */
if (file == INVALID_HANDLE_VALUE) { if (file == INVALID_HANDLE_VALUE) {
*success = FALSE; *success = FALSE;
@@ -1494,7 +1494,7 @@ os_file_rename(
return(TRUE); return(TRUE);
} }
os_file_handle_error(oldpath, "rename"); os_file_handle_error_no_exit(oldpath, "rename");
return(FALSE); return(FALSE);
#else #else
@@ -1503,7 +1503,7 @@ os_file_rename(
ret = rename((const char*)oldpath, (const char*)newpath); ret = rename((const char*)oldpath, (const char*)newpath);
if (ret != 0) { if (ret != 0) {
os_file_handle_error(oldpath, "rename"); os_file_handle_error_no_exit(oldpath, "rename");
return(FALSE); return(FALSE);
} }

View File

@@ -212,7 +212,7 @@ row_undo(
ulint err; ulint err;
trx_t* trx; trx_t* trx;
dulint roll_ptr; dulint roll_ptr;
ibool froze_data_dict = FALSE; ibool locked_data_dict;
ut_ad(node && thr); ut_ad(node && thr);
@@ -263,15 +263,15 @@ row_undo(
} }
/* Prevent DROP TABLE etc. while we are rolling back this row. /* Prevent DROP TABLE etc. while we are rolling back this row.
If we are doing a TABLE CREATE or some other dictionary operation, If we are doing a TABLE CREATE or some other dictionary operation,
then we already have dict_operation_lock locked in x-mode. Do not then we already have dict_operation_lock locked in x-mode. Do not
try to lock again in s-mode, because that would cause a hang. */ try to lock again, because that would cause a hang. */
if (trx->dict_operation_lock_mode == 0) { locked_data_dict = (trx->dict_operation_lock_mode == 0);
row_mysql_freeze_data_dictionary(trx); if (locked_data_dict) {
froze_data_dict = TRUE; row_mysql_lock_data_dictionary(trx);
} }
if (node->state == UNDO_NODE_INSERT) { if (node->state == UNDO_NODE_INSERT) {
@@ -284,9 +284,9 @@ row_undo(
err = row_undo_mod(node, thr); err = row_undo_mod(node, thr);
} }
if (froze_data_dict) { if (locked_data_dict) {
row_mysql_unfreeze_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
} }
/* Do some cleanup */ /* Do some cleanup */

View File

@@ -1822,14 +1822,14 @@ srv_export_innodb_status(void)
export_vars.innodb_pages_written= buf_pool->n_pages_written; export_vars.innodb_pages_written= buf_pool->n_pages_written;
export_vars.innodb_row_lock_waits= srv_n_lock_wait_count; export_vars.innodb_row_lock_waits= srv_n_lock_wait_count;
export_vars.innodb_row_lock_current_waits= srv_n_lock_wait_current_count; export_vars.innodb_row_lock_current_waits= srv_n_lock_wait_current_count;
export_vars.innodb_row_lock_time= srv_n_lock_wait_time / 10000; export_vars.innodb_row_lock_time= srv_n_lock_wait_time / 1000;
if (srv_n_lock_wait_count > 0) { if (srv_n_lock_wait_count > 0) {
export_vars.innodb_row_lock_time_avg = (ulint) export_vars.innodb_row_lock_time_avg = (ulint)
(srv_n_lock_wait_time / 10000 / srv_n_lock_wait_count); (srv_n_lock_wait_time / 1000 / srv_n_lock_wait_count);
} else { } else {
export_vars.innodb_row_lock_time_avg = 0; export_vars.innodb_row_lock_time_avg = 0;
} }
export_vars.innodb_row_lock_time_max= srv_n_lock_max_wait_time / 10000; export_vars.innodb_row_lock_time_max= srv_n_lock_max_wait_time / 1000;
export_vars.innodb_rows_read= srv_n_rows_read; export_vars.innodb_rows_read= srv_n_rows_read;
export_vars.innodb_rows_inserted= srv_n_rows_inserted; export_vars.innodb_rows_inserted= srv_n_rows_inserted;
export_vars.innodb_rows_updated= srv_n_rows_updated; export_vars.innodb_rows_updated= srv_n_rows_updated;

View File

@@ -20,6 +20,55 @@ Created 5/11/1994 Heikki Tuuri
ibool ut_always_false = FALSE; ibool ut_always_false = FALSE;
#ifdef __WIN__
/*********************************************************************
NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix
epoch starts from 1970/1/1. For selection of constant see:
http://support.microsoft.com/kb/167296/ */
#define WIN_TO_UNIX_DELTA_USEC ((ib_longlong) 11644473600000000ULL)
/*********************************************************************
This is the Windows version of gettimeofday(2).*/
static
int
ut_gettimeofday(
/*============*/
/* out: 0 if all OK else -1 */
struct timeval* tv, /* out: Values are relative to Unix epoch */
void* tz) /* in: not used */
{
FILETIME ft;
ib_longlong tm;
if (!tv) {
errno = EINVAL;
return(-1);
}
GetSystemTimeAsFileTime(&ft);
tm = (ib_longlong) ft.dwHighDateTime << 32;
tm |= ft.dwLowDateTime;
ut_a(tm >= 0); /* If tm wraps over to negative, the quotient / 10
does not work */
tm /= 10; /* Convert from 100 nsec periods to usec */
/* If we don't convert to the Unix epoch the value for
struct timeval::tv_sec will overflow.*/
tm -= WIN_TO_UNIX_DELTA_USEC;
tv->tv_sec = (long) (tm / 1000000L);
tv->tv_usec = (long) (tm % 1000000L);
return(0);
}
#else
#define ut_gettimeofday gettimeofday
#endif
/********************************************************************* /*********************************************************************
Get the quote character to be used in SQL identifiers. Get the quote character to be used in SQL identifiers.
This definition must match the one in sql/ha_innodb.cc! */ This definition must match the one in sql/ha_innodb.cc! */
@@ -82,17 +131,11 @@ ut_usectime(
ulint* sec, /* out: seconds since the Epoch */ ulint* sec, /* out: seconds since the Epoch */
ulint* ms) /* out: microseconds since the Epoch+*sec */ ulint* ms) /* out: microseconds since the Epoch+*sec */
{ {
#ifdef __WIN__
SYSTEMTIME st;
GetLocalTime(&st);
*sec = (ulint) st.wSecond;
*ms = (ulint) st.wMilliseconds;
#else
struct timeval tv; struct timeval tv;
gettimeofday(&tv,NULL);
ut_gettimeofday(&tv, NULL);
*sec = (ulint) tv.tv_sec; *sec = (ulint) tv.tv_sec;
*ms = (ulint) tv.tv_usec; *ms = (ulint) tv.tv_usec;
#endif
} }
/************************************************************** /**************************************************************

View File

@@ -177,4 +177,73 @@ insert into t1 values (pointfromtext('point(1,1)'));
drop table t1; drop table t1;
# End of 5.0 tests --echo End of 4.1 tests
#
# Bug#24563: MBROverlaps does not seem to function propertly
# Bug#54888: MBROverlaps missing in 5.1?
#
# Test all MBR* functions and their non-MBR-prefixed aliases,
# using shifted squares to verify the spatial relations.
CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
# Overlaps needs a few more tests, with point and line dimensions
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
DROP TABLE t1;
--echo End of 5.0 tests

View File

@@ -498,6 +498,17 @@ sub collect_one_test_case($$$$$$$) {
{ {
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test"); mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
if ( defined $::used_default_engine )
{
# Different default engine is used
# tag test to require that engine
$tinfo->{'ndb_test'}= 1
if ( $::used_default_engine =~ /^ndb/i );
$tinfo->{'innodb_test'}= 1
if ( $::used_default_engine =~ /^innodb/i );
}
if ( $tinfo->{'big_test'} and ! $::opt_big_test ) if ( $tinfo->{'big_test'} and ! $::opt_big_test )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;

View File

@@ -38,8 +38,8 @@ sub mtr_kill_processes ($);
sub mtr_ping_with_timeout($); sub mtr_ping_with_timeout($);
sub mtr_ping_port ($); sub mtr_ping_port ($);
# static in C # Local function
sub spawn_impl ($$$$$$$$); sub spawn_impl ($$$$$$$);
############################################################################## ##############################################################################
# #
@@ -47,18 +47,16 @@ sub spawn_impl ($$$$$$$$);
# #
############################################################################## ##############################################################################
# This function try to mimic the C version used in "netware/mysql_test_run.c"
sub mtr_run ($$$$$$;$) { sub mtr_run ($$$$$$;$) {
my $path= shift; my $path= shift;
my $arg_list_t= shift; my $arg_list_t= shift;
my $input= shift; my $input= shift;
my $output= shift; my $output= shift;
my $error= shift; my $error= shift;
my $pid_file= shift; my $pid_file= shift; # Not used
my $spawn_opts= shift; my $spawn_opts= shift;
return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file, return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,
$spawn_opts); $spawn_opts);
} }
@@ -68,10 +66,10 @@ sub mtr_run_test ($$$$$$;$) {
my $input= shift; my $input= shift;
my $output= shift; my $output= shift;
my $error= shift; my $error= shift;
my $pid_file= shift; my $pid_file= shift; # Not used
my $spawn_opts= shift; my $spawn_opts= shift;
return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file, return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,
$spawn_opts); $spawn_opts);
} }
@@ -81,28 +79,22 @@ sub mtr_spawn ($$$$$$;$) {
my $input= shift; my $input= shift;
my $output= shift; my $output= shift;
my $error= shift; my $error= shift;
my $pid_file= shift; my $pid_file= shift; # Not used
my $spawn_opts= shift; my $spawn_opts= shift;
return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file, return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,
$spawn_opts); $spawn_opts);
} }
##############################################################################
#
# If $join is set, we return the error code, else we return the PID
#
##############################################################################
sub spawn_impl ($$$$$$$$) { sub spawn_impl ($$$$$$$) {
my $path= shift; my $path= shift;
my $arg_list_t= shift; my $arg_list_t= shift;
my $mode= shift; my $mode= shift;
my $input= shift; my $input= shift;
my $output= shift; my $output= shift;
my $error= shift; my $error= shift;
my $pid_file= shift; # FIXME
my $spawn_opts= shift; my $spawn_opts= shift;
if ( $::opt_script_debug ) if ( $::opt_script_debug )
@@ -155,10 +147,6 @@ sub spawn_impl ($$$$$$$$) {
else else
{ {
# Child, redirect output and exec # Child, redirect output and exec
# FIXME I tried POSIX::setsid() here to detach and, I hoped,
# avoid zombies. But everything went wild, somehow the parent
# became a deamon as well, and was hard to kill ;-)
# Need to catch SIGCHLD and do waitpid or something instead......
$SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
@@ -196,7 +184,15 @@ sub spawn_impl ($$$$$$$$) {
} }
else else
{ {
if ( ! open(STDERR,$log_file_open_mode,$error) ) if ( $::glob_win32_perl )
{
# Don't redirect stdout on ActiveState perl since this is
# just another thread in the same process.
# Should be fixed so that the thread that is created with fork
# executes the exe in another process and wait's for it to return.
# In the meanwhile, we get all the output from mysqld's to screen
}
elsif ( ! open(STDERR,$log_file_open_mode,$error) )
{ {
mtr_child_error("can't redirect STDERR to \"$error\": $!"); mtr_child_error("can't redirect STDERR to \"$error\": $!");
} }
@@ -259,9 +255,7 @@ sub spawn_parent_impl {
# We do blocking waitpid() until we get the return from the # We do blocking waitpid() until we get the return from the
# "mysqltest" call. But if a mysqld process dies that we # "mysqltest" call. But if a mysqld process dies that we
# started, we take this as an error, and kill mysqltest. # started, we take this as an error, and kill mysqltest.
#
# FIXME is this as it should be? Can't mysqld terminate
# normally from running a test case?
my $exit_value= -1; my $exit_value= -1;
my $saved_exit_value; my $saved_exit_value;
@@ -450,7 +444,6 @@ sub mtr_kill_leftovers () {
# We scan the "var/run/" directory for other process id's to kill # We scan the "var/run/" directory for other process id's to kill
# FIXME $path_run_dir or something
my $rundir= "$::opt_vardir/run"; my $rundir= "$::opt_vardir/run";
mtr_debug("Processing PID files in directory '$rundir'..."); mtr_debug("Processing PID files in directory '$rundir'...");

View File

@@ -304,6 +304,7 @@ our $path_sql_dir;
our @data_dir_lst; our @data_dir_lst;
our $used_binlog_format; our $used_binlog_format;
our $used_default_engine;
our $debug_compiled_binaries; our $debug_compiled_binaries;
our $glob_tot_real_time= 0; our $glob_tot_real_time= 0;
@@ -519,7 +520,7 @@ sub command_line_setup () {
'compress' => \$opt_compress, 'compress' => \$opt_compress,
'bench' => \$opt_bench, 'bench' => \$opt_bench,
'small-bench' => \$opt_small_bench, 'small-bench' => \$opt_small_bench,
'with-ndbcluster' => \$opt_with_ndbcluster, 'with-ndbcluster|ndb' => \$opt_with_ndbcluster,
'vs-config' => \$opt_vs_config, 'vs-config' => \$opt_vs_config,
# Control what test suites or cases to run # Control what test suites or cases to run
@@ -776,6 +777,26 @@ sub command_line_setup () {
mtr_report("Using binlog format '$used_binlog_format'"); mtr_report("Using binlog format '$used_binlog_format'");
} }
# --------------------------------------------------------------------------
# Find out default storage engine being used(if any)
# --------------------------------------------------------------------------
if ( $opt_with_ndbcluster )
{
# --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster
push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster");
}
foreach my $arg ( @opt_extra_mysqld_opt )
{
if ( $arg =~ /default-storage-engine=(\S+)/ )
{
$used_default_engine= $1;
}
}
mtr_report("Using default engine '$used_default_engine'")
if defined $used_default_engine;
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Check if we should speed up tests by trying to run on tmpfs # Check if we should speed up tests by trying to run on tmpfs
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
@@ -848,20 +869,22 @@ sub command_line_setup () {
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Check im suport # Check im suport
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
if (!$opt_extern) if ($opt_extern)
{ {
if ( $mysql_version_id < 50000 ) { mtr_report("Disable instance manager when running with extern mysqld");
# Instance manager is not supported until 5.0 $opt_skip_im= 1;
$opt_skip_im= 1;
}
if ( $glob_win32 ) {
mtr_report("Disable Instance manager - not supported on Windows");
$opt_skip_im= 1;
}
} }
elsif ( $mysql_version_id < 50000 )
{
# Instance manager is not supported until 5.0
$opt_skip_im= 1;
}
elsif ( $glob_win32 )
{
mtr_report("Disable Instance manager - testing not supported on Windows");
$opt_skip_im= 1;
}
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Record flag # Record flag
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
@@ -899,10 +922,6 @@ sub command_line_setup () {
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Ndb cluster flags # Ndb cluster flags
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
if ( $opt_with_ndbcluster and !$opt_bench)
{
mtr_error("Can only use --with-ndbcluster togheter with --bench");
}
if ( $opt_ndbconnectstring ) if ( $opt_ndbconnectstring )
{ {
@@ -1055,8 +1074,6 @@ sub command_line_setup () {
# socket path names. # socket path names.
$sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) > 80 ); $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) > 80 );
# Put this into a hash, will be a C struct
$master->[0]= $master->[0]=
{ {
pid => 0, pid => 0,
@@ -1064,7 +1081,6 @@ sub command_line_setup () {
idx => 0, idx => 0,
path_myddir => "$opt_vardir/master-data", path_myddir => "$opt_vardir/master-data",
path_myerr => "$opt_vardir/log/master.err", path_myerr => "$opt_vardir/log/master.err",
path_mylog => "$opt_vardir/log/master.log",
path_pid => "$opt_vardir/run/master.pid", path_pid => "$opt_vardir/run/master.pid",
path_sock => "$sockdir/master.sock", path_sock => "$sockdir/master.sock",
port => $opt_master_myport, port => $opt_master_myport,
@@ -1080,7 +1096,6 @@ sub command_line_setup () {
idx => 1, idx => 1,
path_myddir => "$opt_vardir/master1-data", path_myddir => "$opt_vardir/master1-data",
path_myerr => "$opt_vardir/log/master1.err", path_myerr => "$opt_vardir/log/master1.err",
path_mylog => "$opt_vardir/log/master1.log",
path_pid => "$opt_vardir/run/master1.pid", path_pid => "$opt_vardir/run/master1.pid",
path_sock => "$sockdir/master1.sock", path_sock => "$sockdir/master1.sock",
port => $opt_master_myport + 1, port => $opt_master_myport + 1,
@@ -1096,7 +1111,6 @@ sub command_line_setup () {
idx => 0, idx => 0,
path_myddir => "$opt_vardir/slave-data", path_myddir => "$opt_vardir/slave-data",
path_myerr => "$opt_vardir/log/slave.err", path_myerr => "$opt_vardir/log/slave.err",
path_mylog => "$opt_vardir/log/slave.log",
path_pid => "$opt_vardir/run/slave.pid", path_pid => "$opt_vardir/run/slave.pid",
path_sock => "$sockdir/slave.sock", path_sock => "$sockdir/slave.sock",
port => $opt_slave_myport, port => $opt_slave_myport,
@@ -1113,7 +1127,6 @@ sub command_line_setup () {
idx => 1, idx => 1,
path_myddir => "$opt_vardir/slave1-data", path_myddir => "$opt_vardir/slave1-data",
path_myerr => "$opt_vardir/log/slave1.err", path_myerr => "$opt_vardir/log/slave1.err",
path_mylog => "$opt_vardir/log/slave1.log",
path_pid => "$opt_vardir/run/slave1.pid", path_pid => "$opt_vardir/run/slave1.pid",
path_sock => "$sockdir/slave1.sock", path_sock => "$sockdir/slave1.sock",
port => $opt_slave_myport + 1, port => $opt_slave_myport + 1,
@@ -1129,7 +1142,6 @@ sub command_line_setup () {
idx => 2, idx => 2,
path_myddir => "$opt_vardir/slave2-data", path_myddir => "$opt_vardir/slave2-data",
path_myerr => "$opt_vardir/log/slave2.err", path_myerr => "$opt_vardir/log/slave2.err",
path_mylog => "$opt_vardir/log/slave2.log",
path_pid => "$opt_vardir/run/slave2.pid", path_pid => "$opt_vardir/run/slave2.pid",
path_sock => "$sockdir/slave2.sock", path_sock => "$sockdir/slave2.sock",
port => $opt_slave_myport + 2, port => $opt_slave_myport + 2,
@@ -1333,7 +1345,7 @@ sub collect_mysqld_features () {
# #
# Execute "mysqld --no-defaults --help --verbose" to get a # Execute "mysqld --no-defaults --help --verbose" to get a
# of all features and settings # list of all features and settings
# #
my $list= `$exe_mysqld --no-defaults --verbose --help`; my $list= `$exe_mysqld --no-defaults --verbose --help`;
@@ -1397,6 +1409,40 @@ sub collect_mysqld_features () {
} }
sub run_query($$) {
my ($mysqld, $query)= @_;
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--user=%s", $opt_user);
mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
mtr_add_arg($args, "--silent"); # Tab separated output
mtr_add_arg($args, "-e '%s'", $query);
my $cmd= "$exe_mysql " . join(' ', @$args);
mtr_verbose("cmd: $cmd");
return `$cmd`;
}
sub collect_mysqld_features_from_running_server ()
{
my $list= run_query($master->[0], "use mysql; SHOW VARIABLES");
foreach my $line (split('\n', $list))
{
# Put variables into hash
if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
{
print "$1=\"$2\"\n";
$mysqld_variables{$1}= $2;
}
}
}
sub executable_setup_im () { sub executable_setup_im () {
# Look for instance manager binary - mysqlmanager # Look for instance manager binary - mysqlmanager
@@ -1913,7 +1959,7 @@ sub environment_setup () {
# ---------------------------------------------------- # ----------------------------------------------------
my $cmdline_mysqlbinlog= my $cmdline_mysqlbinlog=
mtr_native_path($exe_mysqlbinlog) . mtr_native_path($exe_mysqlbinlog) .
" --no-defaults --local-load=$opt_tmpdir"; " --no-defaults";
if (!$opt_extern && $mysql_version_id >= 50000 ) if (!$opt_extern && $mysql_version_id >= 50000 )
{ {
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir"; $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
@@ -3691,8 +3737,10 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--log-output=table,file", $prefix); mtr_add_arg($args, "%s--log-output=table,file", $prefix);
} }
mtr_add_arg($args, "%s--log=%s", $prefix, $mysqld->{'path_mylog'}); my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
mtr_add_arg($args,
"%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
# Check if "extra_opt" contains --skip-log-bin # Check if "extra_opt" contains --skip-log-bin
my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt); my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt);
@@ -4992,7 +5040,7 @@ Options to control what engine/variation to run
skip-ssl Dont start server with support for ssl connections skip-ssl Dont start server with support for ssl connections
bench Run the benchmark suite bench Run the benchmark suite
small-bench Run the benchmarks with --small-tests --small-tables small-bench Run the benchmarks with --small-tests --small-tables
with-ndbcluster Use cluster as default table type for benchmark ndb|with-ndbcluster Use cluster as default table type
vs-config Visual Studio configuration used to create executables vs-config Visual Studio configuration used to create executables
(default: MTR_VS_CONFIG environment variable) (default: MTR_VS_CONFIG environment variable)

View File

@@ -12355,3 +12355,12 @@ auto fld1 companynr fld3 fld4 fld5
4 011403 37 intercepted audiology tinily 4 011403 37 intercepted audiology tinily
4 011403 37 intercepted audiology tinily 4 011403 37 intercepted audiology tinily
drop table t1, t2, t4; drop table t1, t2, t4;
create table t1 (i int) engine=archive;
insert into t1 values (1);
repair table t1 use_frm;
Table Op Msg_type Msg_text
test.t1 repair status OK
select * from t1;
i
1
drop table t1;

View File

@@ -392,7 +392,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0 120 120 1 1 0 1 0 0 1 0
120 121 0 0 0 0 0 0 1 0 120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0 121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0 121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second, explain extended SELECT g1.fid as first, g2.fid as second,
@@ -456,3 +456,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)')); insert into t1 values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null ERROR 23000: Column 'fl' cannot be null
drop table t1; drop table t1;
End of 4.1 tests
CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrcontains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrdisjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrequal
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrintersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
contains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
disjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
equals
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
intersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
overlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
overlaps
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
Overlaps(@horiz1, @vert1)
0
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
Overlaps(@horiz1, @horiz2)
1
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
Overlaps(@horiz1, @horiz3)
0
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
Overlaps(@horiz1, @point1)
0
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
Overlaps(@horiz1, @point2)
0
DROP TABLE t1;
End of 5.0 tests

View File

@@ -392,7 +392,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0 120 120 1 1 0 1 0 0 1 0
120 121 0 0 0 0 0 0 1 0 120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0 121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0 121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second, explain extended SELECT g1.fid as first, g2.fid as second,
@@ -456,3 +456,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)')); insert into t1 values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null ERROR 23000: Column 'fl' cannot be null
drop table t1; drop table t1;
End of 4.1 tests
CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrcontains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrdisjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrequal
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrintersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
contains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
disjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
equals
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
intersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
overlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
overlaps
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
Overlaps(@horiz1, @vert1)
0
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
Overlaps(@horiz1, @horiz2)
1
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
Overlaps(@horiz1, @horiz3)
0
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
Overlaps(@horiz1, @point1)
0
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
Overlaps(@horiz1, @point2)
0
DROP TABLE t1;
End of 5.0 tests

View File

@@ -771,3 +771,4 @@ t1 CREATE TABLE `t1` (
drop table t1; drop table t1;
create table t1 (upgrade int); create table t1 (upgrade int);
drop table t1; drop table t1;
End of 5.0 tests

View File

@@ -186,12 +186,12 @@ date format datetime
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450 2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12 2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
10:20:10 %H:%i:%s 0000-00-00 00:00:00 10:20:10 %H:%i:%s 0000-00-00 10:20:10
10:20:10 %h:%i:%s.%f 0000-00-00 00:00:00 10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
10:20:10 %T 0000-00-00 00:00:00 10:20:10 %T 0000-00-00 10:20:10
10:20:10AM %h:%i:%s%p 0000-00-00 00:00:00 10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
10:20:10AM %r 0000-00-00 00:00:00 10:20:10AM %r 0000-00-00 10:20:10
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 00:00:00 10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58 15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
15 September 2001 %d %M %Y 2001-09-15 00:00:00 15 September 2001 %d %M %Y 2001-09-15 00:00:00
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00 15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
@@ -208,13 +208,6 @@ Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00 15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
15-01-20 %d-%m-%y 2020-01-15 00:00:00 15-01-20 %d-%m-%y 2020-01-15 00:00:00
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00 15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
Warnings:
Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10.440000'
select date,format,DATE(str_to_date(date, format)) as date2 from t1; select date,format,DATE(str_to_date(date, format)) as date2 from t1;
date format date2 date format date2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
@@ -255,12 +248,12 @@ date format time
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450 2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12 2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
10:20:10 %H:%i:%s NULL 10:20:10 %H:%i:%s 10:20:10
10:20:10 %h:%i:%s.%f NULL 10:20:10 %h:%i:%s.%f 10:20:10
10:20:10 %T NULL 10:20:10 %T 10:20:10
10:20:10AM %h:%i:%s%p NULL 10:20:10AM %h:%i:%s%p 10:20:10
10:20:10AM %r NULL 10:20:10AM %r 10:20:10
10:20:10.44AM %h:%i:%s.%f%p NULL 10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58 15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00 15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00 15 SEPTEMB 2001 %d %M %Y 00:00:00
@@ -277,13 +270,6 @@ Tuesday 52 2001 %W %V %X 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00 15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00 15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00 15-2001-1 %d-%Y-%c 00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000'
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1; select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
date format time2 date format time2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
@@ -293,12 +279,12 @@ date format time2
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450 2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12 2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
10:20:10 %H:%i:%s NULL 10:20:10 %H:%i:%s 10:20:10
10:20:10 %h:%i:%s.%f NULL 10:20:10 %h:%i:%s.%f 10:20:10
10:20:10 %T NULL 10:20:10 %T 10:20:10
10:20:10AM %h:%i:%s%p NULL 10:20:10AM %h:%i:%s%p 10:20:10
10:20:10AM %r NULL 10:20:10AM %r 10:20:10
10:20:10.44AM %h:%i:%s.%f%p NULL 10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58 15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00 15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00 15 SEPTEMB 2001 %d %M %Y 00:00:00
@@ -315,13 +301,6 @@ Tuesday 52 2001 %W %V %X 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00 15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00 15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00 15-2001-1 %d-%Y-%c 00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000'
select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')); select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d')) concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'))
2003-01-02 08:11:02.123456 2003-01-02 08:11:02.123456
@@ -470,8 +449,6 @@ create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%
str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2, str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
str_to_date("2003-01-02", "%Y-%m-%d") as f3, str_to_date("2003-01-02", "%Y-%m-%d") as f3,
str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5; str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
Warnings:
Warning 1265 Data truncated for column 'f4' at row 1
describe t1; describe t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
f1 datetime YES NULL f1 datetime YES NULL
@@ -481,7 +458,7 @@ f4 date YES NULL
f5 time YES NULL f5 time YES NULL
select * from t1; select * from t1;
f1 f2 f3 f4 f5 f1 f2 f3 f4 f5
2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-00 58:00:00 2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00
drop table t1; drop table t1;
create table t1 select "02 10" as a, "%d %H" as b; create table t1 select "02 10" as a, "%d %H" as b;
select str_to_date(a,b) from t1; select str_to_date(a,b) from t1;

View File

@@ -28,3 +28,16 @@ ERROR 42000: Display width out of range for column 'a' (max = 255)
set sql_mode='traditional'; set sql_mode='traditional';
create table t1 (a varchar(66000)); create table t1 (a varchar(66000));
ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
set sql_mode=default;
CREATE TABLE t1 (a INT);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
a
INSERT INTO t1 VALUES(1);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
a
1
INSERT INTO t1 VALUES(2),(3);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
a
1
DROP TABLE t1;

View File

@@ -1,24 +1,12 @@
flush logs; flush logs;
set global expire_logs_days = 3; set global expire_logs_days = 3;
show variables like 'log%'; show variables like 'log_bin%';
Variable_name Value Variable_name Value
log ON
log_bin OFF log_bin OFF
log_bin_trust_function_creators ON log_bin_trust_function_creators ON
log_error
log_queries_not_using_indexes OFF
log_slave_updates OFF
log_slow_queries OFF
log_warnings 1
flush logs; flush logs;
show variables like 'log%'; show variables like 'log_bin%';
Variable_name Value Variable_name Value
log ON
log_bin OFF log_bin OFF
log_bin_trust_function_creators ON log_bin_trust_function_creators ON
log_error
log_queries_not_using_indexes OFF
log_slave_updates OFF
log_slow_queries OFF
log_warnings 1
set global expire_logs_days = 0; set global expire_logs_days = 0;

View File

@@ -90,3 +90,10 @@ id link name relevance
1 1 string 0 1 1 string 0
2 0 string 0 2 0 string 0
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT, c TEXT, KEY(b));
INSERT INTO t1 VALUES(1);
INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
a b c
DROP TABLE t1, t2;

View File

@@ -1296,6 +1296,15 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
0.5 0.25 0.5 0.25
0.5000 0.2500 0.5000 0.2500
drop table bug22555; drop table bug22555;
create table t1 (a decimal(20));
insert into t1 values (12345678901234567890);
select count(a) from t1;
count(a)
1
select count(distinct a) from t1;
count(distinct a)
1
drop table t1;
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8); INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
INSERT INTO t1 SELECT a, b+8 FROM t1; INSERT INTO t1 SELECT a, b+8 FROM t1;

View File

@@ -1964,6 +1964,15 @@ A B tire
0 0
# # 1 # # 1
## ## 2 ## ## 2
SELECT REPEAT('0', CAST(0 AS UNSIGNED));
REPEAT('0', CAST(0 AS UNSIGNED))
SELECT REPEAT('0', -2);
REPEAT('0', -2)
SELECT REPEAT('0', 2);
REPEAT('0', 2)
00
DROP TABLE t1; DROP TABLE t1;
SELECT UNHEX('G'); SELECT UNHEX('G');
UNHEX('G') UNHEX('G')

View File

@@ -385,7 +385,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0 120 120 1 1 0 1 0 0 1 0
120 121 0 0 0 0 0 0 1 0 120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0 121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0 121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second, explain extended SELECT g1.fid as first, g2.fid as second,
@@ -780,3 +780,88 @@ Field Type Null Key Default Extra
a geometry YES NULL a geometry YES NULL
DROP VIEW v1,v2; DROP VIEW v1,v2;
DROP TABLE t1; DROP TABLE t1;
create table t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrcontains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrdisjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrequal
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrintersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
contains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
disjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
equals
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
intersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
overlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
overlaps
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
Overlaps(@horiz1, @vert1)
0
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
Overlaps(@horiz1, @horiz2)
1
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
Overlaps(@horiz1, @horiz3)
0
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
Overlaps(@horiz1, @point1)
0
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
Overlaps(@horiz1, @point2)
0
DROP TABLE t1;
End of 5.0 tests

View File

@@ -687,7 +687,7 @@ Warnings:
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
show create table v3; show create table v3;
View Create View View Create View
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `test`.`sub1`(1) AS `c` v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `sub1`(1) AS `c`
Warnings: Warnings:
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v2; drop view v2;

View File

@@ -2968,3 +2968,21 @@ a
drop table t2, t1; drop table t2, t1;
create table t1 (g geometry not null, spatial gk(g)) engine=innodb; create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
ERROR HY000: The used table type doesn't support SPATIAL indexes ERROR HY000: The used table type doesn't support SPATIAL indexes
CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
ALTER TABLE t2 MODIFY a INT NOT NULL;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
DELETE FROM t1;
DROP TABLE t2,t1;
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
ENGINE=InnoDB;
INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
DELETE FROM t1;
INSERT INTO t1 VALUES ('DDD');
SELECT * FROM t1;
a
DDD
DROP TABLE t1;

View File

@@ -392,7 +392,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0 120 120 1 1 0 1 0 0 1 0
120 121 0 0 0 0 0 0 1 0 120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0 121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0 121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second, explain extended SELECT g1.fid as first, g2.fid as second,
@@ -456,3 +456,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)')); insert into t1 values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null ERROR 23000: Column 'fl' cannot be null
drop table t1; drop table t1;
End of 4.1 tests
CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrcontains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrdisjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrequal
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrintersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
contains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
disjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
equals
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
intersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
overlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
overlaps
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
Overlaps(@horiz1, @vert1)
0
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
Overlaps(@horiz1, @horiz2)
1
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
Overlaps(@horiz1, @horiz3)
0
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
Overlaps(@horiz1, @point1)
0
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
Overlaps(@horiz1, @point2)
0
DROP TABLE t1;
End of 5.0 tests

View File

@@ -156,3 +156,12 @@ select load_file("MYSQL_TEST_DIR/t/loaddata.test");
load_file("MYSQL_TEST_DIR/t/loaddata.test") load_file("MYSQL_TEST_DIR/t/loaddata.test")
NULL NULL
drop table t1, t2; drop table t1, t2;
create table t1(f1 int);
insert into t1 values(1),(null);
create table t2(f2 int auto_increment primary key);
select * from t2;
f2
1
2
SET @@SQL_MODE=@OLD_SQL_MODE;
drop table t1,t2;

View File

@@ -289,23 +289,23 @@ SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
create table t1 (a varchar(64) character set utf8)/*!*/; create table t1 (a varchar(64) character set utf8)/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-6-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/; SET @@session.collation_database=7/*!*/;
load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-7-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/; SET @@session.collation_database=DEFAULT/*!*/;
load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-8-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-9-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/; SET @@session.collation_database=7/*!*/;
load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-a-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/; SET @@session.collation_database=DEFAULT/*!*/;
load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-b-0' INTO table t1/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/; load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
drop table t1/*!*/; drop table t1/*!*/;
DELIMITER ; DELIMITER ;

View File

@@ -1567,29 +1567,17 @@ create table t3(a varchar(30) primary key, b int not null);
test_sequence test_sequence
------ Testing with illegal table names ------ ------ Testing with illegal table names ------
mysqldump: Couldn't find table: "\d-2-1.sql" mysqldump: Couldn't find table: "\d-2-1.sql"
mysqldump: Couldn't find table: "\t1" mysqldump: Couldn't find table: "\t1"
mysqldump: Couldn't find table: "\t1" mysqldump: Couldn't find table: "\t1"
mysqldump: Couldn't find table: "\\t1" mysqldump: Couldn't find table: "\\t1"
mysqldump: Couldn't find table: "t\1" mysqldump: Couldn't find table: "t\1"
mysqldump: Couldn't find table: "t\1" mysqldump: Couldn't find table: "t\1"
mysqldump: Couldn't find table: "t/1" mysqldump: Couldn't find table: "t/1"
mysqldump: Couldn't find table: "T_1" mysqldump: Couldn't find table: "T_1"
mysqldump: Couldn't find table: "T%1" mysqldump: Couldn't find table: "T%1"
mysqldump: Couldn't find table: "T'1" mysqldump: Couldn't find table: "T'1"
mysqldump: Couldn't find table: "T_1" mysqldump: Couldn't find table: "T_1"
mysqldump: Couldn't find table: "T_" mysqldump: Couldn't find table: "T_"
test_sequence test_sequence
------ Testing with illegal database names ------ ------ Testing with illegal database names ------
mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database
@@ -3218,5 +3206,82 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
</mysqldump> </mysqldump>
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#26346: stack + buffer overrun in mysqldump
#
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
mysqldump: Input filename or options too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t1;
CREATE TABLE t2 (a int);
CREATE TABLE t3 (a int);
CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`);
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t3`;
CREATE TABLE `t3` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t3` WRITE;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1, t2, t3;
#
# Bug #23491: MySQLDump prefix function call in a view by database name
#
create database bug23491_original;
create database bug23491_restore;
use bug23491_original;
create table t1 (c1 int);
create view v1 as select * from t1;
create procedure p1() select 1;
create function f1() returns int return 1;
create view v2 as select f1();
create function f2() returns int return f1();
create view v3 as select bug23491_original.f1();
use bug23491_restore;
show create view bug23491_restore.v2;
View Create View
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `f1`() AS `f1()`
show create view bug23491_restore.v3;
View Create View
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `bug23491_original`.`f1`() AS `bug23491_original.f1()`
drop database bug23491_original;
drop database bug23491_restore;
use test;
#
# End of 5.0 tests # End of 5.0 tests
# #

View File

@@ -382,7 +382,7 @@ create table t1 (a int primary key) engine=ndb;
select * from t1; select * from t1;
a a
select * from t1; select * from t1;
ERROR HY000: Can't lock file (errno: 4009) ERROR HY000: Can't lock file (errno: 157)
use test; use test;
drop database test_only_ndb_tables; drop database test_only_ndb_tables;
CREATE TABLE t9 ( CREATE TABLE t9 (

View File

@@ -392,7 +392,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0 120 120 1 1 0 1 0 0 1 0
120 121 0 0 0 0 0 0 1 0 120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0 121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0 121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second, explain extended SELECT g1.fid as first, g2.fid as second,
@@ -456,6 +456,92 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)')); insert into t1 values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null ERROR 23000: Column 'fl' cannot be null
drop table t1; drop table t1;
End of 4.1 tests
CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrcontains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrdisjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrequal
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrintersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
contains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
disjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
equals
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
intersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
overlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
overlaps
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
Overlaps(@horiz1, @vert1)
0
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
Overlaps(@horiz1, @horiz2)
1
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
Overlaps(@horiz1, @horiz3)
0
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
Overlaps(@horiz1, @point1)
0
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
Overlaps(@horiz1, @point2)
0
DROP TABLE t1;
End of 5.0 tests
set engine_condition_pushdown = on; set engine_condition_pushdown = on;
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE gis_point (fid INTEGER, g POINT); CREATE TABLE gis_point (fid INTEGER, g POINT);
@@ -850,7 +936,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0 120 120 1 1 0 1 0 0 1 0
120 121 0 0 0 0 0 0 1 0 120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0 121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0 121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second, explain extended SELECT g1.fid as first, g2.fid as second,
@@ -914,3 +1000,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)')); insert into t1 values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null ERROR 23000: Column 'fl' cannot be null
drop table t1; drop table t1;
End of 4.1 tests
CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrcontains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrdisjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrequal
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrintersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
contains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
disjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
equals
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
intersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
overlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
overlaps
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
Overlaps(@horiz1, @vert1)
0
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
Overlaps(@horiz1, @horiz2)
1
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
Overlaps(@horiz1, @horiz3)
0
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
Overlaps(@horiz1, @point1)
0
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
Overlaps(@horiz1, @point2)
0
DROP TABLE t1;
End of 5.0 tests

View File

@@ -116,4 +116,175 @@ op a b
d 1 1.050000000000000000000000000000 d 1 1.050000000000000000000000000000
d 2 2.050000000000000000000000000000 d 2 2.050000000000000000000000000000
drop tables t1, t2, t3; drop tables t1, t2, t3;
CREATE TABLE t1 (
id INT NOT NULL PRIMARY KEY,
xy INT
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (1, 0);
CREATE TRIGGER t1_update AFTER UPDATE ON t1 FOR EACH ROW BEGIN REPLACE INTO t2 SELECT * FROM t1 WHERE t1.id = NEW.id; END //
CREATE TABLE t2 (
id INT NOT NULL PRIMARY KEY,
xy INT
) ENGINE=ndbcluster;
INSERT INTO t2 VALUES (2, 0);
CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY) ENGINE=ndbcluster;
INSERT INTO t3 VALUES (1);
CREATE TABLE t4 LIKE t1;
CREATE TRIGGER t4_update AFTER UPDATE ON t4 FOR EACH ROW BEGIN REPLACE INTO t5 SELECT * FROM t4 WHERE t4.id = NEW.id; END //
CREATE TABLE t5 LIKE t2;
UPDATE t1 SET xy = 3 WHERE id = 1;
SELECT xy FROM t1 where id = 1;
xy
3
SELECT xy FROM t2 where id = 1;
xy
3
UPDATE t1 SET xy = 4 WHERE id IN (SELECT id FROM t3 WHERE id = 1);
SELECT xy FROM t1 where id = 1;
xy
4
SELECT xy FROM t2 where id = 1;
xy
4
INSERT INTO t4 SELECT * FROM t1;
INSERT INTO t5 SELECT * FROM t2;
UPDATE t1,t4 SET t1.xy = 3, t4.xy = 3 WHERE t1.id = 1 AND t4.id = 1;
SELECT xy FROM t1 where id = 1;
xy
3
SELECT xy FROM t2 where id = 1;
xy
3
SELECT xy FROM t4 where id = 1;
xy
3
SELECT xy FROM t5 where id = 1;
xy
3
UPDATE t1,t4 SET t1.xy = 4, t4.xy = 4 WHERE t1.id IN (SELECT id FROM t3 WHERE id = 1) AND t4.id IN (SELECT id FROM t3 WHERE id = 1);
SELECT xy FROM t1 where id = 1;
xy
4
SELECT xy FROM t2 where id = 1;
xy
4
SELECT xy FROM t4 where id = 1;
xy
4
SELECT xy FROM t5 where id = 1;
xy
4
INSERT INTO t1 VALUES (1,0) ON DUPLICATE KEY UPDATE xy = 5;
SELECT xy FROM t1 where id = 1;
xy
5
SELECT xy FROM t2 where id = 1;
xy
5
DROP TRIGGER t1_update;
DROP TRIGGER t4_update;
CREATE TRIGGER t1_delete AFTER DELETE ON t1 FOR EACH ROW BEGIN REPLACE INTO t2 SELECT * FROM t1 WHERE t1.id > 4; END //
CREATE TRIGGER t4_delete AFTER DELETE ON t4 FOR EACH ROW BEGIN REPLACE INTO t5 SELECT * FROM t4 WHERE t4.id > 4; END //
INSERT INTO t1 VALUES (5, 0),(6,0);
INSERT INTO t2 VALUES (5, 1),(6,1);
INSERT INTO t3 VALUES (5);
SELECT * FROM t1 order by id;
id xy
1 5
5 0
6 0
SELECT * FROM t2 order by id;
id xy
1 5
2 0
5 1
6 1
DELETE FROM t1 WHERE id IN (SELECT id FROM t3 WHERE id = 5);
SELECT * FROM t1 order by id;
id xy
1 5
6 0
SELECT * FROM t2 order by id;
id xy
1 5
2 0
5 1
6 0
INSERT INTO t1 VALUES (5,0);
UPDATE t2 SET xy = 1 WHERE id = 6;
TRUNCATE t4;
INSERT INTO t4 SELECT * FROM t1;
TRUNCATE t5;
INSERT INTO t5 SELECT * FROM t2;
SELECT * FROM t1 order by id;
id xy
1 5
5 0
6 0
SELECT * FROM t2 order by id;
id xy
1 5
2 0
5 1
6 1
SELECT * FROM t4 order by id;
id xy
1 5
5 0
6 0
SELECT * FROM t5 order by id;
id xy
1 5
2 0
5 1
6 1
DELETE FROM t1,t4 USING t1,t3,t4 WHERE t1.id IN (SELECT id FROM t3 WHERE id = 5) AND t4.id IN (SELECT id FROM t3 WHERE id = 5);
SELECT * FROM t1 order by id;
id xy
1 5
6 0
SELECT * FROM t2 order by id;
id xy
1 5
2 0
5 1
6 0
SELECT * FROM t4 order by id;
id xy
1 5
6 0
SELECT * FROM t5 order by id;
id xy
1 5
2 0
5 1
6 0
INSERT INTO t1 VALUES (5, 0);
REPLACE INTO t2 VALUES (6,1);
SELECT * FROM t1 order by id;
id xy
1 5
5 0
6 0
SELECT * FROM t2 order by id;
id xy
1 5
2 0
5 1
6 1
REPLACE INTO t1 VALUES (5, 1);
SELECT * FROM t1 order by id;
id xy
1 5
5 1
6 0
SELECT * FROM t2 order by id;
id xy
1 5
2 0
5 1
6 0
DROP TRIGGER t1_delete;
DROP TRIGGER t4_delete;
DROP TABLE t1, t2, t3, t4, t5;
End of 5.0 tests End of 5.0 tests

View File

@@ -51,3 +51,5 @@ SSL error: Unable to get private key from ''
mysqltest: Could not open connection 'default': 2026 SSL connection error mysqltest: Could not open connection 'default': 2026 SSL connection error
SSL error: Unable to get certificate from '' SSL error: Unable to get certificate from ''
mysqltest: Could not open connection 'default': 2026 SSL connection error mysqltest: Could not open connection 'default': 2026 SSL connection error
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA

View File

@@ -906,6 +906,90 @@ ERROR 23000: Column 'val' in order clause is ambiguous
SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1; SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
ERROR 23000: Column 'val' in order clause is ambiguous ERROR 23000: Column 'val' in order clause is ambiguous
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (2), (4), (1);
SELECT a, IF(a IN (2,3), a, a+10) FROM t1
ORDER BY IF(a IN (2,3), a, a+10);
a IF(a IN (2,3), a, a+10)
2 2
3 3
1 11
4 14
SELECT a, IF(a NOT IN (2,3), a, a+10) FROM t1
ORDER BY IF(a NOT IN (2,3), a, a+10);
a IF(a NOT IN (2,3), a, a+10)
1 1
4 4
2 12
3 13
SELECT a, IF(a IN (2,3), a, a+10) FROM t1
ORDER BY IF(a NOT IN (2,3), a, a+10);
a IF(a IN (2,3), a, a+10)
1 11
4 14
2 2
3 3
SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
ORDER BY IF(a BETWEEN 2 AND 3, a, a+10);
a IF(a BETWEEN 2 AND 3, a, a+10)
2 2
3 3
1 11
4 14
SELECT a, IF(a NOT BETWEEN 2 AND 3, a, a+10) FROM t1
ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
a IF(a NOT BETWEEN 2 AND 3, a, a+10)
1 1
4 4
2 12
3 13
SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
a IF(a BETWEEN 2 AND 3, a, a+10)
1 11
4 14
2 2
3 3
SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
FROM t1 GROUP BY x1, x2;
x1 x2
3
4
1
2
SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
FROM t1 GROUP BY x1, IF(a NOT IN (1,2), a, '');
x1 x2
3
4
1
2
SELECT a, a IN (1,2) FROM t1 ORDER BY a IN (1,2);
a a IN (1,2)
3 0
4 0
2 1
1 1
SELECT a FROM t1 ORDER BY a IN (1,2);
a
3
4
2
1
SELECT a+10 FROM t1 ORDER BY a IN (1,2);
a+10
13
14
12
11
SELECT a, IF(a IN (1,2), a, a+10) FROM t1
ORDER BY IF(a IN (3,4), a, a+10);
a IF(a IN (1,2), a, a+10)
3 13
4 14
1 1
2 2
DROP TABLE t1;
create table t1 (a int not null, b int not null, c int not null); create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1); insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c); select a, b from t1 group by a, b order by sum(c);

View File

@@ -14,6 +14,113 @@ SELECT * FROM t4;
a a
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t4; DROP TABLE t4;
**** Test case for BUG#25482 ****
**** Adding GRANTS on master ****
create table test.t1(a int);
create table test.t4(a int);
GRANT SELECT ON test.t1 TO mysqltest1@localhost;
GRANT INSERT ON test.t4 TO mysqltest2@localhost;
GRANT select, update, insert, references on t1
to mysqltest2@localhost;
GRANT SELECT ON test.* TO mysqltest3@localhost;
GRANT INSERT ON test.t4 TO mysqltest3@localhost;
GRANT select(a), update(a), insert(a), references(a) on t4
to mysqltest3@localhost;
create database mysqltest2;
create table mysqltest2.t2 (id int);
GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
insert into mysql.user (user, host) values ("mysqltest5", "somehost");
Warnings:
Warning 1364 Field 'ssl_cipher' doesn't have a default value
Warning 1364 Field 'x509_issuer' doesn't have a default value
Warning 1364 Field 'x509_subject' doesn't have a default value
GRANT SELECT ON *.* TO mysqltest6@localhost;
GRANT INSERT ON *.* TO mysqltest6@localhost;
GRANT INSERT ON test.* TO mysqltest6@localhost;
GRANT INSERT ON test.t1 TO mysqltest6@localhost;
show grants for mysqltest1@localhost;
Grants for mysqltest1@localhost
GRANT USAGE ON *.* TO 'mysqltest1'@'localhost'
GRANT SELECT ON `test`.`t1` TO 'mysqltest1'@'localhost'
show grants for mysqltest2@localhost;
Grants for mysqltest2@localhost
GRANT USAGE ON *.* TO 'mysqltest2'@'localhost'
GRANT SELECT, INSERT, UPDATE, REFERENCES ON `test`.`t1` TO 'mysqltest2'@'localhost'
GRANT INSERT ON `test`.`t4` TO 'mysqltest2'@'localhost'
show grants for mysqltest3@localhost;
Grants for mysqltest3@localhost
GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
show grants for mysqltest4@localhost;
Grants for mysqltest4@localhost
GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
GRANT SELECT ON `mysqltest2`.`t2` TO 'mysqltest4'@'localhost'
show grants for mysqltest6@localhost;
Grants for mysqltest6@localhost
GRANT SELECT, INSERT ON *.* TO 'mysqltest6'@'localhost'
GRANT INSERT ON `test`.* TO 'mysqltest6'@'localhost'
GRANT INSERT ON `test`.`t1` TO 'mysqltest6'@'localhost'
flush privileges;
show grants for mysqltest5@somehost;
Grants for mysqltest5@somehost
GRANT USAGE ON *.* TO 'mysqltest5'@'somehost'
**** Checking grants on slave ****
show grants for mysqltest2@localhost;
Grants for mysqltest2@localhost
GRANT USAGE ON *.* TO 'mysqltest2'@'localhost'
GRANT INSERT ON `test`.`t4` TO 'mysqltest2'@'localhost'
show grants for mysqltest3@localhost;
Grants for mysqltest3@localhost
GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
show grants for mysqltest4@localhost;
Grants for mysqltest4@localhost
GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
GRANT SELECT ON `mysqltest2`.`t2` TO 'mysqltest4'@'localhost'
show grants for mysqltest5@somehost;
Grants for mysqltest5@somehost
GRANT USAGE ON *.* TO 'mysqltest5'@'somehost'
show grants for mysqltest6@localhost;
Grants for mysqltest6@localhost
GRANT SELECT, INSERT ON *.* TO 'mysqltest6'@'localhost'
GRANT INSERT ON `test`.* TO 'mysqltest6'@'localhost'
show grants for mysqltest1@localhost;
ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost'
**** Revoking grants on master ****
REVOKE SELECT ON test.t1 FROM mysqltest1@localhost;
REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost;
REVOKE select(a) on t4
from mysqltest3@localhost;
show grants for mysqltest1@localhost;
Grants for mysqltest1@localhost
GRANT USAGE ON *.* TO 'mysqltest1'@'localhost'
show grants for mysqltest3@localhost;
Grants for mysqltest3@localhost
GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
show grants for mysqltest4@localhost;
Grants for mysqltest4@localhost
GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
**** Checking grants on slave ****
show grants for mysqltest1@localhost;
ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost'
show grants for mysqltest3@localhost;
Grants for mysqltest3@localhost
GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
show grants for mysqltest4@localhost;
Grants for mysqltest4@localhost
GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
drop table t1, t4, mysqltest2.t2;
drop database mysqltest2;
delete from mysql.user where user like "mysqltest%";
delete from mysql.db where user like "mysqltest%";
delete from mysql.tables_priv where user like "mysqltest%";
delete from mysql.columns_priv where user like "mysqltest%";
DROP TABLE IF EXISTS t5; DROP TABLE IF EXISTS t5;
CREATE TABLE t5 ( CREATE TABLE t5 (
word varchar(50) collate utf8_unicode_ci NOT NULL default '' word varchar(50) collate utf8_unicode_ci NOT NULL default ''

View File

@@ -187,7 +187,7 @@ Pos Instruction
32 set v_dig@4 (v_dig@4 + 1) 32 set v_dig@4 (v_dig@4 + 1)
33 stmt 4 "update sudoku_work set dig = v_dig wh..." 33 stmt 4 "update sudoku_work set dig = v_dig wh..."
34 set v_tcounter@6 (v_tcounter@6 + 1) 34 set v_tcounter@6 (v_tcounter@6 + 1)
35 jump_if_not 37(37) (not(`test`.`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4))) 35 jump_if_not 37(37) (not(`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
36 jump 15 36 jump 15
37 set v_i@3 (v_i@3 + 1) 37 set v_i@3 (v_i@3 + 1)
38 jump 15 38 jump 15

View File

@@ -5984,6 +5984,91 @@ DATABASE()
NULL NULL
DROP DATABASE mysqltest1| DROP DATABASE mysqltest1|
use test| use test|
drop function if exists bug20777|
drop table if exists examplebug20777|
create function bug20777(f1 bigint unsigned) returns bigint unsigned
begin
set f1 = (f1 - 10); set f1 = (f1 + 10);
return f1;
end|
select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
9223372036854775803 2**63-5
9223372036854775803
select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
9223372036854775804 2**63-4
9223372036854775804
select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
9223372036854775805 2**63-3
9223372036854775805
select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
9223372036854775806 2**63-2
9223372036854775806
select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
9223372036854775807 2**63-1
9223372036854775807
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
9223372036854775808 2**63+0
9223372036854775808
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
9223372036854775809 2**63+1
9223372036854775809
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
9223372036854775810 2**63+2
9223372036854775810
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
lower bounds signed bigint
0
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
upper bounds signed bigint
9223372036854775807
select bug20777(0) as 'lower bounds unsigned bigint';
lower bounds unsigned bigint
0
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
upper bounds unsigned bigint
18446744073709551615
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
upper bounds unsigned bigint + 1
18446744073709551615
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
lower bounds unsigned bigint - 1
0
create table examplebug20777 as select
0 as 'i',
bug20777(9223372036854775806) as '2**63-2',
bug20777(9223372036854775807) as '2**63-1',
bug20777(9223372036854775808) as '2**63',
bug20777(9223372036854775809) as '2**63+1',
bug20777(18446744073709551614) as '2**64-2',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551616) as '2**64',
bug20777(0) as '0',
bug20777(-1) as '-1';
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
show create table examplebug20777;
Table Create Table
examplebug20777 CREATE TABLE `examplebug20777` (
`i` int(1) NOT NULL default '0',
`2**63-2` bigint(20) unsigned default NULL,
`2**63-1` bigint(20) unsigned default NULL,
`2**63` bigint(20) unsigned default NULL,
`2**63+1` bigint(20) unsigned default NULL,
`2**64-2` bigint(20) unsigned default NULL,
`2**64-1` bigint(20) unsigned default NULL,
`2**64` bigint(20) unsigned default NULL,
`0` bigint(20) unsigned default NULL,
`-1` bigint(20) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from examplebug20777 order by i;
i 2**63-2 2**63-1 2**63 2**63+1 2**64-2 2**64-1 2**64 0 -1
0 9223372036854775806 9223372036854775807 9223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 18446744073709551615 0 0
1 9223372036854775806 9223372036854775807 223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 8446744073709551616 0 0
drop table examplebug20777;
select bug20777(18446744073709551613)+1;
bug20777(18446744073709551613)+1
18446744073709551614
drop function bug20777;
End of 5.0 tests.
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM; CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb; CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;

View File

@@ -7,7 +7,6 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (col1 date); CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29'); INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
INSERT INTO t1 VALUES('0000-10-31'); INSERT INTO t1 VALUES('0000-10-31');
ERROR 22007: Incorrect date value: '0000-10-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31'); INSERT INTO t1 VALUES('2004-0-31');
ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31'); INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31');
@@ -57,6 +56,7 @@ select * from t1;
col1 col1
2004-01-01 2004-01-01
2004-02-29 2004-02-29
0000-10-31
2004-01-02 2004-01-02
2004-01-03 2004-01-03
2004-00-31 2004-00-31
@@ -124,7 +124,6 @@ set @@sql_mode='ansi,traditional';
CREATE TABLE t1 (col1 datetime); CREATE TABLE t1 (col1 datetime);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00'); INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
INSERT INTO t1 VALUES('0000-10-31 15:30:00'); INSERT INTO t1 VALUES('0000-10-31 15:30:00');
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31 15:30:00'); INSERT INTO t1 VALUES('2004-0-31 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1 ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-10-0 15:30:00'); INSERT INTO t1 VALUES('2004-10-0 15:30:00');
@@ -145,6 +144,7 @@ select * from t1;
col1 col1
2004-10-31 15:30:00 2004-10-31 15:30:00
2004-02-29 15:30:00 2004-02-29 15:30:00
0000-10-31 15:30:00
drop table t1; drop table t1;
CREATE TABLE t1 (col1 timestamp); CREATE TABLE t1 (col1 timestamp);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00'); INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
@@ -206,7 +206,6 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '0000-10-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -222,7 +221,6 @@ ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_ti
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1 ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -259,7 +257,6 @@ INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE));
INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME)); INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME)); INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE)); INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE)); INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE)); INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
@@ -267,7 +264,6 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE)); INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
ERROR 22007: Truncated incorrect datetime value: '0000-00-00' ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
@@ -275,7 +271,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME)); INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-00-00' ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
@@ -288,7 +284,6 @@ INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE));
INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME)); INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME)); INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE)); INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE)); INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE)); INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
@@ -296,7 +291,6 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE)); INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
ERROR 22007: Truncated incorrect datetime value: '0000-00-00' ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
@@ -304,7 +298,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME)); INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-00-00' ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
@@ -1352,3 +1346,44 @@ t1 CREATE TABLE `t1` (
`i` int(11) default NULL `i` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*'
drop table t1; drop table t1;
set sql_mode= 'traditional';
create table t1(col1 tinyint, col2 tinyint unsigned,
col3 smallint, col4 smallint unsigned,
col5 mediumint, col6 mediumint unsigned,
col7 int, col8 int unsigned,
col9 bigint, col10 bigint unsigned);
insert into t1(col1) values('-');
ERROR HY000: Incorrect integer value: '-' for column 'col1' at row 1
insert into t1(col2) values('+');
ERROR HY000: Incorrect integer value: '+' for column 'col2' at row 1
insert into t1(col3) values('-');
ERROR HY000: Incorrect integer value: '-' for column 'col3' at row 1
insert into t1(col4) values('+');
ERROR HY000: Incorrect integer value: '+' for column 'col4' at row 1
insert into t1(col5) values('-');
ERROR HY000: Incorrect integer value: '-' for column 'col5' at row 1
insert into t1(col6) values('+');
ERROR HY000: Incorrect integer value: '+' for column 'col6' at row 1
insert into t1(col7) values('-');
ERROR HY000: Incorrect integer value: '-' for column 'col7' at row 1
insert into t1(col8) values('+');
ERROR HY000: Incorrect integer value: '+' for column 'col8' at row 1
insert into t1(col9) values('-');
ERROR HY000: Incorrect integer value: '-' for column 'col9' at row 1
insert into t1(col10) values('+');
ERROR HY000: Incorrect integer value: '+' for column 'col10' at row 1
drop table t1;
set sql_mode='traditional';
create table t1(a year);
insert into t1 values ('-');
ERROR HY000: Incorrect integer value: '-' for column 'a' at row 1
insert into t1 values ('+');
ERROR HY000: Incorrect integer value: '+' for column 'a' at row 1
insert into t1 values ('');
ERROR HY000: Incorrect integer value: '' for column 'a' at row 1
insert into t1 values ('2000a');
ERROR 01000: Data truncated for column 'a' at row 1
insert into t1 values ('2E3x');
ERROR 01000: Data truncated for column 'a' at row 1
drop table t1;
End of 5.0 tests

View File

@@ -99,7 +99,7 @@ DROP TABLE t1, t2, t3;
CREATE TABLE t1 (y YEAR); CREATE TABLE t1 (y YEAR);
INSERT INTO t1 VALUES ('abc'); INSERT INTO t1 VALUES ('abc');
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'y' at row 1 Warning 1366 Incorrect integer value: 'abc' for column 'y' at row 1
SELECT * FROM t1; SELECT * FROM t1;
y y
0000 0000

View File

@@ -26,8 +26,6 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
delete from t1; delete from t1;
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000"); insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
Warnings:
Warning 1264 Out of range value adjusted for column 't' at row 5
insert into t1 values ("2003-003-03"); insert into t1 values ("2003-003-03");
insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01"); insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
select * from t1; select * from t1;
@@ -36,7 +34,7 @@ t
2069-12-31 00:00:00 2069-12-31 00:00:00
1970-01-01 00:00:00 1970-01-01 00:00:00
1999-12-31 00:00:00 1999-12-31 00:00:00
0000-00-00 00:00:00 0000-01-01 00:00:00
0001-01-01 00:00:00 0001-01-01 00:00:00
9999-12-31 00:00:00 9999-12-31 00:00:00
2000-10-10 00:00:00 2000-10-10 00:00:00

View File

@@ -66,3 +66,22 @@ ss
ue ue
ue ue
DROP TABLE t1; DROP TABLE t1;
create table t1(f1
set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
'18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49',
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','128'));
ERROR HY000: Too many strings for column f1 and SET
create table t1(f1
set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
'18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49',
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1'));
Warnings:
Note 1291 Column 'f1' has duplicated value '1' in SET
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1') default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;

View File

@@ -34,3 +34,15 @@ select if(y = now(), 1, 0) from t1;
if(y = now(), 1, 0) if(y = now(), 1, 0)
1 1
drop table t1; drop table t1;
create table t1(a year);
insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3');
Warnings:
Warning 1265 Data truncated for column 'a' at row 3
select * from t1;
a
2001
2001
2001
2001
drop table t1;
End of 5.0 tests

View File

@@ -159,7 +159,7 @@ EXPLAIN EXTENDED SELECT myfunc_int(fn(MIN(b))) as c FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
Warnings: Warnings:
Note 1003 select myfunc_int(`test`.`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a` Note 1003 select myfunc_int(`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a`
EXPLAIN EXTENDED SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a; EXPLAIN EXTENDED SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort

View File

@@ -1364,3 +1364,13 @@ SELECT * from t2;
drop table t1, t2, t4; drop table t1, t2, t4;
#
# BUG#26138 - REPAIR TABLE with option USE_FRM erases all records in ARCHIVE
# table
#
create table t1 (i int) engine=archive;
insert into t1 values (1);
repair table t1 use_frm;
select * from t1;
drop table t1;

View File

@@ -656,6 +656,7 @@ create table t1(a set("a,b","c,d") not null);
# End of 4.1 tests # End of 4.1 tests
# #
# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit # Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
# platforms # platforms
@@ -674,4 +675,4 @@ drop table t1;
create table t1 (upgrade int); create table t1 (upgrade int);
drop table t1; drop table t1;
# End of 5.0 tests --echo End of 5.0 tests

View File

@@ -40,5 +40,17 @@ create table t1 (a int(256));
set sql_mode='traditional'; set sql_mode='traditional';
--error 1074 --error 1074
create table t1 (a varchar(66000)); create table t1 (a varchar(66000));
set sql_mode=default;
#
# Bug #27513: mysql 5.0.x + NULL pointer DoS
#
CREATE TABLE t1 (a INT);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
INSERT INTO t1 VALUES(1);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
INSERT INTO t1 VALUES(2),(3);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
DROP TABLE t1;
# End of 5.0 tests # End of 5.0 tests

View File

@@ -3,7 +3,7 @@
# #
flush logs; flush logs;
set global expire_logs_days = 3; set global expire_logs_days = 3;
show variables like 'log%'; show variables like 'log_bin%';
flush logs; flush logs;
show variables like 'log%'; show variables like 'log_bin%';
set global expire_logs_days = 0; set global expire_logs_days = 0;

View File

@@ -87,3 +87,14 @@ SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance
DROP TABLE t1,t2; DROP TABLE t1,t2;
# End of 4.1 tests # End of 4.1 tests
#
# BUG#25729 - boolean full text search is confused by NULLs produced by LEFT
# JOIN
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT, c TEXT, KEY(b));
INSERT INTO t1 VALUES(1);
INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
DROP TABLE t1, t2;

View File

@@ -793,6 +793,16 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
drop table bug22555; drop table bug22555;
#
# Bug #21976: Unnecessary warning with count(decimal)
#
create table t1 (a decimal(20));
insert into t1 values (12345678901234567890);
select count(a) from t1;
select count(distinct a) from t1;
drop table t1;
# #
# Bug #23184: SELECT causes server crash # Bug #23184: SELECT causes server crash
# #
@@ -817,5 +827,4 @@ SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50;
DROP TABLE t1; DROP TABLE t1;
###
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@@ -1038,6 +1038,10 @@ INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2);
SELECT REPEAT( '#', tire ) AS A, SELECT REPEAT( '#', tire ) AS A,
REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`; REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`;
SELECT REPEAT('0', CAST(0 AS UNSIGNED));
SELECT REPEAT('0', -2);
SELECT REPEAT('0', 2);
DROP TABLE t1; DROP TABLE t1;
# #

View File

@@ -490,3 +490,71 @@ DESCRIBE v2;
DROP VIEW v1,v2; DROP VIEW v1,v2;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#24563: MBROverlaps does not seem to function propertly
# Bug#54888: MBROverlaps missing in 5.1?
#
# Test all MBR* functions and their non-MBR-prefixed aliases,
# using shifted squares to verify the spatial relations.
create table t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
# Overlaps needs a few more tests, with point and line dimensions
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
DROP TABLE t1;
--echo End of 5.0 tests

View File

@@ -1976,6 +1976,34 @@ drop table t2, t1;
--error ER_TABLE_CANT_HANDLE_SPKEYS --error ER_TABLE_CANT_HANDLE_SPKEYS
create table t1 (g geometry not null, spatial gk(g)) engine=innodb; create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
#
# Bug #25927: Prevent ALTER TABLE ... MODIFY ... NOT NULL on columns
# for which there is a foreign key constraint ON ... SET NULL.
#
CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
--replace_regex /'\.\/test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
--error 1025
ALTER TABLE t2 MODIFY a INT NOT NULL;
DELETE FROM t1;
DROP TABLE t2,t1;
#
# Bug #26835: table corruption after delete+insert
#
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
ENGINE=InnoDB;
INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
DELETE FROM t1;
INSERT INTO t1 VALUES ('DDD');
SELECT * FROM t1;
DROP TABLE t1;
####################################################################### #######################################################################
# # # #
# Please, DO NOT TOUCH this file as well as the innodb.result file. # # Please, DO NOT TOUCH this file as well as the innodb.result file. #

View File

@@ -136,4 +136,20 @@ eval select load_file("$MYSQL_TEST_DIR/t/loaddata.test");
# cleanup # cleanup
drop table t1, t2; drop table t1, t2;
#
# Bug#27586: Wrong autoinc value assigned by LOAD DATA in the
# NO_AUTO_VALUE_ON_ZERO mode
#
create table t1(f1 int);
insert into t1 values(1),(null);
create table t2(f2 int auto_increment primary key);
disable_query_log;
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t1' from t1;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t2;
enable_query_log;
select * from t2;
--exec rm $MYSQLTEST_VARDIR/tmp/t1
SET @@SQL_MODE=@OLD_SQL_MODE;
drop table t1,t2;
# End of 5.0 tests # End of 5.0 tests

View File

@@ -201,7 +201,7 @@ load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8
select hex(a) from t1; select hex(a) from t1;
drop table t1; drop table t1;
flush logs; flush logs;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000009
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@@ -918,7 +918,7 @@ port=1234
EOF EOF
--exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 --exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1
--exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1 --exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
--remov_file $MYSQLTEST_VARDIR/tmp/tmp.cnf --remove_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
--echo # --echo #
--echo # Test of fix to BUG 12597 --echo # Test of fix to BUG 12597
@@ -1429,6 +1429,72 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#26346: stack + buffer overrun in mysqldump
--echo #
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
# too long a file path causes an error
--error 1
--exec $MYSQL_DUMP --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test 2>&1
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-optionally-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --lines-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
DROP TABLE t1;
#
# Bug #25993: crashe with a merge table and -c
#
CREATE TABLE t2 (a int);
CREATE TABLE t3 (a int);
CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
--exec $MYSQL_DUMP --skip-comments -c test
DROP TABLE t1, t2, t3;
--echo #
--echo # Bug #23491: MySQLDump prefix function call in a view by database name
--echo #
# Setup
create database bug23491_original;
create database bug23491_restore;
use bug23491_original;
create table t1 (c1 int);
create view v1 as select * from t1;
create procedure p1() select 1;
create function f1() returns int return 1;
create view v2 as select f1();
create function f2() returns int return f1();
create view v3 as select bug23491_original.f1();
# Backup.
--exec $MYSQL_DUMP --skip-comments -uroot --opt --routines bug23491_original > $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
# Restore.
--exec $MYSQL bug23491_restore < $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
# Verify
use bug23491_restore;
show create view bug23491_restore.v2;
show create view bug23491_restore.v3;
# Cleanup
drop database bug23491_original;
drop database bug23491_restore;
use test;
--echo # --echo #
--echo # End of 5.0 tests --echo # End of 5.0 tests
--echo # --echo #

View File

@@ -1,5 +1,6 @@
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_multi_ndb.inc -- source include/have_multi_ndb.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc -- source include/not_embedded.inc
@@ -7,6 +8,11 @@
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
# Workaround for Bug#27644
# ndb: connecting api node/mysqld may "steal" node_id from running mysqld
# - let ndb_waiter use a fixed node id so "steal" cannot happen
--let connect_str = "nodeid=6;$NDB_CONNECTSTRING"
# #
# Transaction ongoing while cluster is restarted # Transaction ongoing while cluster is restarted
# #
@@ -17,7 +23,7 @@ begin;
insert into t1 values (1); insert into t1 values (1);
--exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT --exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
--error 1297 --error 1297
insert into t1 values (2); insert into t1 values (2);
@@ -35,7 +41,7 @@ insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,
select * from t2 order by a limit 3; select * from t2 order by a limit 3;
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
--connection server2 --connection server2
create table t2 (a int key) engine=ndbcluster; create table t2 (a int key) engine=ndbcluster;
@@ -49,7 +55,7 @@ select * from t2 order by a limit 3;
select * from t2 order by a limit 3; select * from t2 order by a limit 3;
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
--connection server1 --connection server1
show tables; show tables;

View File

@@ -89,4 +89,112 @@ select * from t2 order by op, a, b;
drop tables t1, t2, t3; drop tables t1, t2, t3;
# Test for bug#26242
# Verify that AFTER UPDATE/DELETE triggers are executed
# after the change has actually taken place
CREATE TABLE t1 (
id INT NOT NULL PRIMARY KEY,
xy INT
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (1, 0);
DELIMITER //;
CREATE TRIGGER t1_update AFTER UPDATE ON t1 FOR EACH ROW BEGIN REPLACE INTO t2 SELECT * FROM t1 WHERE t1.id = NEW.id; END //
DELIMITER ;//
CREATE TABLE t2 (
id INT NOT NULL PRIMARY KEY,
xy INT
) ENGINE=ndbcluster;
INSERT INTO t2 VALUES (2, 0);
CREATE TABLE t3 (id INT NOT NULL PRIMARY KEY) ENGINE=ndbcluster;
INSERT INTO t3 VALUES (1);
CREATE TABLE t4 LIKE t1;
DELIMITER //;
CREATE TRIGGER t4_update AFTER UPDATE ON t4 FOR EACH ROW BEGIN REPLACE INTO t5 SELECT * FROM t4 WHERE t4.id = NEW.id; END //
DELIMITER ;//
CREATE TABLE t5 LIKE t2;
UPDATE t1 SET xy = 3 WHERE id = 1;
SELECT xy FROM t1 where id = 1;
SELECT xy FROM t2 where id = 1;
UPDATE t1 SET xy = 4 WHERE id IN (SELECT id FROM t3 WHERE id = 1);
SELECT xy FROM t1 where id = 1;
SELECT xy FROM t2 where id = 1;
INSERT INTO t4 SELECT * FROM t1;
INSERT INTO t5 SELECT * FROM t2;
UPDATE t1,t4 SET t1.xy = 3, t4.xy = 3 WHERE t1.id = 1 AND t4.id = 1;
SELECT xy FROM t1 where id = 1;
SELECT xy FROM t2 where id = 1;
SELECT xy FROM t4 where id = 1;
SELECT xy FROM t5 where id = 1;
UPDATE t1,t4 SET t1.xy = 4, t4.xy = 4 WHERE t1.id IN (SELECT id FROM t3 WHERE id = 1) AND t4.id IN (SELECT id FROM t3 WHERE id = 1);
SELECT xy FROM t1 where id = 1;
SELECT xy FROM t2 where id = 1;
SELECT xy FROM t4 where id = 1;
SELECT xy FROM t5 where id = 1;
INSERT INTO t1 VALUES (1,0) ON DUPLICATE KEY UPDATE xy = 5;
SELECT xy FROM t1 where id = 1;
SELECT xy FROM t2 where id = 1;
DROP TRIGGER t1_update;
DROP TRIGGER t4_update;
DELIMITER //;
CREATE TRIGGER t1_delete AFTER DELETE ON t1 FOR EACH ROW BEGIN REPLACE INTO t2 SELECT * FROM t1 WHERE t1.id > 4; END //
DELIMITER ;//
DELIMITER //;
CREATE TRIGGER t4_delete AFTER DELETE ON t4 FOR EACH ROW BEGIN REPLACE INTO t5 SELECT * FROM t4 WHERE t4.id > 4; END //
DELIMITER ;//
INSERT INTO t1 VALUES (5, 0),(6,0);
INSERT INTO t2 VALUES (5, 1),(6,1);
INSERT INTO t3 VALUES (5);
SELECT * FROM t1 order by id;
SELECT * FROM t2 order by id;
DELETE FROM t1 WHERE id IN (SELECT id FROM t3 WHERE id = 5);
SELECT * FROM t1 order by id;
SELECT * FROM t2 order by id;
INSERT INTO t1 VALUES (5,0);
UPDATE t2 SET xy = 1 WHERE id = 6;
TRUNCATE t4;
INSERT INTO t4 SELECT * FROM t1;
TRUNCATE t5;
INSERT INTO t5 SELECT * FROM t2;
SELECT * FROM t1 order by id;
SELECT * FROM t2 order by id;
SELECT * FROM t4 order by id;
SELECT * FROM t5 order by id;
DELETE FROM t1,t4 USING t1,t3,t4 WHERE t1.id IN (SELECT id FROM t3 WHERE id = 5) AND t4.id IN (SELECT id FROM t3 WHERE id = 5);
SELECT * FROM t1 order by id;
SELECT * FROM t2 order by id;
SELECT * FROM t4 order by id;
SELECT * FROM t5 order by id;
INSERT INTO t1 VALUES (5, 0);
REPLACE INTO t2 VALUES (6,1);
SELECT * FROM t1 order by id;
SELECT * FROM t2 order by id;
REPLACE INTO t1 VALUES (5, 1);
SELECT * FROM t1 order by id;
SELECT * FROM t2 order by id;
DROP TRIGGER t1_delete;
DROP TRIGGER t4_delete;
DROP TABLE t1, t2, t3, t4, t5;
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@@ -96,4 +96,11 @@ drop table t1;
--error 1 --error 1
--exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
#
# Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23
#
# Test that we can open encrypted connection to server without
# verification of servers certificate by setting both ca certificate
# and ca path to NULL
#
--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1

View File

@@ -617,7 +617,6 @@ UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol; UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol;
DROP TABLE bug25126; DROP TABLE bug25126;
# #
# Bug #25427: crash when order by expression contains a name # Bug #25427: crash when order by expression contains a name
# that cannot be resolved unambiguously # that cannot be resolved unambiguously
@@ -633,6 +632,41 @@ SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #27532: ORDER/GROUP BY expressions with IN/BETWEEN and NOT IN/BETWEEN
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (2), (4), (1);
SELECT a, IF(a IN (2,3), a, a+10) FROM t1
ORDER BY IF(a IN (2,3), a, a+10);
SELECT a, IF(a NOT IN (2,3), a, a+10) FROM t1
ORDER BY IF(a NOT IN (2,3), a, a+10);
SELECT a, IF(a IN (2,3), a, a+10) FROM t1
ORDER BY IF(a NOT IN (2,3), a, a+10);
SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
ORDER BY IF(a BETWEEN 2 AND 3, a, a+10);
SELECT a, IF(a NOT BETWEEN 2 AND 3, a, a+10) FROM t1
ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
FROM t1 GROUP BY x1, x2;
SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
FROM t1 GROUP BY x1, IF(a NOT IN (1,2), a, '');
# The remaining queries are for better coverage
SELECT a, a IN (1,2) FROM t1 ORDER BY a IN (1,2);
SELECT a FROM t1 ORDER BY a IN (1,2);
SELECT a+10 FROM t1 ORDER BY a IN (1,2);
SELECT a, IF(a IN (1,2), a, a+10) FROM t1
ORDER BY IF(a IN (3,4), a, a+10);
DROP TABLE t1;
# End of 4.1
create table t1 (a int not null, b int not null, c int not null); create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1); insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c); select a, b from t1 group by a, b order by sum(c);

View File

@@ -28,6 +28,105 @@ DROP TABLE t1;
DROP TABLE t4; DROP TABLE t4;
#
# Bug#25482 GRANT statements are not replicated if
# you use "replicate-ignore-table"
#
--echo **** Test case for BUG#25482 ****
--echo **** Adding GRANTS on master ****
connection master;
create table test.t1(a int);
create table test.t4(a int);
# Simple user that should not replicate
GRANT SELECT ON test.t1 TO mysqltest1@localhost;
# Partial replicate
GRANT INSERT ON test.t4 TO mysqltest2@localhost;
GRANT select, update, insert, references on t1
to mysqltest2@localhost;
# Partial replicate 2
GRANT SELECT ON test.* TO mysqltest3@localhost;
GRANT INSERT ON test.t4 TO mysqltest3@localhost;
GRANT select(a), update(a), insert(a), references(a) on t4
to mysqltest3@localhost;
# Create another database and table
create database mysqltest2;
create table mysqltest2.t2 (id int);
# Create a grant that should replicate
GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
# Create a grant manually
insert into mysql.user (user, host) values ("mysqltest5", "somehost");
# Partial replicate 3 with *.*
GRANT SELECT ON *.* TO mysqltest6@localhost;
GRANT INSERT ON *.* TO mysqltest6@localhost;
GRANT INSERT ON test.* TO mysqltest6@localhost;
GRANT INSERT ON test.t1 TO mysqltest6@localhost;
show grants for mysqltest1@localhost;
show grants for mysqltest2@localhost;
show grants for mysqltest3@localhost;
show grants for mysqltest4@localhost;
show grants for mysqltest6@localhost;
flush privileges;
show grants for mysqltest5@somehost;
sync_slave_with_master;
--echo **** Checking grants on slave ****
# Check that grants are replicated to slave
show grants for mysqltest2@localhost;
show grants for mysqltest3@localhost;
show grants for mysqltest4@localhost;
show grants for mysqltest5@somehost;
show grants for mysqltest6@localhost;
# mysqltest1 should not be on slave
--error 1141
show grants for mysqltest1@localhost;
--echo **** Revoking grants on master ****
connection master;
REVOKE SELECT ON test.t1 FROM mysqltest1@localhost;
REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost;
REVOKE select(a) on t4
from mysqltest3@localhost;
show grants for mysqltest1@localhost;
show grants for mysqltest3@localhost;
show grants for mysqltest4@localhost;
sync_slave_with_master;
--echo **** Checking grants on slave ****
# mysqltest1 should not be on slave
--error 1141
show grants for mysqltest1@localhost;
show grants for mysqltest3@localhost;
show grants for mysqltest4@localhost;
# Cleanup
connection master;
drop table t1, t4, mysqltest2.t2;
drop database mysqltest2;
delete from mysql.user where user like "mysqltest%";
delete from mysql.db where user like "mysqltest%";
delete from mysql.tables_priv where user like "mysqltest%";
delete from mysql.columns_priv where user like "mysqltest%";
sync_slave_with_master;
connection master;
# #
# bug#22877 replication character sets get out of sync # bug#22877 replication character sets get out of sync
# using replicate-wild-ignore-table # using replicate-wild-ignore-table

View File

@@ -6971,9 +6971,54 @@ use test|
# #
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;` # Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
# at the end of the file! --disable_warnings
# drop function if exists bug20777|
drop table if exists examplebug20777|
--enabled_warnings
create function bug20777(f1 bigint unsigned) returns bigint unsigned
begin
set f1 = (f1 - 10); set f1 = (f1 + 10);
return f1;
end|
delimiter ;|
select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
select bug20777(0) as 'lower bounds unsigned bigint';
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
create table examplebug20777 as select
0 as 'i',
bug20777(9223372036854775806) as '2**63-2',
bug20777(9223372036854775807) as '2**63-1',
bug20777(9223372036854775808) as '2**63',
bug20777(9223372036854775809) as '2**63+1',
bug20777(18446744073709551614) as '2**64-2',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551616) as '2**64',
bug20777(0) as '0',
bug20777(-1) as '-1';
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
show create table examplebug20777;
select * from examplebug20777 order by i;
drop table examplebug20777;
select bug20777(18446744073709551613)+1;
drop function bug20777;
delimiter |;
###
--echo End of 5.0 tests.
# #
# BUG#NNNN: New bug synopsis # BUG#NNNN: New bug synopsis
@@ -6982,9 +7027,13 @@ use test|
#drop procedure if exists bugNNNN| #drop procedure if exists bugNNNN|
#--enable_warnings #--enable_warnings
#create procedure bugNNNN... #create procedure bugNNNN...
#
# Add bugs above this line. Use existing tables t1 and t2 when # Add bugs above this line. Use existing tables t1 and t2 when
# practical, or create table t3, t4 etc temporarily (and drop them). # practical, or create table t3,t4 etc temporarily (and drop them).
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
# at the end of the file!
#
delimiter ;| delimiter ;|
drop table t1,t2; drop table t1,t2;

View File

@@ -1 +0,0 @@
--loose_ssl-cert=std_data/server-cert-des.pem --loose_ssl-key=std_data/server-key-des.pem

View File

@@ -14,7 +14,6 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (col1 date); CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29'); INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
--error 1292
INSERT INTO t1 VALUES('0000-10-31'); INSERT INTO t1 VALUES('0000-10-31');
# All test cases expected to fail should return # All test cases expected to fail should return
@@ -100,7 +99,6 @@ set @@sql_mode='ansi,traditional';
CREATE TABLE t1 (col1 datetime); CREATE TABLE t1 (col1 datetime);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00'); INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
--error 1292
INSERT INTO t1 VALUES('0000-10-31 15:30:00'); INSERT INTO t1 VALUES('0000-10-31 15:30:00');
# All test cases expected to fail should return # All test cases expected to fail should return
@@ -194,7 +192,6 @@ INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
# All test cases expected to fail should return # All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value> # SQLSTATE 22007 <invalid date value>
--error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292 --error 1292
@@ -216,7 +213,6 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
# All test cases expected to fail should return # All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value> # SQLSTATE 22007 <invalid datetime value>
--error 1292
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292 --error 1292
@@ -271,7 +267,6 @@ INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
# All test cases expected to fail should return # All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value> # SQLSTATE 22007 <invalid date value>
--error 1292
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE)); INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
--error 1292 --error 1292
@@ -299,7 +294,6 @@ INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
# All test cases expected to fail should return # All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value> # SQLSTATE 22007 <invalid datetime value>
--error 1292
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
--error 1292 --error 1292
@@ -367,7 +361,6 @@ INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
# All test cases expected to fail should return # All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value> # SQLSTATE 22007 <invalid date value>
--error 1292
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE)); INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
--error 1292 --error 1292
@@ -394,7 +387,6 @@ INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
# All test cases expected to fail should return # All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value> # SQLSTATE 22007 <invalid datetime value>
--error 1292
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
--error 1292 --error 1292
@@ -1208,3 +1200,53 @@ create table t1 (i int)
comment '123456789*123456789*123456789*123456789*123456789*123456789*'; comment '123456789*123456789*123456789*123456789*123456789*123456789*';
show create table t1; show create table t1;
drop table t1; drop table t1;
#
# Bug #26359: Strings becoming truncated and converted to numbers under STRICT mode
#
set sql_mode= 'traditional';
create table t1(col1 tinyint, col2 tinyint unsigned,
col3 smallint, col4 smallint unsigned,
col5 mediumint, col6 mediumint unsigned,
col7 int, col8 int unsigned,
col9 bigint, col10 bigint unsigned);
--error 1366
insert into t1(col1) values('-');
--error 1366
insert into t1(col2) values('+');
--error 1366
insert into t1(col3) values('-');
--error 1366
insert into t1(col4) values('+');
--error 1366
insert into t1(col5) values('-');
--error 1366
insert into t1(col6) values('+');
--error 1366
insert into t1(col7) values('-');
--error 1366
insert into t1(col8) values('+');
--error 1366
insert into t1(col9) values('-');
--error 1366
insert into t1(col10) values('+');
drop table t1;
#
# Bug #27176: Assigning a string to an year column has unexpected results
#
set sql_mode='traditional';
create table t1(a year);
--error 1366
insert into t1 values ('-');
--error 1366
insert into t1 values ('+');
--error 1366
insert into t1 values ('');
--error 1265
insert into t1 values ('2000a');
--error 1265
insert into t1 values ('2E3x');
drop table t1;
--echo End of 5.0 tests

View File

@@ -39,3 +39,20 @@ SELECT c FROM t1 ORDER BY concat(c);
DROP TABLE t1; DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
#
# Bug#27069 set with identical elements are created
#
--error 1097
create table t1(f1
set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
'18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49',
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','128'));
create table t1(f1
set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
'18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49',
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1'));
show create table t1;
drop table t1;

View File

@@ -21,4 +21,12 @@ insert into t1 values (now());
select if(y = now(), 1, 0) from t1; select if(y = now(), 1, 0) from t1;
drop table t1; drop table t1;
# End of 4.1 tests #
# Bug #27176: Assigning a string to an year column has unexpected results
#
create table t1(a year);
insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3');
select * from t1;
drop table t1;
--echo End of 5.0 tests

Some files were not shown because too many files have changed in this diff Show More