mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Merge pilot.blaudden:/home/msvensson/mysql/bug24121/my51-bug24121
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
This commit is contained in:
commit
8add0bccca
44 changed files with 1162 additions and 425 deletions
|
@ -60,5 +60,5 @@ enum options_client
|
|||
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
|
||||
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
|
||||
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
|
||||
OPT_DEBUG_INFO, OPT_COLUMN_TYPES
|
||||
OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_WRITE_BINLOG
|
||||
};
|
||||
|
|
|
@ -34,7 +34,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
|
|||
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
|
||||
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
|
||||
tty_password= 0, opt_frm= 0, info_flag= 0,
|
||||
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0;
|
||||
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
|
||||
opt_write_binlog= 1;
|
||||
static uint verbose = 0, opt_mysql_port=0;
|
||||
static my_string opt_mysql_unix_port = 0;
|
||||
static char *opt_password = 0, *current_user = 0,
|
||||
|
@ -123,6 +124,10 @@ static struct my_option my_long_options[] =
|
|||
{"medium-check", 'm',
|
||||
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"write-binlog", OPT_WRITE_BINLOG,
|
||||
"Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Enabled by default; use --skip-write-binlog when commands should not be sent to replication slaves.",
|
||||
(gptr*) &opt_write_binlog, (gptr*) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
|
||||
1, 0, 0, 0, 0, 0},
|
||||
{"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
{"password", 'p',
|
||||
|
@ -598,16 +603,16 @@ static int handle_request_for_tables(char *tables, uint length)
|
|||
if (opt_upgrade) end = strmov(end, " FOR UPGRADE");
|
||||
break;
|
||||
case DO_REPAIR:
|
||||
op = "REPAIR";
|
||||
op= (opt_write_binlog) ? "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG";
|
||||
if (opt_quick) end = strmov(end, " QUICK");
|
||||
if (opt_extended) end = strmov(end, " EXTENDED");
|
||||
if (opt_frm) end = strmov(end, " USE_FRM");
|
||||
break;
|
||||
case DO_ANALYZE:
|
||||
op = "ANALYZE";
|
||||
op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG";
|
||||
break;
|
||||
case DO_OPTIMIZE:
|
||||
op = "OPTIMIZE";
|
||||
op= (opt_write_binlog) ? "OPTIMIZE" : "OPTIMIZE NO_WRITE_TO_BINLOG";
|
||||
break;
|
||||
case DO_UPGRADE:
|
||||
return fix_object_name("TABLE", tables);
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace yaSSL {
|
|||
|
||||
|
||||
#ifdef MULTI_THREADED
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
class Mutex {
|
||||
|
|
|
@ -190,10 +190,17 @@ enum { /* ERR Constants */
|
|||
EVP_R_BAD_DECRYPT = 2
|
||||
};
|
||||
|
||||
/*
|
||||
Allow type used by SSL_set_fd to be changed, default to int
|
||||
in order to be compatible with OpenSSL
|
||||
*/
|
||||
#ifndef YASSL_SOCKET_T_DEFINED
|
||||
typedef int YASSL_SOCKET_T;
|
||||
#endif
|
||||
|
||||
SSL_CTX* SSL_CTX_new(SSL_METHOD*);
|
||||
SSL* SSL_new(SSL_CTX*);
|
||||
int SSL_set_fd (SSL*, int);
|
||||
int SSL_set_fd (SSL*, YASSL_SOCKET_T);
|
||||
int SSL_connect(SSL*);
|
||||
int SSL_write(SSL*, const void*, int);
|
||||
int SSL_read(SSL*, void*, int);
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#include "openssl/ssl.h" /* for socket_t */
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
namespace yaSSL {
|
||||
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#ifdef _WIN32
|
||||
typedef unsigned int SOCKET_T;
|
||||
#else
|
||||
typedef int SOCKET_T;
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "coding.hpp" // HexDecoder
|
||||
#include "helpers.hpp" // for placement new hack
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h> // FindFirstFile etc..
|
||||
|
@ -233,7 +232,7 @@ void SSL_free(SSL* ssl)
|
|||
}
|
||||
|
||||
|
||||
int SSL_set_fd(SSL* ssl, int fd)
|
||||
int SSL_set_fd(SSL* ssl, YASSL_SOCKET_T fd)
|
||||
{
|
||||
ssl->useSocket().set_fd(fd);
|
||||
return SSL_SUCCESS;
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
|
||||
namespace mySTL {
|
||||
|
||||
#undef max
|
||||
#undef min
|
||||
|
||||
template<typename T>
|
||||
inline const T& max(const T& a, const T&b)
|
||||
|
|
|
@ -102,6 +102,9 @@ void vio_timeout(Vio *vio,uint which, uint timeout);
|
|||
#define HEADER_DES_LOCL_H dummy_something
|
||||
#define YASSL_MYSQL_COMPATIBLE
|
||||
#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/err.h>
|
||||
|
||||
|
|
|
@ -178,4 +178,75 @@ insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
|||
|
||||
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.
|
||||
|
||||
# Primary key is needed for NDB with binlog; bug ARCHIVE doesn't
|
||||
# support AUTO_INCREMENT, so specify id values explicitly
|
||||
CREATE TABLE t1 (id INT UNSIGNED NOT NULL PRIMARY KEY, name VARCHAR(100), square GEOMETRY);
|
||||
|
||||
INSERT INTO t1 VALUES( 1, "center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||
|
||||
INSERT INTO t1 VALUES( 2, "small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 3, "big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||
|
||||
INSERT INTO t1 VALUES( 4, "up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||
INSERT INTO t1 VALUES( 5, "up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||
INSERT INTO t1 VALUES( 6, "up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||
|
||||
INSERT INTO t1 VALUES( 7, "down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||
INSERT INTO t1 VALUES( 8, "down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||
INSERT INTO t1 VALUES( 9, "down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||
|
||||
INSERT INTO t1 VALUES(10, "right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||
INSERT INTO t1 VALUES(11, "right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||
INSERT INTO t1 VALUES(12, "right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||
|
||||
INSERT INTO t1 VALUES(13, "left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||
INSERT INTO t1 VALUES(14, "left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||
INSERT INTO t1 VALUES(15, "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
|
||||
|
|
|
@ -498,6 +498,17 @@ sub collect_one_test_case($$$$$$$) {
|
|||
{
|
||||
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 )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
|
|
|
@ -38,8 +38,8 @@ sub mtr_kill_processes ($);
|
|||
sub mtr_ping_with_timeout($);
|
||||
sub mtr_ping_port ($);
|
||||
|
||||
# static in C
|
||||
sub spawn_impl ($$$$$$$$);
|
||||
# Local function
|
||||
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 ($$$$$$;$) {
|
||||
my $path= shift;
|
||||
my $arg_list_t= shift;
|
||||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift;
|
||||
my $pid_file= shift; # Not used
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -68,10 +66,10 @@ sub mtr_run_test ($$$$$$;$) {
|
|||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift;
|
||||
my $pid_file= shift; # Not used
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -81,28 +79,22 @@ sub mtr_spawn ($$$$$$;$) {
|
|||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift;
|
||||
my $pid_file= shift; # Not used
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# If $join is set, we return the error code, else we return the PID
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub spawn_impl ($$$$$$$$) {
|
||||
sub spawn_impl ($$$$$$$) {
|
||||
my $path= shift;
|
||||
my $arg_list_t= shift;
|
||||
my $mode= shift;
|
||||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift; # FIXME
|
||||
my $spawn_opts= shift;
|
||||
|
||||
if ( $::opt_script_debug )
|
||||
|
@ -155,10 +147,6 @@ sub spawn_impl ($$$$$$$$) {
|
|||
else
|
||||
{
|
||||
# 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
|
||||
|
||||
|
@ -196,7 +184,15 @@ sub spawn_impl ($$$$$$$$) {
|
|||
}
|
||||
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\": $!");
|
||||
}
|
||||
|
@ -259,9 +255,7 @@ sub spawn_parent_impl {
|
|||
# We do blocking waitpid() until we get the return from the
|
||||
# "mysqltest" call. But if a mysqld process dies that we
|
||||
# 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 $saved_exit_value;
|
||||
|
@ -450,7 +444,6 @@ sub mtr_kill_leftovers () {
|
|||
|
||||
# We scan the "var/run/" directory for other process id's to kill
|
||||
|
||||
# FIXME $path_run_dir or something
|
||||
my $rundir= "$::opt_vardir/run";
|
||||
|
||||
mtr_debug("Processing PID files in directory '$rundir'...");
|
||||
|
|
|
@ -305,6 +305,7 @@ our $path_sql_dir;
|
|||
our @data_dir_lst;
|
||||
|
||||
our $used_binlog_format;
|
||||
our $used_default_engine;
|
||||
our $debug_compiled_binaries;
|
||||
our $glob_tot_real_time= 0;
|
||||
|
||||
|
@ -520,7 +521,7 @@ sub command_line_setup () {
|
|||
'compress' => \$opt_compress,
|
||||
'bench' => \$opt_bench,
|
||||
'small-bench' => \$opt_small_bench,
|
||||
'with-ndbcluster' => \$opt_with_ndbcluster,
|
||||
'with-ndbcluster|ndb' => \$opt_with_ndbcluster,
|
||||
'vs-config' => \$opt_vs_config,
|
||||
|
||||
# Control what test suites or cases to run
|
||||
|
@ -777,6 +778,26 @@ sub command_line_setup () {
|
|||
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
|
||||
# --------------------------------------------------------------------------
|
||||
|
@ -849,20 +870,22 @@ sub command_line_setup () {
|
|||
# --------------------------------------------------------------------------
|
||||
# Check im suport
|
||||
# --------------------------------------------------------------------------
|
||||
if (!$opt_extern)
|
||||
if ($opt_extern)
|
||||
{
|
||||
if ( $mysql_version_id < 50000 ) {
|
||||
# Instance manager is not supported until 5.0
|
||||
$opt_skip_im= 1;
|
||||
|
||||
}
|
||||
|
||||
if ( $glob_win32 ) {
|
||||
mtr_report("Disable Instance manager - not supported on Windows");
|
||||
$opt_skip_im= 1;
|
||||
}
|
||||
|
||||
mtr_report("Disable instance manager when running with extern mysqld");
|
||||
$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
|
||||
# --------------------------------------------------------------------------
|
||||
|
@ -900,10 +923,6 @@ sub command_line_setup () {
|
|||
# --------------------------------------------------------------------------
|
||||
# Ndb cluster flags
|
||||
# --------------------------------------------------------------------------
|
||||
if ( $opt_with_ndbcluster and !$opt_bench)
|
||||
{
|
||||
mtr_error("Can only use --with-ndbcluster together with --bench");
|
||||
}
|
||||
|
||||
if ( $opt_ndbconnectstring )
|
||||
{
|
||||
|
@ -1056,8 +1075,6 @@ sub command_line_setup () {
|
|||
# socket path names.
|
||||
$sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) > 80 );
|
||||
|
||||
# Put this into a hash, will be a C struct
|
||||
|
||||
$master->[0]=
|
||||
{
|
||||
pid => 0,
|
||||
|
@ -1329,7 +1346,7 @@ sub collect_mysqld_features () {
|
|||
|
||||
#
|
||||
# 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`;
|
||||
|
||||
|
@ -1393,6 +1410,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 () {
|
||||
|
||||
# Look for instance manager binary - mysqlmanager
|
||||
|
@ -2798,10 +2849,7 @@ sub initialize_servers () {
|
|||
}
|
||||
else
|
||||
{
|
||||
if ($opt_verbose)
|
||||
{
|
||||
mtr_report("No need to create '$opt_vardir' it already exists");
|
||||
}
|
||||
mtr_verbose("No need to create '$opt_vardir' it already exists");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -5006,7 +5054,7 @@ Options to control what engine/variation to run
|
|||
skip-ssl Dont start server with support for ssl connections
|
||||
bench Run the benchmark suite
|
||||
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
|
||||
(default: MTR_VS_CONFIG environment variable)
|
||||
|
||||
|
|
|
@ -393,7 +393,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;
|
||||
first second w c o e d t i r
|
||||
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 121 1 1 0 1 0 0 1 0
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
|
@ -460,3 +460,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
|||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||
ERROR 23000: Column 'fl' cannot be null
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 (id INT UNSIGNED NOT NULL PRIMARY KEY, name VARCHAR(100), square GEOMETRY);
|
||||
INSERT INTO t1 VALUES( 1, "center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 2, "small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 3, "big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 4, "up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||
INSERT INTO t1 VALUES( 5, "up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||
INSERT INTO t1 VALUES( 6, "up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||
INSERT INTO t1 VALUES( 7, "down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||
INSERT INTO t1 VALUES( 8, "down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||
INSERT INTO t1 VALUES( 9, "down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||
INSERT INTO t1 VALUES(10, "right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||
INSERT INTO t1 VALUES(11, "right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||
INSERT INTO t1 VALUES(12, "right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||
INSERT INTO t1 VALUES(13, "left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||
INSERT INTO t1 VALUES(14, "left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||
INSERT INTO t1 VALUES(15, "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
|
||||
|
|
|
@ -1287,6 +1287,15 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
|
|||
0.5 0.25
|
||||
0.5000 0.2500
|
||||
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);
|
||||
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;
|
||||
|
|
|
@ -2297,6 +2297,15 @@ A B tire
|
|||
0
|
||||
# # 1
|
||||
## ## 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;
|
||||
SELECT UNHEX('G');
|
||||
UNHEX('G')
|
||||
|
|
|
@ -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;
|
||||
first second w c o e d t i r
|
||||
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 121 1 1 0 1 0 0 1 0
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
|
@ -764,6 +764,91 @@ create table t1 (g geometry not null);
|
|||
insert into t1 values(default);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
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
|
||||
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
|
||||
create view v1 as select * from t1;
|
||||
desc v1;
|
||||
|
@ -775,3 +860,4 @@ f4 geometry YES NULL
|
|||
f5 datetime YES NULL
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -393,7 +393,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;
|
||||
first second w c o e d t i r
|
||||
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 121 1 1 0 1 0 0 1 0
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
|
@ -460,5 +460,91 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
|||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||
ERROR 23000: Column 'fl' cannot be null
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 (id INT UNSIGNED NOT NULL PRIMARY KEY, name VARCHAR(100), square GEOMETRY);
|
||||
INSERT INTO t1 VALUES( 1, "center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 2, "small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 3, "big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 4, "up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||
INSERT INTO t1 VALUES( 5, "up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||
INSERT INTO t1 VALUES( 6, "up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||
INSERT INTO t1 VALUES( 7, "down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||
INSERT INTO t1 VALUES( 8, "down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||
INSERT INTO t1 VALUES( 9, "down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||
INSERT INTO t1 VALUES(10, "right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||
INSERT INTO t1 VALUES(11, "right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||
INSERT INTO t1 VALUES(12, "right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||
INSERT INTO t1 VALUES(13, "left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||
INSERT INTO t1 VALUES(14, "left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||
INSERT INTO t1 VALUES(15, "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
|
||||
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
|
||||
ERROR HY000: The used table type doesn't support SPATIAL indexes
|
||||
|
|
|
@ -393,7 +393,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;
|
||||
first second w c o e d t i r
|
||||
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 121 1 1 0 1 0 0 1 0
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
|
@ -460,6 +460,92 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
|||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||
ERROR 23000: Column 'fl' cannot be null
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 (id INT UNSIGNED NOT NULL PRIMARY KEY, name VARCHAR(100), square GEOMETRY);
|
||||
INSERT INTO t1 VALUES( 1, "center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 2, "small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 3, "big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 4, "up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||
INSERT INTO t1 VALUES( 5, "up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||
INSERT INTO t1 VALUES( 6, "up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||
INSERT INTO t1 VALUES( 7, "down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||
INSERT INTO t1 VALUES( 8, "down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||
INSERT INTO t1 VALUES( 9, "down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||
INSERT INTO t1 VALUES(10, "right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||
INSERT INTO t1 VALUES(11, "right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||
INSERT INTO t1 VALUES(12, "right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||
INSERT INTO t1 VALUES(13, "left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||
INSERT INTO t1 VALUES(14, "left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||
INSERT INTO t1 VALUES(15, "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;
|
||||
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 PRIMARY KEY AUTO_INCREMENT, g POINT);
|
||||
|
@ -855,7 +941,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;
|
||||
first second w c o e d t i r
|
||||
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 121 1 1 0 1 0 0 1 0
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
|
@ -922,3 +1008,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
|||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||
ERROR 23000: Column 'fl' cannot be null
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 (id INT UNSIGNED NOT NULL PRIMARY KEY, name VARCHAR(100), square GEOMETRY);
|
||||
INSERT INTO t1 VALUES( 1, "center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 2, "small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 3, "big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES( 4, "up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||
INSERT INTO t1 VALUES( 5, "up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||
INSERT INTO t1 VALUES( 6, "up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||
INSERT INTO t1 VALUES( 7, "down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||
INSERT INTO t1 VALUES( 8, "down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||
INSERT INTO t1 VALUES( 9, "down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||
INSERT INTO t1 VALUES(10, "right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||
INSERT INTO t1 VALUES(11, "right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||
INSERT INTO t1 VALUES(12, "right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||
INSERT INTO t1 VALUES(13, "left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||
INSERT INTO t1 VALUES(14, "left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||
INSERT INTO t1 VALUES(15, "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
|
||||
|
|
|
@ -51,3 +51,5 @@ SSL error: Unable to get private key from ''
|
|||
mysqltest: Could not open connection 'default': 2026 SSL connection error
|
||||
SSL error: Unable to get certificate from ''
|
||||
mysqltest: Could not open connection 'default': 2026 SSL connection error
|
||||
Variable_name Value
|
||||
Ssl_cipher DHE-RSA-AES256-SHA
|
||||
|
|
|
@ -1346,3 +1346,44 @@ t1 CREATE TABLE `t1` (
|
|||
`i` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*'
|
||||
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
|
||||
|
|
|
@ -99,7 +99,7 @@ DROP TABLE t1, t2, t3;
|
|||
CREATE TABLE t1 (y YEAR);
|
||||
INSERT INTO t1 VALUES ('abc');
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'y' at row 1
|
||||
Warning 1366 Incorrect integer value: 'abc' for column 'y' at row 1
|
||||
SELECT * FROM t1;
|
||||
y
|
||||
0000
|
||||
|
|
|
@ -34,3 +34,15 @@ select if(y = now(), 1, 0) from t1;
|
|||
if(y = now(), 1, 0)
|
||||
1
|
||||
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
|
||||
|
|
|
@ -800,6 +800,16 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from 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
|
||||
#
|
||||
|
|
|
@ -1145,6 +1145,10 @@ INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2);
|
|||
SELECT REPEAT( '#', tire ) AS A,
|
||||
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;
|
||||
|
||||
#
|
||||
|
|
|
@ -471,6 +471,76 @@ create table t1 (g geometry not null);
|
|||
insert into t1 values(default);
|
||||
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
|
||||
|
||||
|
||||
#
|
||||
# Bug #11335 View redefines column types
|
||||
#
|
||||
|
@ -480,3 +550,4 @@ desc v1;
|
|||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -96,4 +96,11 @@ drop table t1;
|
|||
--error 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
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--loose_ssl-cert=std_data/server-cert-des.pem --loose_ssl-key=std_data/server-key-des.pem
|
|
@ -1200,3 +1200,53 @@ create table t1 (i int)
|
|||
comment '123456789*123456789*123456789*123456789*123456789*123456789*';
|
||||
show create 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
|
||||
|
|
|
@ -21,4 +21,12 @@ insert into t1 values (now());
|
|||
select if(y = now(), 1, 0) from 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
|
||||
|
|
|
@ -37,7 +37,7 @@ gptr my_malloc(unsigned int size, myf my_flags)
|
|||
if (my_flags & MY_FAE)
|
||||
error_handler_hook=fatal_error_handler_hook;
|
||||
if (my_flags & (MY_FAE+MY_WME))
|
||||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
|
||||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH),size);
|
||||
if (my_flags & MY_FAE)
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -150,11 +150,11 @@ gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
|
|||
char buff[SC_MAXWIDTH];
|
||||
my_errno=errno;
|
||||
sprintf(buff,"Out of memory at line %d, '%s'", lineno, filename);
|
||||
my_message(EE_OUTOFMEMORY,buff,MYF(ME_BELL+ME_WAITTANG));
|
||||
my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
|
||||
sprintf(buff,"needed %d byte (%ldk), memory in use: %ld bytes (%ldk)",
|
||||
size, (size + 1023L) / 1024L,
|
||||
sf_malloc_max_memory, (sf_malloc_max_memory + 1023L) / 1024L);
|
||||
my_message(EE_OUTOFMEMORY,buff,MYF(ME_BELL+ME_WAITTANG));
|
||||
my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
|
||||
}
|
||||
DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
|
||||
sf_malloc_max_memory,lineno, filename));
|
||||
|
|
|
@ -135,6 +135,17 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
# Check that no previous MySQL installation exist
|
||||
if test -f "$ldata/mysql/db.frm"
|
||||
then
|
||||
echo "FATAL ERROR: Found already existing MySQL system tables"
|
||||
echo "in $ldata."
|
||||
echo "If you are upgrading from a previous MySQL version you"
|
||||
echo "should run '$bindir/mysql_upgrade', "
|
||||
echo "to upgrade all tables for this version of MySQL"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# Find SQL scripts needed for bootstrap
|
||||
fill_help_tables="fill_help_tables.sql"
|
||||
create_system_tables="mysql_system_tables.sql"
|
||||
|
@ -181,7 +192,6 @@ then
|
|||
fi
|
||||
|
||||
# Find executables and paths
|
||||
mdata=$ldata/mysql
|
||||
mysqld=$execdir/mysqld
|
||||
mysqld_opt=""
|
||||
scriptdir=$bindir
|
||||
|
@ -264,12 +274,6 @@ if test -w / -a ! -z "$user"; then
|
|||
chown $user $ldata $ldata/mysql $ldata/test;
|
||||
fi
|
||||
|
||||
# Check is "db" table already exist
|
||||
if test ! -f $mdata/db.frm
|
||||
then
|
||||
db_table_already_exist="yes"
|
||||
fi
|
||||
|
||||
if test -n "$user"; then
|
||||
args="$args --user=$user"
|
||||
fi
|
||||
|
@ -322,16 +326,6 @@ then
|
|||
echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
|
||||
echo "See the manual for more instructions."
|
||||
|
||||
# Print message about upgrading unless we have created a new db table.
|
||||
if test -z "$db_table_already_exist"
|
||||
then
|
||||
echo
|
||||
echo "NOTE: If you are upgrading from a previous MySQL verision you "
|
||||
echo "should run '$bindir/mysql_upgrade', to make sure all tables have "
|
||||
echo "been upgraded for this version of MySQL"
|
||||
fi
|
||||
echo
|
||||
|
||||
if test "$in_rpm" = "0"
|
||||
then
|
||||
echo "You can start the MySQL daemon with:"
|
||||
|
|
371
sql/field.cc
371
sql/field.cc
|
@ -967,6 +967,31 @@ static Item_result field_types_result_type [FIELDTYPE_NUM]=
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
Test if the given string contains important data:
|
||||
not spaces for character string,
|
||||
or any data for binary string.
|
||||
|
||||
SYNOPSIS
|
||||
test_if_important_data()
|
||||
cs Character set
|
||||
str String to test
|
||||
strend String end
|
||||
|
||||
RETURN
|
||||
FALSE - If string does not have important data
|
||||
TRUE - If string has some important data
|
||||
*/
|
||||
|
||||
static bool
|
||||
test_if_important_data(CHARSET_INFO *cs, const char *str, const char *strend)
|
||||
{
|
||||
if (cs != &my_charset_bin)
|
||||
str+= cs->cset->scan(cs, str, strend, MY_SEQ_SPACES);
|
||||
return (str < strend);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Detect Item_result by given field type of UNION merge result
|
||||
|
||||
|
@ -1055,65 +1080,114 @@ void Field_num::prepend_zeros(String *value)
|
|||
}
|
||||
|
||||
/*
|
||||
Test if given number is a int (or a fixed format float with .000)
|
||||
Test if given number is a int.
|
||||
|
||||
SYNOPSIS
|
||||
test_if_int()
|
||||
Field_num::check_int
|
||||
cs Character set
|
||||
str String to test
|
||||
end Pointer to char after last used digit
|
||||
cs Character set
|
||||
length String length
|
||||
error Error returned by strntoull10rnd()
|
||||
|
||||
NOTES
|
||||
This is called after one has called my_strntol() or similar function.
|
||||
This is only used to give warnings in ALTER TABLE or LOAD DATA...
|
||||
|
||||
TODO
|
||||
Make this multi-byte-character safe
|
||||
NOTE
|
||||
This is called after one has called strntoull10rnd() function.
|
||||
|
||||
RETURN
|
||||
0 OK
|
||||
1 error. A warning is pushed if field_name != 0
|
||||
0 ok
|
||||
1 error: empty string or wrong integer.
|
||||
2 error: garbage at the end of string.
|
||||
*/
|
||||
|
||||
bool Field::check_int(const char *str, int length, const char *int_end,
|
||||
CHARSET_INFO *cs)
|
||||
int Field_num::check_int(CHARSET_INFO *cs, const char *str, int length,
|
||||
const char *int_end, int error)
|
||||
{
|
||||
const char *end;
|
||||
if (str == int_end)
|
||||
/* Test if we get an empty string or wrong integer */
|
||||
if (str == int_end || error == MY_ERRNO_EDOM)
|
||||
{
|
||||
char buff[128];
|
||||
String tmp(buff,(uint32) sizeof(buff), system_charset_info);
|
||||
String tmp(buff, (uint32) sizeof(buff), system_charset_info);
|
||||
tmp.copy(str, length, system_charset_info);
|
||||
push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
|
||||
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
|
||||
"integer", tmp.c_ptr(), field_name,
|
||||
(ulong) table->in_use->row_count);
|
||||
return 1; // Empty string
|
||||
return 1;
|
||||
}
|
||||
end= str+length;
|
||||
if ((str= int_end) == end)
|
||||
return 0; // OK; All digits was used
|
||||
|
||||
/* Allow end .0000 */
|
||||
if (*str == '.')
|
||||
/* Test if we have garbage at the end of the given string. */
|
||||
if (test_if_important_data(cs, int_end, str + length))
|
||||
{
|
||||
for (str++ ; str != end && *str == '0'; str++)
|
||||
;
|
||||
}
|
||||
/* Allow end space */
|
||||
for ( ; str != end ; str++)
|
||||
{
|
||||
if (!my_isspace(cs,*str))
|
||||
{
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
|
||||
return 1;
|
||||
}
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Conver a string to an integer then check bounds.
|
||||
|
||||
SYNOPSIS
|
||||
Field_num::get_int
|
||||
cs Character set
|
||||
from String to convert
|
||||
len Length of the string
|
||||
rnd OUT longlong value
|
||||
unsigned_max max unsigned value
|
||||
signed_min min signed value
|
||||
signed_max max signed value
|
||||
|
||||
DESCRIPTION
|
||||
The function calls strntoull10rnd() to get an integer value then
|
||||
check bounds and errors returned. In case of any error a warning
|
||||
is raised.
|
||||
|
||||
RETURN
|
||||
0 ok
|
||||
1 error
|
||||
*/
|
||||
|
||||
bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
|
||||
longlong *rnd, ulonglong unsigned_max,
|
||||
longlong signed_min, longlong signed_max)
|
||||
{
|
||||
char *end;
|
||||
int error;
|
||||
|
||||
*rnd= (longlong) cs->cset->strntoull10rnd(cs, from, len, unsigned_flag, &end,
|
||||
&error);
|
||||
if (unsigned_flag)
|
||||
{
|
||||
|
||||
if (((ulonglong) *rnd > unsigned_max) && (*rnd= (longlong) unsigned_max) ||
|
||||
error == MY_ERRNO_ERANGE)
|
||||
{
|
||||
goto out_of_range;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*rnd < signed_min)
|
||||
{
|
||||
*rnd= signed_min;
|
||||
goto out_of_range;
|
||||
}
|
||||
else if (*rnd > signed_max)
|
||||
{
|
||||
*rnd= signed_max;
|
||||
goto out_of_range;
|
||||
}
|
||||
}
|
||||
if (table->in_use->count_cuted_fields && check_int(cs, from, len, end, error))
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
out_of_range:
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
Process decimal library return codes and issue warnings for overflow and
|
||||
truncation.
|
||||
|
@ -2569,45 +2643,11 @@ uint Field_new_decimal::is_equal(create_field *new_field)
|
|||
int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
char *end;
|
||||
int error;
|
||||
|
||||
if (unsigned_flag)
|
||||
{
|
||||
ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end, &error);
|
||||
if (error == MY_ERRNO_ERANGE || tmp > 255)
|
||||
{
|
||||
set_if_smaller(tmp, 255);
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
error= 1;
|
||||
else
|
||||
error= 0;
|
||||
ptr[0]= (char) tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
|
||||
if (tmp < -128)
|
||||
{
|
||||
tmp= -128;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (tmp >= 128)
|
||||
{
|
||||
tmp= 127;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
error= 1;
|
||||
else
|
||||
error= 0;
|
||||
ptr[0]= (char) tmp;
|
||||
}
|
||||
longlong rnd;
|
||||
|
||||
error= get_int(cs, from, len, &rnd, 255, -128, 127);
|
||||
ptr[0]= unsigned_flag ? (char) (ulonglong) rnd : (char) rnd;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -2778,59 +2818,20 @@ void Field_tiny::sql_type(String &res) const
|
|||
int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
char *end;
|
||||
int store_tmp;
|
||||
int error;
|
||||
|
||||
if (unsigned_flag)
|
||||
{
|
||||
ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end, &error);
|
||||
if (error == MY_ERRNO_ERANGE || tmp > UINT_MAX16)
|
||||
{
|
||||
set_if_smaller(tmp, UINT_MAX16);
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
error= 1;
|
||||
else
|
||||
error= 0;
|
||||
longlong rnd;
|
||||
|
||||
error= get_int(cs, from, len, &rnd, UINT_MAX16, INT_MIN16, INT_MAX16);
|
||||
store_tmp= unsigned_flag ? (int) (ulonglong) rnd : (int) rnd;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (table->s->db_low_byte_first)
|
||||
{
|
||||
int2store(ptr,tmp);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
shortstore(ptr,(short) tmp);
|
||||
if (table->s->db_low_byte_first)
|
||||
{
|
||||
int2store(ptr, store_tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
|
||||
if (tmp < INT_MIN16)
|
||||
{
|
||||
tmp= INT_MIN16;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (tmp > INT_MAX16)
|
||||
{
|
||||
tmp=INT_MAX16;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
error= 1;
|
||||
else
|
||||
error= 0;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (table->s->db_low_byte_first)
|
||||
{
|
||||
int2store(ptr,tmp);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
shortstore(ptr,(short) tmp);
|
||||
}
|
||||
shortstore(ptr, (short) store_tmp);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -3064,45 +3065,13 @@ void Field_short::sql_type(String &res) const
|
|||
int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
char *end;
|
||||
int store_tmp;
|
||||
int error;
|
||||
|
||||
if (unsigned_flag)
|
||||
{
|
||||
ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end, &error);
|
||||
if (error == MY_ERRNO_ERANGE || tmp > UINT_MAX24)
|
||||
{
|
||||
set_if_smaller(tmp, UINT_MAX24);
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
error= 1;
|
||||
else
|
||||
error= 0;
|
||||
int3store(ptr,tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
|
||||
if (tmp < INT_MIN24)
|
||||
{
|
||||
tmp= INT_MIN24;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (tmp > INT_MAX24)
|
||||
{
|
||||
tmp=INT_MAX24;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
error= 1;
|
||||
else
|
||||
error= 0;
|
||||
int3store(ptr,tmp);
|
||||
}
|
||||
longlong rnd;
|
||||
|
||||
error= get_int(cs, from, len, &rnd, UINT_MAX24, INT_MIN24, INT_MAX24);
|
||||
store_tmp= unsigned_flag ? (int) (ulonglong) rnd : (int) rnd;
|
||||
int3store(ptr, store_tmp);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -3288,45 +3257,10 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
long store_tmp;
|
||||
int error;
|
||||
char *end;
|
||||
|
||||
if (unsigned_flag)
|
||||
{
|
||||
ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end, &error);
|
||||
if (error == MY_ERRNO_ERANGE || tmp > (ulonglong) UINT_MAX32)
|
||||
{
|
||||
set_if_smaller(tmp, (ulonglong) UINT_MAX32);
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
error= 1;
|
||||
else
|
||||
error= 0;
|
||||
store_tmp= (long) tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
|
||||
if (tmp < INT_MIN32)
|
||||
{
|
||||
tmp= INT_MIN32;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (tmp > INT_MAX32)
|
||||
{
|
||||
tmp=INT_MAX32;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
error= 1;
|
||||
else
|
||||
error= 0;
|
||||
store_tmp= (long) tmp;
|
||||
}
|
||||
|
||||
longlong rnd;
|
||||
|
||||
error= get_int(cs, from, len, &rnd, UINT_MAX32, INT_MIN32, INT_MAX32);
|
||||
store_tmp= unsigned_flag ? (long) (ulonglong) rnd : (long) rnd;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (table->s->db_low_byte_first)
|
||||
{
|
||||
|
@ -3578,7 +3512,8 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
error= 1;
|
||||
}
|
||||
else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
else if (table->in_use->count_cuted_fields &&
|
||||
check_int(cs, from, len, end, error))
|
||||
error= 1;
|
||||
else
|
||||
error= 0;
|
||||
|
@ -5116,16 +5051,25 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
|
|||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
char *end;
|
||||
int error;
|
||||
long nr= my_strntol(cs, from, len, 10, &end, &error);
|
||||
longlong nr= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
|
||||
|
||||
if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155 || error)
|
||||
if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155 ||
|
||||
error == MY_ERRNO_ERANGE)
|
||||
{
|
||||
*ptr=0;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
|
||||
return 1;
|
||||
}
|
||||
if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
|
||||
if (table->in_use->count_cuted_fields &&
|
||||
(error= check_int(cs, from, len, end, error)))
|
||||
{
|
||||
if (error == 1) /* empty or incorrect string */
|
||||
{
|
||||
*ptr= 0;
|
||||
return 1;
|
||||
}
|
||||
error= 1;
|
||||
}
|
||||
|
||||
if (nr != 0 || len != 4)
|
||||
{
|
||||
|
@ -6034,31 +5978,6 @@ report_data_too_long(Field_str *field)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Test if the given string contains important data:
|
||||
not spaces for character string,
|
||||
or any data for binary string.
|
||||
|
||||
SYNOPSIS
|
||||
test_if_important_data()
|
||||
cs Character set
|
||||
str String to test
|
||||
strend String end
|
||||
|
||||
RETURN
|
||||
FALSE - If string does not have important data
|
||||
TRUE - If string has some important data
|
||||
*/
|
||||
|
||||
static bool
|
||||
test_if_important_data(CHARSET_INFO *cs, const char *str, const char *strend)
|
||||
{
|
||||
if (cs != &my_charset_bin)
|
||||
str+= cs->cset->scan(cs, str, strend, MY_SEQ_SPACES);
|
||||
return (str < strend);
|
||||
}
|
||||
|
||||
|
||||
/* Copy a string and fill with space */
|
||||
|
||||
int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||
|
|
|
@ -358,8 +358,6 @@ public:
|
|||
virtual void set_derivation(enum Derivation derivation_arg) { }
|
||||
bool set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
|
||||
int cuted_increment);
|
||||
bool check_int(const char *str, int length, const char *int_end,
|
||||
CHARSET_INFO *cs);
|
||||
void set_datetime_warning(MYSQL_ERROR::enum_warning_level, uint code,
|
||||
const char *str, uint str_len,
|
||||
timestamp_type ts_type, int cuted_increment);
|
||||
|
@ -445,6 +443,11 @@ public:
|
|||
int store_decimal(const my_decimal *);
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
uint is_equal(create_field *new_field);
|
||||
int check_int(CHARSET_INFO *cs, const char *str, int length,
|
||||
const char *int_end, int error);
|
||||
bool get_int(CHARSET_INFO *cs, const char *from, uint len,
|
||||
longlong *rnd, ulonglong unsigned_max,
|
||||
longlong signed_min, longlong signed_max);
|
||||
};
|
||||
|
||||
|
||||
|
|
11
sql/item.h
11
sql/item.h
|
@ -735,12 +735,11 @@ public:
|
|||
virtual bool get_date_result(TIME *ltime,uint fuzzydate)
|
||||
{ return get_date(ltime,fuzzydate); }
|
||||
/*
|
||||
This function is used only in Item_func_isnull/Item_func_isnotnull
|
||||
(implementations of IS NULL/IS NOT NULL clauses). Item_func_is{not}null
|
||||
calls this method instead of one of val/result*() methods, which
|
||||
normally will set null_value. This allows to determine nullness of
|
||||
a complex expression without fully evaluating it.
|
||||
Any new item which can be NULL must implement this call.
|
||||
The method allows to determine nullness of a complex expression
|
||||
without fully evaluating it, instead of calling val/result*() then
|
||||
checking null_value. Used in Item_func_isnull/Item_func_isnotnull
|
||||
and Item_sum_count/Item_sum_count_distinct.
|
||||
Any new item which can be NULL must implement this method.
|
||||
*/
|
||||
virtual bool is_null() { return 0; }
|
||||
|
||||
|
|
|
@ -4792,6 +4792,12 @@ static Native_func_registry func_array[] =
|
|||
{ C_STRING_WITH_LEN("MAKE_SET"), BUILDER(Create_func_make_set)},
|
||||
{ C_STRING_WITH_LEN("MASTER_POS_WAIT"), BUILDER(Create_func_master_pos_wait)},
|
||||
{ C_STRING_WITH_LEN("MBRCONTAINS"), GEOM_BUILDER(Create_func_contains)},
|
||||
{ C_STRING_WITH_LEN("MBRDISJOINT"), GEOM_BUILDER(Create_func_disjoint)},
|
||||
{ C_STRING_WITH_LEN("MBREQUAL"), GEOM_BUILDER(Create_func_equals)},
|
||||
{ C_STRING_WITH_LEN("MBRINTERSECTS"), GEOM_BUILDER(Create_func_intersects)},
|
||||
{ C_STRING_WITH_LEN("MBROVERLAPS"), GEOM_BUILDER(Create_func_overlaps)},
|
||||
{ C_STRING_WITH_LEN("MBRTOUCHES"), GEOM_BUILDER(Create_func_touches)},
|
||||
{ C_STRING_WITH_LEN("MBRWITHIN"), GEOM_BUILDER(Create_func_within)},
|
||||
{ C_STRING_WITH_LEN("MD5"), BUILDER(Create_func_md5)},
|
||||
{ C_STRING_WITH_LEN("MLINEFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)},
|
||||
{ C_STRING_WITH_LEN("MLINEFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)},
|
||||
|
|
|
@ -2271,7 +2271,7 @@ String *Item_func_repeat::val_str(String *str)
|
|||
goto err; // string and/or delim are null
|
||||
null_value= 0;
|
||||
|
||||
if (count == 0 || count < 0 && !args[1]->unsigned_flag)
|
||||
if (count <= 0 && (count == 0 || !args[1]->unsigned_flag))
|
||||
return &my_empty_string;
|
||||
|
||||
/* Assumes that the maximum length of a String is < INT_MAX32. */
|
||||
|
|
|
@ -1059,14 +1059,8 @@ void Item_sum_count::clear()
|
|||
|
||||
bool Item_sum_count::add()
|
||||
{
|
||||
if (!args[0]->maybe_null)
|
||||
if (!args[0]->maybe_null || !args[0]->is_null())
|
||||
count++;
|
||||
else
|
||||
{
|
||||
args[0]->update_null_value();
|
||||
if (!args[0]->null_value)
|
||||
count++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1908,14 +1902,8 @@ void Item_sum_count::reset_field()
|
|||
char *res=result_field->ptr;
|
||||
longlong nr=0;
|
||||
|
||||
if (!args[0]->maybe_null)
|
||||
if (!args[0]->maybe_null || !args[0]->is_null())
|
||||
nr=1;
|
||||
else
|
||||
{
|
||||
args[0]->update_null_value();
|
||||
if (!args[0]->null_value)
|
||||
nr=1;
|
||||
}
|
||||
int8store(res,nr);
|
||||
}
|
||||
|
||||
|
@ -2018,14 +2006,8 @@ void Item_sum_count::update_field()
|
|||
char *res=result_field->ptr;
|
||||
|
||||
nr=sint8korr(res);
|
||||
if (!args[0]->maybe_null)
|
||||
if (!args[0]->maybe_null || !args[0]->is_null())
|
||||
nr++;
|
||||
else
|
||||
{
|
||||
args[0]->update_null_value();
|
||||
if (!args[0]->null_value)
|
||||
nr++;
|
||||
}
|
||||
int8store(res,nr);
|
||||
}
|
||||
|
||||
|
@ -2449,12 +2431,8 @@ bool Item_sum_count_distinct::setup(THD *thd)
|
|||
Item *item=args[i];
|
||||
if (list.push_back(item))
|
||||
return TRUE; // End of memory
|
||||
if (item->const_item())
|
||||
{
|
||||
item->update_null_value();
|
||||
if (item->null_value)
|
||||
always_null=1;
|
||||
}
|
||||
if (item->const_item() && item->is_null())
|
||||
always_null= 1;
|
||||
}
|
||||
if (always_null)
|
||||
return FALSE;
|
||||
|
|
99
sql/log.cc
99
sql/log.cc
|
@ -1714,7 +1714,7 @@ err:
|
|||
#ifdef __NT__
|
||||
static int eventSource = 0;
|
||||
|
||||
void setup_windows_event_source()
|
||||
static void setup_windows_event_source()
|
||||
{
|
||||
HKEY hRegKey= NULL;
|
||||
DWORD dwError= 0;
|
||||
|
@ -4216,38 +4216,6 @@ static bool test_if_number(register const char *str,
|
|||
} /* test_if_number */
|
||||
|
||||
|
||||
void print_buffer_to_file(enum loglevel level, const char *buffer)
|
||||
{
|
||||
time_t skr;
|
||||
struct tm tm_tmp;
|
||||
struct tm *start;
|
||||
DBUG_ENTER("print_buffer_to_file");
|
||||
DBUG_PRINT("enter",("buffer: %s", buffer));
|
||||
|
||||
VOID(pthread_mutex_lock(&LOCK_error_log));
|
||||
|
||||
skr=time(NULL);
|
||||
localtime_r(&skr, &tm_tmp);
|
||||
start=&tm_tmp;
|
||||
|
||||
fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n",
|
||||
start->tm_year % 100,
|
||||
start->tm_mon+1,
|
||||
start->tm_mday,
|
||||
start->tm_hour,
|
||||
start->tm_min,
|
||||
start->tm_sec,
|
||||
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
|
||||
"Warning" : "Note"),
|
||||
buffer);
|
||||
|
||||
fflush(stderr);
|
||||
|
||||
VOID(pthread_mutex_unlock(&LOCK_error_log));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void sql_perror(const char *message)
|
||||
{
|
||||
#ifdef HAVE_STRERROR
|
||||
|
@ -4314,23 +4282,15 @@ void MYSQL_BIN_LOG::signal_update()
|
|||
}
|
||||
|
||||
#ifdef __NT__
|
||||
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
|
||||
uint length, int buffLen)
|
||||
static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
|
||||
size_t length, size_t buffLen)
|
||||
{
|
||||
HANDLE event;
|
||||
char *buffptr;
|
||||
LPCSTR *buffmsgptr;
|
||||
char *buffptr= buff;
|
||||
DBUG_ENTER("print_buffer_to_nt_eventlog");
|
||||
|
||||
buffptr= buff;
|
||||
if (length > (uint)(buffLen-5))
|
||||
{
|
||||
char *newBuff= new char[length + 5];
|
||||
strcpy(newBuff, buff);
|
||||
buffptr= newBuff;
|
||||
}
|
||||
strmov(buffptr+length, "\r\n\r\n");
|
||||
buffmsgptr= (LPCSTR*) &buffptr; // Keep windows happy
|
||||
/* Add ending CR/LF's to string, overwrite last chars if necessary */
|
||||
strmov(buffptr+min(length, buffLen-5), "\r\n\r\n");
|
||||
|
||||
setup_windows_event_source();
|
||||
if ((event= RegisterEventSource(NULL,"MySQL")))
|
||||
|
@ -4338,24 +4298,20 @@ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
|
|||
switch (level) {
|
||||
case ERROR_LEVEL:
|
||||
ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
|
||||
buffmsgptr, NULL);
|
||||
(LPCSTR*)&buffptr, NULL);
|
||||
break;
|
||||
case WARNING_LEVEL:
|
||||
ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
|
||||
buffmsgptr, NULL);
|
||||
(LPCSTR*) &buffptr, NULL);
|
||||
break;
|
||||
case INFORMATION_LEVEL:
|
||||
ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1,
|
||||
0, buffmsgptr, NULL);
|
||||
0, (LPCSTR*) &buffptr, NULL);
|
||||
break;
|
||||
}
|
||||
DeregisterEventSource(event);
|
||||
}
|
||||
|
||||
/* if we created a string buffer, then delete it */
|
||||
if (buffptr != buff)
|
||||
delete[] buffptr;
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
#endif /* __NT__ */
|
||||
|
@ -4392,14 +4348,45 @@ int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
#else /*!EMBEDDED_LIBRARY*/
|
||||
static void print_buffer_to_file(enum loglevel level, const char *buffer)
|
||||
{
|
||||
time_t skr;
|
||||
struct tm tm_tmp;
|
||||
struct tm *start;
|
||||
DBUG_ENTER("print_buffer_to_file");
|
||||
DBUG_PRINT("enter",("buffer: %s", buffer));
|
||||
|
||||
VOID(pthread_mutex_lock(&LOCK_error_log));
|
||||
|
||||
skr=time(NULL);
|
||||
localtime_r(&skr, &tm_tmp);
|
||||
start=&tm_tmp;
|
||||
|
||||
fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n",
|
||||
start->tm_year % 100,
|
||||
start->tm_mon+1,
|
||||
start->tm_mday,
|
||||
start->tm_hour,
|
||||
start->tm_min,
|
||||
start->tm_sec,
|
||||
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
|
||||
"Warning" : "Note"),
|
||||
buffer);
|
||||
|
||||
fflush(stderr);
|
||||
|
||||
VOID(pthread_mutex_unlock(&LOCK_error_log));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
|
||||
{
|
||||
char buff[1024];
|
||||
uint length;
|
||||
size_t length;
|
||||
DBUG_ENTER("vprint_msg_to_log");
|
||||
|
||||
/* "- 5" is because of print_buffer_to_nt_eventlog() */
|
||||
length= my_vsnprintf(buff, sizeof(buff) - 5, format, args);
|
||||
length= my_vsnprintf(buff, sizeof(buff), format, args);
|
||||
print_buffer_to_file(level, buff);
|
||||
|
||||
#ifdef __NT__
|
||||
|
|
|
@ -770,19 +770,34 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
|
|||
LOG_READ_TOO_LARGE);
|
||||
goto end;
|
||||
}
|
||||
packet->append(buf, sizeof(buf));
|
||||
|
||||
/* Append the log event header to packet */
|
||||
if (packet->append(buf, sizeof(buf)))
|
||||
{
|
||||
/* Failed to allocate packet */
|
||||
result= LOG_READ_MEM;
|
||||
goto end;
|
||||
}
|
||||
data_len-= LOG_EVENT_MINIMAL_HEADER_LEN;
|
||||
if (data_len)
|
||||
{
|
||||
/* Append rest of event, read directly from file into packet */
|
||||
if (packet->append(file, data_len))
|
||||
{
|
||||
/*
|
||||
Here if we hit EOF it's really an error: as data_len is >=0
|
||||
there's supposed to be more bytes available.
|
||||
EOF means we are reading the event partially, which should
|
||||
never happen: either we read badly or the binlog is truncated.
|
||||
Fatal error occured when appending rest of the event
|
||||
to packet, possible failures:
|
||||
1. EOF occured when reading from file, it's really an error
|
||||
as data_len is >=0 there's supposed to be more bytes available.
|
||||
file->error will have been set to number of bytes left to read
|
||||
2. Read was interrupted, file->error would normally be set to -1
|
||||
3. Failed to allocate memory for packet, my_errno
|
||||
will be ENOMEM(file->error shuold be 0, but since the
|
||||
memory allocation occurs before the call to read it might
|
||||
be uninitialized)
|
||||
*/
|
||||
result= file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO;
|
||||
result= (my_errno == ENOMEM ? LOG_READ_MEM :
|
||||
(file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO));
|
||||
/* Implicit goto end; */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,15 +144,46 @@ struct MBR
|
|||
return (xmin<x) && (xmax>x) && (ymin<y) && (ymax>y);
|
||||
}
|
||||
|
||||
/**
|
||||
The dimension maps to an integer as:
|
||||
- Polygon -> 2
|
||||
- Horizontal or vertical line -> 1
|
||||
- Point -> 0
|
||||
- Invalid MBR -> -1
|
||||
*/
|
||||
int dimension() const
|
||||
{
|
||||
int d= 0;
|
||||
|
||||
if (xmin > xmax)
|
||||
return -1;
|
||||
else if (xmin < xmax)
|
||||
d++;
|
||||
|
||||
if (ymin > ymax)
|
||||
return -1;
|
||||
else if (ymin < ymax)
|
||||
d++;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
int overlaps(const MBR *mbr)
|
||||
{
|
||||
int lb= mbr->inner_point(xmin, ymin);
|
||||
int rb= mbr->inner_point(xmax, ymin);
|
||||
int rt= mbr->inner_point(xmax, ymax);
|
||||
int lt= mbr->inner_point(xmin, ymax);
|
||||
/*
|
||||
overlaps() requires that some point inside *this is also inside
|
||||
*mbr, and that both geometries and their intersection are of the
|
||||
same dimension.
|
||||
*/
|
||||
int d = dimension();
|
||||
|
||||
int a = lb+rb+rt+lt;
|
||||
return (a>0) && (a<4) && (!within(mbr));
|
||||
if (d != mbr->dimension() || d <= 0 || contains(mbr) || within(mbr))
|
||||
return 0;
|
||||
|
||||
MBR intersection(max(xmin, mbr->xmin), max(ymin, mbr->ymin),
|
||||
min(xmax, mbr->xmax), min(ymax, mbr->ymax));
|
||||
|
||||
return (d == intersection.dimension());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -4695,6 +4695,12 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
break;
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
if ((item= new Item_float(fields_info->field_name, 0.0, NOT_FIXED_DEC,
|
||||
fields_info->field_length)) == NULL)
|
||||
DBUG_RETURN(NULL);
|
||||
break;
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
if (!(item= new Item_decimal((longlong) fields_info->value, false)))
|
||||
{
|
||||
|
@ -4711,6 +4717,9 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
|||
strlen(fields_info->field_name), cs);
|
||||
break;
|
||||
default:
|
||||
/* Don't let unimplemented types pass through. Could be a grave error. */
|
||||
DBUG_ASSERT(fields_info->field_type == MYSQL_TYPE_STRING);
|
||||
|
||||
/* this should be changed when Item_empty_string is fixed(in 4.1) */
|
||||
if (!(item= new Item_empty_string("", 0, cs)))
|
||||
{
|
||||
|
|
|
@ -309,6 +309,14 @@ new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
|
|||
{
|
||||
struct st_VioSSLFd *ssl_fd;
|
||||
int verify= SSL_VERIFY_PEER;
|
||||
|
||||
/*
|
||||
Turn off verification of servers certificate if both
|
||||
ca_file and ca_path is set to NULL
|
||||
*/
|
||||
if (ca_file == 0 && ca_path == 0)
|
||||
verify= SSL_VERIFY_NONE;
|
||||
|
||||
if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file,
|
||||
ca_path, cipher, TLSv1_client_method())))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue