Commit 6fa35a5d authored by malff@lambda.hsd1.co.comcast.net.'s avatar malff@lambda.hsd1.co.comcast.net.
Browse files

Merge lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.0-base

into  lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.0-rt-merge
parents 3d203e55 86082dfc
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@
/* We have to do this define before including windows.h to get the AWE API
functions */
#define _WIN32_WINNT     0x0500
#else
/* Get NT 4.0 functions */
#define _WIN32_WINNT     0x0400
#endif

#if defined(_MSC_VER) && _MSC_VER >= 1400
+5 −4
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ struct timespec {

void win_pthread_init(void);
int win_pthread_setspecific(void *A,void *B,uint length);
int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *);
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
@@ -176,7 +177,7 @@ extern int pthread_mutex_destroy (pthread_mutex_t *);
#else
#define pthread_mutex_init(A,B)  (InitializeCriticalSection(A),0)
#define pthread_mutex_lock(A)	 (EnterCriticalSection(A),0)
#define pthread_mutex_trylock(A) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT)
#define pthread_mutex_trylock(A) win_pthread_mutex_trylock((A))
#define pthread_mutex_unlock(A)  LeaveCriticalSection(A)
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
#define my_pthread_setprio(A,B)  SetThreadPriority(GetCurrentThread(), (B))
@@ -574,7 +575,7 @@ typedef struct st_safe_mutex_info_t

int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr,
                    const char *file, uint line);
int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_lock(safe_mutex_t *mp, my_bool try_lock, const char *file, uint line);
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
@@ -597,12 +598,12 @@ void safe_mutex_end(FILE *file);
#undef pthread_cond_timedwait
#undef pthread_mutex_trylock
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B),__FILE__,__LINE__)
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_lock(A) safe_mutex_lock((A), FALSE, __FILE__, __LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
#define pthread_mutex_trylock(A) safe_mutex_lock((A), TRUE, __FILE__, __LINE__)
#define pthread_mutex_t safe_mutex_t
#define safe_mutex_assert_owner(mp) \
          DBUG_ASSERT((mp)->count > 0 && \
+14 −1
Original line number Diff line number Diff line
@@ -1211,7 +1211,7 @@ ERROR 42S02: Unknown table 'c' in field list
drop procedure bug15091;
drop function if exists bug16896;
create aggregate function bug16896() returns int return 1;
ERROR 42000: AGGREGATE is not supported for stored functions
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() returns int return 1' at line 1
DROP PROCEDURE IF EXISTS bug14702;
CREATE IF NOT EXISTS PROCEDURE bug14702()
BEGIN
@@ -1452,3 +1452,16 @@ end
until true end repeat retry;
end//
ERROR 42000: LEAVE with no matching label: retry
DROP DATABASE IF EXISTS mysqltest;
CREATE DATABASE mysqltest;
USE mysqltest;
DROP DATABASE mysqltest;
SELECT inexistent(), 1 + ,;
ERROR 42000: FUNCTION inexistent does not exist
SELECT inexistent();
ERROR 42000: FUNCTION inexistent does not exist
SELECT .inexistent();
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '()' at line 1
SELECT ..inexistent();
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.inexistent()' at line 1
USE test;
+194 −3
Original line number Diff line number Diff line
@@ -5667,7 +5667,6 @@ t3_id_1 t3_id_2 t4_id
DROP PROCEDURE p1|
DROP VIEW v1, v2|
DROP TABLE t3, t4|
End of 5.0 tests
DROP TABLE IF EXISTS bug23760|
DROP TABLE IF EXISTS bug23760_log|
DROP PROCEDURE IF EXISTS bug23760_update_log|
@@ -6145,7 +6144,6 @@ Procedure sql_mode Create Procedure
proc_21513		CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_21513`()
`my_label`:BEGIN END
drop procedure proc_21513|
End of 5.0 tests.
drop table t1,t2;
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
@@ -6389,4 +6387,197 @@ DROP TABLE t1;

DROP PROCEDURE p1;
DROP PROCEDURE p2;
End of 5.0 tests

#
# Bug#31035.
#

#
# - Prepare.
#

DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP FUNCTION IF EXISTS f3;
DROP FUNCTION IF EXISTS f4;

#
# - Create required objects.
#

CREATE TABLE t1(c1 INT);

INSERT INTO t1 VALUES (1), (2), (3);

CREATE FUNCTION f1()
RETURNS INT
NOT DETERMINISTIC
RETURN 1;

CREATE FUNCTION f2(p INT)
RETURNS INT
NOT DETERMINISTIC
RETURN 1;

CREATE FUNCTION f3()
RETURNS INT
DETERMINISTIC
RETURN 1;

CREATE FUNCTION f4(p INT)
RETURNS INT
DETERMINISTIC
RETURN 1;

#
# - Check.
#

SELECT f1() AS a FROM t1 GROUP BY a;
a
1

SELECT f2(@a) AS a FROM t1 GROUP BY a;
a
1

SELECT f3() AS a FROM t1 GROUP BY a;
a
1

SELECT f4(0) AS a FROM t1 GROUP BY a;
a
1

SELECT f4(@a) AS a FROM t1 GROUP BY a;
a
1

#
# - Cleanup.
#

DROP TABLE t1;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
DROP FUNCTION f4;

#
# Bug#31191.
#

#
# - Prepare.
#

DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP FUNCTION IF EXISTS f1;

#
# - Create required objects.
#

CREATE TABLE t1 (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
barcode INT(8) UNSIGNED ZEROFILL nOT NULL,
PRIMARY KEY  (id),
UNIQUE KEY barcode (barcode)
);

INSERT INTO t1 (id, barcode) VALUES (1, 12345678);
INSERT INTO t1 (id, barcode) VALUES (2, 12345679);

CREATE TABLE test.t2 (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
barcode BIGINT(11) UNSIGNED ZEROFILL NOT NULL,
PRIMARY KEY  (id)
);

INSERT INTO test.t2 (id, barcode) VALUES (1, 12345106708);
INSERT INTO test.t2 (id, barcode) VALUES (2, 12345106709);

CREATE FUNCTION f1(p INT(8))
RETURNS BIGINT(11) UNSIGNED
READS SQL DATA
RETURN FLOOR(p/1000)*1000000 + 100000 + FLOOR((p MOD 1000)/10)*100 + (p MOD 10);

#
# - Check.
#

SELECT DISTINCT t1.barcode, f1(t1.barcode)
FROM t1
INNER JOIN t2
ON f1(t1.barcode) = t2.barcode
WHERE t1.barcode=12345678;
barcode	f1(t1.barcode)
12345678	12345106708

#
# - Cleanup.
#

DROP TABLE t1;
DROP TABLE t2;
DROP FUNCTION f1;

#
# Bug#31226.
#

#
# - Prepare.
#

DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS f1;

#
# - Create required objects.
#

CREATE TABLE t1(id INT);

INSERT INTO t1 VALUES (1), (2), (3);

CREATE FUNCTION f1()
RETURNS DATETIME
NOT DETERMINISTIC NO SQL
RETURN NOW();

#
# - Check.
#

SELECT f1() FROM t1 GROUP BY 1;
f1()
<timestamp>

#
# - Cleanup.
#

DROP TABLE t1;
DROP FUNCTION f1;

DROP PROCEDURE IF EXISTS db28318_a.t1;
DROP PROCEDURE IF EXISTS db28318_b.t2;
DROP DATABASE IF EXISTS db28318_a;
DROP DATABASE IF EXISTS db28318_b;
CREATE DATABASE db28318_a;
CREATE DATABASE db28318_b;
CREATE PROCEDURE db28318_a.t1() SELECT "db28318_a.t1";
CREATE PROCEDURE db28318_b.t2() CALL t1();
use db28318_a;
CALL db28318_b.t2();
ERROR 42000: PROCEDURE db28318_b.t1 does not exist
DROP PROCEDURE db28318_a.t1;
DROP PROCEDURE db28318_b.t2;
DROP DATABASE db28318_a;
DROP DATABASE db28318_b;
# ------------------------------------------------------------------
# -- End of 5.0 tests
# ------------------------------------------------------------------
+9 −2
Original line number Diff line number Diff line
@@ -95,10 +95,10 @@ FR
DROP TABLE bug19904;
CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse
RETURNS STRING SONAME "should_not_parse.so";
ERROR HY000: Incorrect usage of SONAME and DEFINER
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RETURNS STRING SONAME "should_not_parse.so"' at line 2
CREATE DEFINER=someone@somewhere FUNCTION should_not_parse
RETURNS STRING SONAME "should_not_parse.so";
ERROR HY000: Incorrect usage of SONAME and DEFINER
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RETURNS STRING SONAME "should_not_parse.so"' at line 2
create table t1(f1 int);
insert into t1 values(1),(2);
explain select myfunc_int(f1) from t1 order by 1;
@@ -296,6 +296,13 @@ Qcache_queries_in_cache 0
drop table t1;
drop function metaphon;
set GLOBAL query_cache_size=default;
DROP DATABASE IF EXISTS mysqltest;
CREATE DATABASE mysqltest;
USE mysqltest;
DROP DATABASE mysqltest;
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
DROP FUNCTION metaphon;
USE test;
CREATE TABLE const_len_bug (
str_const varchar(4000),
result1 varchar(4000),
Loading