mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
Merge 10.1 into 10.1
This is joint work with Oleksandr Byelkin.
This commit is contained in:
commit
213ece2f2e
101 changed files with 2789 additions and 7471 deletions
|
@ -241,8 +241,14 @@ ENDIF()
|
|||
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG(-ggdb3 DEBUG)
|
||||
|
||||
OPTION(ENABLED_LOCAL_INFILE
|
||||
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
|
||||
SET(ENABLED_LOCAL_INFILE "AUTO" CACHE STRING "If we should should enable LOAD DATA LOCAL by default (OFF/ON/AUTO)")
|
||||
IF (ENABLED_LOCAL_INFILE MATCHES "^(0|FALSE)$")
|
||||
SET(ENABLED_LOCAL_INFILE OFF)
|
||||
ELSEIF(ENABLED_LOCAL_INFILE MATCHES "^(1|TRUE)$")
|
||||
SET(ENABLED_LOCAL_INFILE ON)
|
||||
ELSEIF (NOT ENABLED_LOCAL_INFILE MATCHES "^(ON|OFF|AUTO)$")
|
||||
MESSAGE(FATAL_ERROR "ENABLED_LOCAL_INFILE must be one of OFF, ON, AUTO")
|
||||
ENDIF()
|
||||
|
||||
OPTION(WITH_FAST_MUTEXES "Compile with fast mutexes" OFF)
|
||||
MARK_AS_ADVANCED(WITH_FAST_MUTEXES)
|
||||
|
|
|
@ -6075,7 +6075,6 @@ void do_connect(struct st_command *command)
|
|||
#endif
|
||||
if (opt_compress || con_compress)
|
||||
mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
|
||||
mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
|
||||
mysql_options(con_slot->mysql, MYSQL_SET_CHARSET_NAME,
|
||||
charset_info->csname);
|
||||
if (opt_charsets_dir)
|
||||
|
@ -6175,6 +6174,11 @@ void do_connect(struct st_command *command)
|
|||
if (con_slot == next_con)
|
||||
next_con++; /* if we used the next_con slot, advance the pointer */
|
||||
}
|
||||
else // Failed to connect. Free the memory.
|
||||
{
|
||||
mysql_close(con_slot->mysql);
|
||||
con_slot->mysql= NULL;
|
||||
}
|
||||
|
||||
dynstr_free(&ds_connection_name);
|
||||
dynstr_free(&ds_host);
|
||||
|
@ -9175,7 +9179,6 @@ int main(int argc, char **argv)
|
|||
(void *) &opt_connect_timeout);
|
||||
if (opt_compress)
|
||||
mysql_options(con->mysql,MYSQL_OPT_COMPRESS,NullS);
|
||||
mysql_options(con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
|
||||
mysql_options(con->mysql, MYSQL_SET_CHARSET_NAME,
|
||||
charset_info->csname);
|
||||
if (opt_charsets_dir)
|
||||
|
|
|
@ -83,7 +83,6 @@ IF(FEATURE_SET)
|
|||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
OPTION(ENABLED_LOCAL_INFILE "" ON)
|
||||
SET(WITH_INNODB_SNAPPY OFF CACHE STRING "")
|
||||
IF(WIN32)
|
||||
SET(WITH_LIBARCHIVE STATIC CACHE STRING "")
|
||||
|
|
|
@ -177,12 +177,20 @@ MACRO (MYSQL_CHECK_SSL)
|
|||
ENDIF()
|
||||
|
||||
INCLUDE(CheckSymbolExists)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||
CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
|
||||
HAVE_SHA512_DIGEST_LENGTH)
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <openssl/dh.h>
|
||||
int main()
|
||||
{
|
||||
DH dh;
|
||||
return sizeof(dh.version);
|
||||
}" OLD_OPENSSL_API)
|
||||
SET(CMAKE_REQUIRED_INCLUDES)
|
||||
IF(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES AND
|
||||
OPENSSL_MAJOR_VERSION STRLESS "101" AND
|
||||
OLD_OPENSSL_API AND
|
||||
CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH)
|
||||
|
||||
SET(SSL_SOURCES "")
|
||||
|
|
|
@ -544,7 +544,11 @@
|
|||
/*
|
||||
MySQL features
|
||||
*/
|
||||
#cmakedefine ENABLED_LOCAL_INFILE 1
|
||||
#define LOCAL_INFILE_MODE_OFF 0
|
||||
#define LOCAL_INFILE_MODE_ON 1
|
||||
#define LOCAL_INFILE_MODE_AUTO 2
|
||||
#define ENABLED_LOCAL_INFILE LOCAL_INFILE_MODE_@ENABLED_LOCAL_INFILE@
|
||||
|
||||
#cmakedefine ENABLED_PROFILING 1
|
||||
#cmakedefine EXTRA_DEBUG 1
|
||||
#cmakedefine CYBOZU 1
|
||||
|
|
|
@ -42,7 +42,7 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
|
|||
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
|
||||
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
|
||||
#else
|
||||
# define MEM_UNDEFINED(a,len) ((void) 0)
|
||||
# define MEM_UNDEFINED(a,len) ((void) (a), (void) (len))
|
||||
# define MEM_NOACCESS(a,len) ((void) 0)
|
||||
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
|
||||
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
|
||||
|
@ -51,7 +51,7 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
|
|||
#ifndef DBUG_OFF
|
||||
#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_UNDEFINED(A, trash_tmp); memset(A, C, trash_tmp); } while (0)
|
||||
#else
|
||||
#define TRASH_FILL(A,B,C) do { const size_t trash_tmp __attribute__((unused))= (B); MEM_UNDEFINED(A,trash_tmp); } while (0)
|
||||
#define TRASH_FILL(A,B,C) do { MEM_UNDEFINED((A), (B)); } while (0)
|
||||
#endif
|
||||
#define TRASH_ALLOC(A,B) do { TRASH_FILL(A,B,0xA5); MEM_UNDEFINED(A,B); } while(0)
|
||||
#define TRASH_FREE(A,B) do { TRASH_FILL(A,B,0x8F); MEM_NOACCESS(A,B); } while(0)
|
||||
|
|
|
@ -287,7 +287,7 @@ typedef struct st_mysql
|
|||
|
||||
/* session-wide random string */
|
||||
char scramble[SCRAMBLE_LENGTH+1];
|
||||
my_bool unused1;
|
||||
my_bool auto_local_infile;
|
||||
void *unused2, *unused3, *unused4, *unused5;
|
||||
|
||||
LIST *stmts; /* list of all statements */
|
||||
|
|
|
@ -350,7 +350,7 @@ typedef struct st_mysql
|
|||
my_bool free_me;
|
||||
my_bool reconnect;
|
||||
char scramble[20 +1];
|
||||
my_bool unused1;
|
||||
my_bool auto_local_infile;
|
||||
void *unused2, *unused3, *unused4, *unused5;
|
||||
LIST *stmts;
|
||||
const struct st_mysql_methods *methods;
|
||||
|
|
|
@ -21,3 +21,4 @@ innodb-wl5522-debug-zip : broken upstream
|
|||
innodb_bug12902967 : broken upstream
|
||||
file_contents : MDEV-6526 these files are not installed anymore
|
||||
max_statement_time : cannot possibly work, depends on timing
|
||||
partition_open_files_limit : open_files_limit check broken by MDEV-18360
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,124 +0,0 @@
|
|||
#
|
||||
# Specific tests for case sensitive file systems
|
||||
# i.e. lower_case_filesystem=OFF
|
||||
#
|
||||
-- source include/have_case_sensitive_file_system.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
connect (master,localhost,root,,);
|
||||
connection master;
|
||||
create database d1;
|
||||
grant all on d1.* to 'sample'@'localhost' identified by 'password';
|
||||
flush privileges;
|
||||
|
||||
connect (sample,localhost,sample,password,d1);
|
||||
connection sample;
|
||||
select database();
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
create database d2;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
create database D1;
|
||||
disconnect sample;
|
||||
--source include/wait_until_disconnected.inc
|
||||
|
||||
connection master;
|
||||
drop user 'sample'@'localhost';
|
||||
drop database if exists d1;
|
||||
disconnect master;
|
||||
--source include/wait_until_disconnected.inc
|
||||
connection default;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#41049 does syntax "grant" case insensitive?
|
||||
#
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE T1(f1 INT);
|
||||
CREATE TABLE t1(f1 INT);
|
||||
GRANT SELECT ON T1 to user_1@localhost;
|
||||
|
||||
connect (con1,localhost,user_1,,d1);
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
select * from t1;
|
||||
select * from T1;
|
||||
connection default;
|
||||
GRANT SELECT ON t1 to user_1@localhost;
|
||||
connection con1;
|
||||
select * from information_schema.table_privileges;
|
||||
connection default;
|
||||
disconnect con1;
|
||||
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
||||
DROP USER user_1@localhost;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
CREATE PROCEDURE p1() BEGIN END;
|
||||
CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
|
||||
|
||||
GRANT USAGE ON db1.* to user_1@localhost;
|
||||
GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
|
||||
GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
|
||||
GRANT UPDATE ON db1.* to USER_1@localhost;
|
||||
|
||||
connect (con1,localhost,user_1,,db1);
|
||||
call p1();
|
||||
call P1();
|
||||
select f1(1);
|
||||
connect (con2,localhost,USER_1,,db1);
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
call p1();
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
call P1();
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
select f1(1);
|
||||
|
||||
connection default;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
|
||||
DROP FUNCTION f1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP USER user_1@localhost;
|
||||
DROP USER USER_1@localhost;
|
||||
DROP DATABASE db1;
|
||||
use test;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Extra test coverage for Bug#56595 RENAME TABLE causes assert on OS X
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1(a INT);
|
||||
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
|
||||
RENAME TABLE t1 TO T1;
|
||||
ALTER TABLE T1 RENAME t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# MDEV-13912 mysql_upgrade: case (in)sensitivity for stored procedures
|
||||
#
|
||||
create database TEST;
|
||||
create procedure TEST.pr() begin end;
|
||||
create procedure test.pr() begin end;
|
||||
--exec $MYSQL_UPGRADE --force 2>&1
|
||||
drop procedure test.pr;
|
||||
drop database TEST;
|
||||
|
||||
# End of 5.5 tests
|
||||
|
||||
#
|
||||
# MDEV-9014 SHOW TRIGGERS not case sensitive
|
||||
#
|
||||
create table t1 (a int);
|
||||
create trigger t1_bi before insert on t1 for each row set new.a= 1;
|
||||
show triggers like '%T1%';
|
||||
drop table t1;
|
|
@ -600,3 +600,29 @@ a
|
|||
2
|
||||
drop table "a1\""b1";
|
||||
set sql_mode=default;
|
||||
create table t1 (a text);
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
41
|
||||
truncate table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
41
|
||||
truncate table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
truncate table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
truncate table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
41
|
||||
truncate table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
truncate table t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -85,3 +85,19 @@ checksum table t1 extended;
|
|||
Table Checksum
|
||||
test.t1 4108368782
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
|
||||
#
|
||||
CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
|
||||
insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
|
||||
# Important is that checksum is different from following
|
||||
CHECKSUM TABLE t1 EXTENDED;
|
||||
Table Checksum
|
||||
test.t1 2514025256
|
||||
UPDATE t1 SET c21='cat' WHERE c1=5;
|
||||
# Important is that checksum is different from above
|
||||
CHECKSUM TABLE t1 EXTENDED;
|
||||
Table Checksum
|
||||
test.t1 2326430205
|
||||
drop table t1;
|
||||
# End of 5.5 tests
|
||||
|
|
|
@ -85,3 +85,19 @@ checksum table t1 extended;
|
|||
Table Checksum
|
||||
test.t1 3885665021
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
|
||||
#
|
||||
CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
|
||||
insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
|
||||
# Important is that checksum is different from following
|
||||
CHECKSUM TABLE t1 EXTENDED;
|
||||
Table Checksum
|
||||
test.t1 2514025256
|
||||
UPDATE t1 SET c21='cat' WHERE c1=5;
|
||||
# Important is that checksum is different from above
|
||||
CHECKSUM TABLE t1 EXTENDED;
|
||||
Table Checksum
|
||||
test.t1 2326430205
|
||||
drop table t1;
|
||||
# End of 5.5 tests
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -394,3 +394,25 @@ select null in (select a from t1 where a < out3.a union select a from t2 where
|
|||
(select a from t3) +1 < out3.a+1) from t3 out3;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
drop table t1, t2, t3;
|
||||
CREATE TABLE t1(
|
||||
q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
|
||||
q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
|
||||
f1 int
|
||||
);
|
||||
CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
|
||||
INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
|
||||
INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
|
||||
SELECT f1,
|
||||
(SELECT t.f21 from t2 t where max(
|
||||
q11+q12+q13+q14+q15+q16+q17+q18+q19+
|
||||
q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
|
||||
SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
|
||||
SELECT 1 LIMIT 1) AS test
|
||||
FROM t1 GROUP BY f1;
|
||||
f1 test
|
||||
1 1
|
||||
2 1
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '1'
|
||||
Warning 1292 Incorrect datetime value: '2'
|
||||
DROP TABLE t1,t2;
|
||||
|
|
|
@ -2865,6 +2865,22 @@ SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
|
|||
f
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# MDEV-18255: Server crashes in Bitmap<64u>::intersect
|
||||
#
|
||||
create table t1 (v1 varchar(1)) engine=myisam ;
|
||||
create table t2 (v1 varchar(1)) engine=myisam ;
|
||||
explain
|
||||
select 1 from t1 where exists
|
||||
(select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
select 1 from t1 where exists
|
||||
(select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ;
|
||||
1
|
||||
drop table t1,t2;
|
||||
#
|
||||
# MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
|
||||
# UNION ALL
|
||||
#
|
||||
|
|
|
@ -1,417 +0,0 @@
|
|||
# Description
|
||||
# -----------
|
||||
# Numeric floating point.
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
SELECT 10,10.0,10.,.1e+2,100.0e-1;
|
||||
SELECT 6e-16, -6e-16, --6e-16, -6e-16+1.000000;
|
||||
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
|
||||
SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01;
|
||||
SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0;
|
||||
SELECT 2147483647E+02,21474836.47E+06;
|
||||
|
||||
create table t1 (f1 float(24),f2 float(52));
|
||||
# We mask out Privileges column because it differs for embedded server
|
||||
--replace_column 8 #
|
||||
show full columns from t1;
|
||||
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
|
||||
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (datum double);
|
||||
insert into t1 values (0.5),(1.0),(1.5),(2.0),(2.5);
|
||||
select * from t1;
|
||||
select * from t1 where datum < 1.5;
|
||||
select * from t1 where datum > 1.5;
|
||||
select * from t1 where datum = 1.5;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a decimal(7,3) not null, key (a));
|
||||
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
|
||||
select a from t1 order by a;
|
||||
select min(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#3612, BUG#4393, BUG#4356, BUG#4394
|
||||
#
|
||||
|
||||
create table t1 (c1 double, c2 varchar(20));
|
||||
insert t1 values (121,"16");
|
||||
select c1 + c1 * (c2 / 100) as col from t1;
|
||||
create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
|
||||
# Floats are a bit different in PS
|
||||
--disable_ps_protocol
|
||||
select * from t2;
|
||||
--enable_ps_protocol
|
||||
show create table t2;
|
||||
drop table t1,t2;
|
||||
|
||||
# Bug #1022: When a table contains a 'float' field,
|
||||
# and one of the functions MAX, MIN, or AVG is used on that field,
|
||||
# the system crashes.
|
||||
|
||||
create table t1 (a float);
|
||||
insert into t1 values (1);
|
||||
select max(a),min(a),avg(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# FLOAT/DOUBLE/DECIMAL handling
|
||||
#
|
||||
|
||||
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(7,6));
|
||||
# We mask out Privileges column because it differs for embedded server
|
||||
--replace_column 8 #
|
||||
show full columns from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a decimal(7,3) not null, key (a));
|
||||
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
|
||||
select a from t1 order by a;
|
||||
select min(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
--error 1425
|
||||
create table t1 (a float(200,100), b double(200,100));
|
||||
|
||||
#
|
||||
# float in a char(1) field
|
||||
#
|
||||
create table t1 (c20 char);
|
||||
insert into t1 values (5000.0);
|
||||
insert into t1 values (0.5e4);
|
||||
drop table t1;
|
||||
|
||||
# Errors
|
||||
|
||||
--error 1063
|
||||
create table t1 (f float(54)); # Should give an error
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# Don't allow 'double unsigned' to be set to a negative value (Bug #7700)
|
||||
create table t1 (d1 double, d2 double unsigned);
|
||||
insert into t1 set d1 = -1.0;
|
||||
update t1 set d2 = d1;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# Ensure that maximum values as the result of number of decimals
|
||||
# being specified in table schema are enforced (Bug #7361)
|
||||
create table t1 (f float(4,3));
|
||||
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
|
||||
select * from t1;
|
||||
drop table if exists t1;
|
||||
create table t1 (f double(4,3));
|
||||
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
|
||||
select * from t1;
|
||||
drop table if exists t1;
|
||||
|
||||
# Check conversion of floats to character field (Bug #7774)
|
||||
create table t1 (c char(20));
|
||||
insert into t1 values (5e-28);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
create table t1 (c char(6));
|
||||
insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of comparison of integer with float-in-range (Bug #7840)
|
||||
# This is needed because some ODBC applications (like Foxpro) uses
|
||||
# floats for everything.
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
reckey int unsigned NOT NULL,
|
||||
recdesc varchar(50) NOT NULL,
|
||||
PRIMARY KEY (reckey)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
INSERT INTO t1 VALUES (108, 'Has 108 as key');
|
||||
INSERT INTO t1 VALUES (109, 'Has 109 as key');
|
||||
select * from t1 where reckey=108;
|
||||
select * from t1 where reckey=1.08E2;
|
||||
select * from t1 where reckey=109;
|
||||
select * from t1 where reckey=1.09E2;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #13372 (decimal union)
|
||||
#
|
||||
create table t1 (d double(10,1));
|
||||
create table t2 (d double(10,9));
|
||||
insert into t1 values ("100000000.0");
|
||||
insert into t2 values ("1.23456780");
|
||||
create table t3 select * from t2 union select * from t1;
|
||||
select * from t3;
|
||||
show create table t3;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
|
||||
#
|
||||
# Bug #9855 (inconsistent column type for create select
|
||||
#
|
||||
create table t1 select 105213674794682365.00 + 0.0 x;
|
||||
show warnings;
|
||||
desc t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 select 0.0 x;
|
||||
desc t1;
|
||||
create table t2 select 105213674794682365.00 y;
|
||||
desc t2;
|
||||
create table t3 select x+y a from t1,t2;
|
||||
show warnings;
|
||||
desc t3;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug #22129: A small double precision number becomes zero
|
||||
#
|
||||
# check if underflows are detected correctly
|
||||
select 1e-308, 1.00000001e-300, 100000000e-300;
|
||||
|
||||
# check if overflows are detected correctly
|
||||
select 10e307;
|
||||
|
||||
#
|
||||
# Bug #19690: ORDER BY eliminates rows from the result
|
||||
#
|
||||
create table t1(a int, b double(8, 2));
|
||||
insert into t1 values
|
||||
(1, 28.50), (1, 121.85), (1, 157.23), (1, 1351.00), (1, -1965.35), (1, 81.75),
|
||||
(1, 217.08), (1, 7.94), (4, 96.07), (4, 6404.65), (4, -6500.72), (2, 100.00),
|
||||
(5, 5.00), (5, -2104.80), (5, 2033.80), (5, 0.07), (5, 65.93),
|
||||
(3, -4986.24), (3, 5.00), (3, 4857.34), (3, 123.74), (3, 0.16),
|
||||
(6, -1695.31), (6, 1003.77), (6, 499.72), (6, 191.82);
|
||||
explain select sum(b) s from t1 group by a;
|
||||
select sum(b) s from t1 group by a;
|
||||
select sum(b) s from t1 group by a having s <> 0;
|
||||
select sum(b) s from t1 group by a having s <> 0 order by s;
|
||||
select sum(b) s from t1 group by a having s <=> 0;
|
||||
select sum(b) s from t1 group by a having s <=> 0 order by s;
|
||||
alter table t1 add key (a, b);
|
||||
explain select sum(b) s from t1 group by a;
|
||||
select sum(b) s from t1 group by a;
|
||||
select sum(b) s from t1 group by a having s <> 0;
|
||||
select sum(b) s from t1 group by a having s <> 0 order by s;
|
||||
select sum(b) s from t1 group by a having s <=> 0;
|
||||
select sum(b) s from t1 group by a having s <=> 0 order by s;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# bug #12694 (float(m,d) specifications)
|
||||
#
|
||||
|
||||
--error 1427
|
||||
create table t1 (s1 float(0,2));
|
||||
--error 1427
|
||||
create table t1 (s1 float(1,2));
|
||||
|
||||
#
|
||||
# MySQL Bugs: #11589: mysqltest --ps-protocol, strange output, float/double/real with zerofill
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
f1 real zerofill,
|
||||
f2 double zerofill,
|
||||
f3 float zerofill);
|
||||
INSERT INTO t1 VALUES ( 0.314152e+1, 0.314152e+1, 0.314152e+1);
|
||||
|
||||
let $my_stmt= select f1, f2, f3 FROM t1;
|
||||
eval PREPARE stmt1 FROM '$my_stmt';
|
||||
select f1, f2, f3 FROM t1;
|
||||
eval $my_stmt;
|
||||
EXECUTE stmt1;
|
||||
|
||||
DROP TABLE t1;
|
||||
# Bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits"
|
||||
#
|
||||
|
||||
create table t1 (f1 double(200, 0));
|
||||
insert into t1 values (1e199), (-1e199);
|
||||
insert into t1 values (1e200), (-1e200);
|
||||
insert into t1 values (2e200), (-2e200);
|
||||
select f1 + 0e0 from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (f1 float(30, 0));
|
||||
insert into t1 values (1e29), (-1e29);
|
||||
insert into t1 values (1e30), (-1e30);
|
||||
insert into t1 values (2e30), (-2e30);
|
||||
select f1 + 0e0 from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #12860 "Difference in zero padding of exponent between Unix and Windows"
|
||||
#
|
||||
|
||||
create table t1 (c char(6));
|
||||
insert into t1 values (2e6),(2e-5);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #21497 "DOUBLE truncated to unusable value"
|
||||
#
|
||||
|
||||
CREATE TABLE d1 (d DOUBLE);
|
||||
INSERT INTO d1 VALUES (1.7976931348623157E+308);
|
||||
SELECT * FROM d1;
|
||||
--error ER_ILLEGAL_VALUE_FOR_TYPE
|
||||
INSERT INTO d1 VALUES (1.79769313486232e+308);
|
||||
SELECT * FROM d1;
|
||||
DROP TABLE d1;
|
||||
|
||||
#
|
||||
# Bug #26788 "mysqld (debug) aborts when inserting specific numbers into char
|
||||
# fields"
|
||||
#
|
||||
|
||||
create table t1 (a char(20));
|
||||
insert into t1 values (1.225e-05);
|
||||
select a+0 from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on
|
||||
# windows.
|
||||
#
|
||||
|
||||
create table t1(d double, u bigint unsigned);
|
||||
|
||||
insert into t1(d) values (9.22337203685479e18),
|
||||
(1.84e19);
|
||||
|
||||
update t1 set u = d;
|
||||
select u from t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #21205: Different number of digits for float/doble/real in --ps-protocol
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (f1 DOUBLE);
|
||||
INSERT INTO t1 VALUES(-1.79769313486231e+308);
|
||||
SELECT f1 FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#12406055 BUFFER OVERFLOW OF VARIABLE 'BUFF' IN STRING::SET_REAL
|
||||
--echo #
|
||||
|
||||
--echo # Ignoring output from misc. float operations
|
||||
--disable_result_log
|
||||
|
||||
let $nine_65=
|
||||
99999999999999999999999999999999999999999999999999999999999999999;
|
||||
|
||||
select format(-1.7976931348623157E+307,256) as foo;
|
||||
select least(-1.1111111111111111111111111,
|
||||
- group_concat(1.7976931348623157E+308)) as foo;
|
||||
eval select concat((truncate((-1.7976931348623157E+307),(0x1e))),
|
||||
($nine_65)) into @a;
|
||||
--enable_result_log
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug#12368853 FORMAT() CRASHES WITH LARGE NUMBERS AFTER TRUNCATE...
|
||||
--echo #
|
||||
|
||||
select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result
|
||||
--echo #
|
||||
|
||||
SELECT LEFT('a',EXP(50));
|
||||
SELECT LEFT('a', COALESCE(1e30));
|
||||
|
||||
CREATE TABLE t1 (a FLOAT);
|
||||
INSERT INTO t1 VALUES (1e30);
|
||||
SELECT LEFT('a',a), LEFT('a',1e30) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
PREPARE stmt FROM 'SELECT LEFT(111,?)';
|
||||
SET @a=1e30;
|
||||
EXECUTE stmt USING @a;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1));
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a DOUBLE);
|
||||
INSERT INTO t1 VALUES (1e30),(0);
|
||||
SELECT LEFT('a', SUM(a)) FROM t1;
|
||||
SELECT LEFT('a', AVG(a)) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #13500371 63704: CONVERSION OF '1.' TO A NUMBER GIVES ERROR 1265
|
||||
--echo # (WARN_DATA_TRUNCATED)
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (f FLOAT);
|
||||
INSERT INTO t1 VALUES ('1.');
|
||||
INSERT INTO t1 VALUES ('2.0.');
|
||||
INSERT INTO t1 VALUES ('.');
|
||||
SELECT * FROM t1 ORDER BY f;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.0 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns
|
||||
--echo #
|
||||
CREATE TABLE t1 (a DATETIME PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES ('1999-01-01 00:00:00');
|
||||
CREATE TABLE t2 (a DOUBLE);
|
||||
INSERT INTO t2 VALUES (19990101000000);
|
||||
INSERT INTO t2 VALUES (990101000000);
|
||||
SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
|
||||
SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
|
||||
ALTER TABLE t2 ADD PRIMARY KEY(a);
|
||||
SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
|
||||
SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
|
||||
--echo # t2 should NOT be eliminated
|
||||
EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns
|
||||
--echo #
|
||||
CREATE TABLE t1 (a TIME(6) PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES ('10:20:30');
|
||||
CREATE TABLE t2 (a DOUBLE);
|
||||
INSERT INTO t2 VALUES (102030),(102030.000000001);
|
||||
SELECT t1.* FROM t1 JOIN t2 USING(a);
|
||||
SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
|
||||
ALTER TABLE t2 ADD PRIMARY KEY(a);
|
||||
SELECT t1.* FROM t1 JOIN t2 USING(a);
|
||||
SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
|
||||
--echo # t2 should NOT be elimitated
|
||||
EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.0 tests
|
||||
--echo #
|
|
@ -49,3 +49,36 @@ INSERT INTO t3 SET a=1;
|
|||
kill query @id;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
DROP TABLE t3,t1;
|
||||
#
|
||||
# MDEV-18222 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
|
||||
# or ASAN heap-use-after-free in dict_foreign_remove_from_cache upon CHANGE COLUMN
|
||||
#
|
||||
CREATE TABLE t1 (a INT, UNIQUE(a), KEY(a)) ENGINE=InnoDB;
|
||||
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a);
|
||||
SET SESSION FOREIGN_KEY_CHECKS = OFF;
|
||||
ALTER TABLE t1 CHANGE COLUMN a a TIME NOT NULL;
|
||||
ALTER TABLE t1 ADD pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY;
|
||||
ALTER TABLE t1 CHANGE COLUMN a b TIME;
|
||||
SET SESSION FOREIGN_KEY_CHECKS = ON;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-18256 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
|
||||
# upon DROP FOREIGN KEY
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY fk1 (b) REFERENCES t1 (a))
|
||||
ENGINE=InnoDB;
|
||||
ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1;
|
||||
DROP TABLE t2, t1;
|
||||
CREATE TABLE t1 (f VARCHAR(256)) ENGINE=InnoDB;
|
||||
SET SESSION FOREIGN_KEY_CHECKS = OFF;
|
||||
ALTER TABLE t1 ADD FOREIGN KEY (f) REFERENCES non_existing_table (x);
|
||||
SET SESSION FOREIGN_KEY_CHECKS = ON;
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f);
|
||||
Warnings:
|
||||
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
|
||||
Warning 1088 failed to load FOREIGN KEY constraints
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f);
|
||||
Warnings:
|
||||
Warning 1088 failed to load FOREIGN KEY constraints
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -73,3 +73,34 @@ reap;
|
|||
disconnect fk;
|
||||
|
||||
DROP TABLE t3,t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18222 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
|
||||
--echo # or ASAN heap-use-after-free in dict_foreign_remove_from_cache upon CHANGE COLUMN
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT, UNIQUE(a), KEY(a)) ENGINE=InnoDB;
|
||||
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a);
|
||||
SET SESSION FOREIGN_KEY_CHECKS = OFF;
|
||||
ALTER TABLE t1 CHANGE COLUMN a a TIME NOT NULL;
|
||||
ALTER TABLE t1 ADD pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY;
|
||||
ALTER TABLE t1 CHANGE COLUMN a b TIME;
|
||||
SET SESSION FOREIGN_KEY_CHECKS = ON;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18256 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
|
||||
--echo # upon DROP FOREIGN KEY
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY fk1 (b) REFERENCES t1 (a))
|
||||
ENGINE=InnoDB;
|
||||
ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1;
|
||||
DROP TABLE t2, t1;
|
||||
|
||||
CREATE TABLE t1 (f VARCHAR(256)) ENGINE=InnoDB;
|
||||
SET SESSION FOREIGN_KEY_CHECKS = OFF;
|
||||
ALTER TABLE t1 ADD FOREIGN KEY (f) REFERENCES non_existing_table (x);
|
||||
SET SESSION FOREIGN_KEY_CHECKS = ON;
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f);
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f);
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -16,7 +16,9 @@ wait/synch/mutex/sql/LOCK_audit_mask YES YES
|
|||
wait/synch/mutex/sql/LOCK_binlog_state YES YES
|
||||
select * from performance_schema.setup_instruments
|
||||
where name like 'Wait/Synch/Rwlock/sql/%'
|
||||
and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
|
||||
and name not in (
|
||||
'wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock',
|
||||
'wait/synch/rwlock/sql/LOCK_named_pipe_full_access_group')
|
||||
order by name limit 10;
|
||||
NAME ENABLED TIMED
|
||||
wait/synch/rwlock/sql/LOCK_dboptions YES YES
|
||||
|
|
|
@ -22,10 +22,13 @@ select * from performance_schema.setup_instruments
|
|||
order by name limit 10;
|
||||
|
||||
# CRYPTO_dynlock_value::lock is dependent on the build (SSL)
|
||||
# LOCK_named_pipe_full_access_group is dependent on the build (Windows)
|
||||
|
||||
select * from performance_schema.setup_instruments
|
||||
where name like 'Wait/Synch/Rwlock/sql/%'
|
||||
and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
|
||||
and name not in (
|
||||
'wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock',
|
||||
'wait/synch/rwlock/sql/LOCK_named_pipe_full_access_group')
|
||||
order by name limit 10;
|
||||
|
||||
# COND_handler_count is dependent on the build (Windows only)
|
||||
|
|
|
@ -1214,8 +1214,8 @@
|
|||
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||
VARIABLE_NAME INNODB_VERSION
|
||||
SESSION_VALUE NULL
|
||||
-GLOBAL_VALUE 5.6.42
|
||||
+GLOBAL_VALUE 5.6.41-84.1
|
||||
-GLOBAL_VALUE 5.6.43
|
||||
+GLOBAL_VALUE 5.6.42-84.2
|
||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||
DEFAULT_VALUE NULL
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
|
|
|
@ -684,8 +684,8 @@
|
|||
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||
VARIABLE_NAME INNODB_VERSION
|
||||
SESSION_VALUE NULL
|
||||
-GLOBAL_VALUE 5.6.42
|
||||
+GLOBAL_VALUE 5.6.41-84.1
|
||||
-GLOBAL_VALUE 5.6.43
|
||||
+GLOBAL_VALUE 5.6.42-84.2
|
||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||
DEFAULT_VALUE NULL
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
|
|
|
@ -2401,7 +2401,7 @@ READ_ONLY NO
|
|||
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||
VARIABLE_NAME INNODB_VERSION
|
||||
SESSION_VALUE NULL
|
||||
GLOBAL_VALUE 5.6.42
|
||||
GLOBAL_VALUE 5.6.43
|
||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||
DEFAULT_VALUE NULL
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
|
|
|
@ -680,3 +680,25 @@ show create table "a1\""b1";
|
|||
select * from "a1\""b1";
|
||||
drop table "a1\""b1";
|
||||
set sql_mode=default;
|
||||
|
||||
#
|
||||
# mysql --local-infile
|
||||
#
|
||||
--let $ldli = load data local infile '$MYSQLTEST_VARDIR/tmp/bug.sql' into table test.t1;
|
||||
create table t1 (a text);
|
||||
--exec $MYSQL -e "$ldli"
|
||||
select count(*) from t1; truncate table t1;
|
||||
--exec $MYSQL --enable-local-infile -e "$ldli"
|
||||
select count(*) from t1; truncate table t1;
|
||||
--error 1
|
||||
--exec $MYSQL --disable-local-infile -e "$ldli"
|
||||
select count(*) from t1; truncate table t1;
|
||||
--error 1
|
||||
--exec $MYSQL -e "/*q*/$ldli"
|
||||
select count(*) from t1; truncate table t1;
|
||||
--exec $MYSQL --enable-local-infile -e "/*q*/$ldli"
|
||||
select count(*) from t1; truncate table t1;
|
||||
--error 1
|
||||
--exec $MYSQL --disable-local-infile -e "/*q*/$ldli"
|
||||
select count(*) from t1; truncate table t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -60,3 +60,20 @@ checksum table t1;
|
|||
checksum table t1 quick;
|
||||
checksum table t1 extended;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
|
||||
|
||||
insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
|
||||
--echo # Important is that checksum is different from following
|
||||
CHECKSUM TABLE t1 EXTENDED;
|
||||
UPDATE t1 SET c21='cat' WHERE c1=5;
|
||||
--echo # Important is that checksum is different from above
|
||||
CHECKSUM TABLE t1 EXTENDED;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo # End of 5.5 tests
|
||||
|
|
|
@ -411,3 +411,23 @@ insert into t3 select a from t1;
|
|||
select null in (select a from t1 where a < out3.a union select a from t2 where
|
||||
(select a from t3) +1 < out3.a+1) from t3 out3;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
#
|
||||
# Bug #28499924: INCORRECT BEHAVIOR WITH UNION IN SUBQUERY
|
||||
#
|
||||
CREATE TABLE t1(
|
||||
q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
|
||||
q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
|
||||
f1 int
|
||||
);
|
||||
CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
|
||||
INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
|
||||
INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
|
||||
SELECT f1,
|
||||
(SELECT t.f21 from t2 t where max(
|
||||
q11+q12+q13+q14+q15+q16+q17+q18+q19+
|
||||
q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
|
||||
SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
|
||||
SELECT 1 LIMIT 1) AS test
|
||||
FROM t1 GROUP BY f1;
|
||||
DROP TABLE t1,t2;
|
||||
|
|
|
@ -268,6 +268,19 @@ SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
|
|||
SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18255: Server crashes in Bitmap<64u>::intersect
|
||||
--echo #
|
||||
create table t1 (v1 varchar(1)) engine=myisam ;
|
||||
create table t2 (v1 varchar(1)) engine=myisam ;
|
||||
|
||||
explain
|
||||
select 1 from t1 where exists
|
||||
(select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ;
|
||||
select 1 from t1 where exists
|
||||
(select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ;
|
||||
drop table t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
|
||||
--echo # UNION ALL
|
||||
|
|
|
@ -52,10 +52,9 @@ static uint set_max_open_files(uint max_file_limit)
|
|||
DBUG_PRINT("info", ("rlim_cur: %u rlim_max: %u",
|
||||
(uint) rlimit.rlim_cur,
|
||||
(uint) rlimit.rlim_max));
|
||||
if ((ulonglong) rlimit.rlim_cur == (ulonglong) RLIM_INFINITY)
|
||||
rlimit.rlim_cur = max_file_limit;
|
||||
if (rlimit.rlim_cur >= max_file_limit)
|
||||
DBUG_RETURN(rlimit.rlim_cur); /* purecov: inspected */
|
||||
if ((ulonglong) rlimit.rlim_cur == (ulonglong) RLIM_INFINITY ||
|
||||
rlimit.rlim_cur >= max_file_limit)
|
||||
DBUG_RETURN(max_file_limit);
|
||||
rlimit.rlim_cur= rlimit.rlim_max= max_file_limit;
|
||||
if (setrlimit(RLIMIT_NOFILE, &rlimit))
|
||||
max_file_limit= old_cur; /* Use original value */
|
||||
|
|
|
@ -39,6 +39,9 @@ install_params=""
|
|||
auth_root_authentication_method=normal
|
||||
auth_root_socket_user='root'
|
||||
|
||||
dirname0=`dirname $0 2>/dev/null`
|
||||
dirname0=`dirname $dirname0 2>/dev/null`
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
|
@ -235,11 +238,6 @@ cannot_find_file()
|
|||
done
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "If you compiled from source, you need to either run 'make install' to"
|
||||
echo "copy the software into the correct location ready for operation."
|
||||
echo "If you don't want to do a full install, you can use the --srcdir"
|
||||
echo "option to only install the mysql database and privilege tables"
|
||||
echo
|
||||
echo "If you compiled from source, you need to either run 'make install' to"
|
||||
echo "copy the software into the correct location ready for operation."
|
||||
|
@ -286,6 +284,9 @@ then
|
|||
cannot_find_file my_print_defaults $basedir/bin $basedir/extra
|
||||
exit 1
|
||||
fi
|
||||
elif test -n "$dirname0" -a -x "$dirname0/@bindir@/my_print_defaults"
|
||||
then
|
||||
print_defaults="$dirname0/@bindir@/my_print_defaults"
|
||||
else
|
||||
print_defaults="@bindir@/my_print_defaults"
|
||||
fi
|
||||
|
@ -339,6 +340,15 @@ then
|
|||
cannot_find_file fill_help_tables.sql @pkgdata_locations@
|
||||
exit 1
|
||||
fi
|
||||
# relative from where the script was run for a relocatable install
|
||||
elif test -n "$dirname0" -a -x "$dirname0/@INSTALL_SBINDIR@/mysqld"
|
||||
then
|
||||
basedir="$dirname0"
|
||||
bindir="$basedir/@INSTALL_SBINDIR@"
|
||||
resolveip="$bindir/resolveip"
|
||||
mysqld="$basedir/@INSTALL_SBINDIR@/mysqld"
|
||||
srcpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
|
||||
buildpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
|
||||
else
|
||||
basedir="@prefix@"
|
||||
bindir="@bindir@"
|
||||
|
|
|
@ -110,6 +110,12 @@ my_bool net_flush(NET *net);
|
|||
#include <my_context.h>
|
||||
#include <mysql_async.h>
|
||||
|
||||
typedef enum {
|
||||
ALWAYS_ACCEPT, /* heuristics is disabled, use CLIENT_LOCAL_FILES */
|
||||
WAIT_FOR_QUERY, /* heuristics is enabled, not sending files */
|
||||
ACCEPT_FILE_REQUEST /* heuristics is enabled, ready to send a file */
|
||||
} auto_local_infile_state;
|
||||
|
||||
#define native_password_plugin_name "mysql_native_password"
|
||||
#define old_password_plugin_name "mysql_old_password"
|
||||
|
||||
|
@ -1633,8 +1639,10 @@ mysql_init(MYSQL *mysql)
|
|||
--enable-local-infile
|
||||
*/
|
||||
|
||||
#if defined(ENABLED_LOCAL_INFILE) && !defined(MYSQL_SERVER)
|
||||
#if ENABLED_LOCAL_INFILE && !defined(MYSQL_SERVER)
|
||||
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
|
||||
mysql->auto_local_infile= ENABLED_LOCAL_INFILE == LOCAL_INFILE_MODE_AUTO
|
||||
? WAIT_FOR_QUERY : ALWAYS_ACCEPT;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SMEM
|
||||
|
@ -4003,8 +4011,14 @@ static my_bool cli_read_query_result(MYSQL *mysql)
|
|||
ulong field_count;
|
||||
MYSQL_DATA *fields;
|
||||
ulong length;
|
||||
#ifdef MYSQL_CLIENT
|
||||
my_bool can_local_infile= mysql->auto_local_infile != WAIT_FOR_QUERY;
|
||||
#endif
|
||||
DBUG_ENTER("cli_read_query_result");
|
||||
|
||||
if (mysql->auto_local_infile == ACCEPT_FILE_REQUEST)
|
||||
mysql->auto_local_infile= WAIT_FOR_QUERY;
|
||||
|
||||
if ((length = cli_safe_read(mysql)) == packet_error)
|
||||
DBUG_RETURN(1);
|
||||
free_old_query(mysql); /* Free old result */
|
||||
|
@ -4041,7 +4055,8 @@ get_info:
|
|||
{
|
||||
int error;
|
||||
|
||||
if (!(mysql->options.client_flag & CLIENT_LOCAL_FILES))
|
||||
if (!(mysql->options.client_flag & CLIENT_LOCAL_FILES) ||
|
||||
!can_local_infile)
|
||||
{
|
||||
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
|
@ -4079,6 +4094,13 @@ int STDCALL
|
|||
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
|
||||
{
|
||||
DBUG_ENTER("mysql_send_query");
|
||||
if (mysql->options.client_flag & CLIENT_LOCAL_FILES &&
|
||||
mysql->auto_local_infile == WAIT_FOR_QUERY &&
|
||||
(*query == 'l' || *query == 'L'))
|
||||
{
|
||||
if (strncasecmp(query, STRING_WITH_LEN("load")) == 0)
|
||||
mysql->auto_local_infile= ACCEPT_FILE_REQUEST;
|
||||
}
|
||||
DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1));
|
||||
}
|
||||
|
||||
|
@ -4292,10 +4314,12 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
|
|||
mysql->options.protocol=MYSQL_PROTOCOL_PIPE; /* Force named pipe */
|
||||
break;
|
||||
case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/
|
||||
if (!arg || MY_TEST(*(uint*) arg))
|
||||
if (!arg || *(uint*) arg)
|
||||
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
|
||||
else
|
||||
mysql->options.client_flag&= ~CLIENT_LOCAL_FILES;
|
||||
mysql->auto_local_infile= arg && *(uint*)arg == LOCAL_INFILE_MODE_AUTO
|
||||
? WAIT_FOR_QUERY : ALWAYS_ACCEPT;
|
||||
break;
|
||||
case MYSQL_INIT_COMMAND:
|
||||
add_init_command(&mysql->options,arg);
|
||||
|
|
|
@ -454,7 +454,7 @@ IF(WIN32)
|
|||
COMPONENT Server
|
||||
)
|
||||
SET_TARGET_PROPERTIES(mysql_install_db PROPERTIES COMPILE_FLAGS -DINSTALL_PLUGINDIR=${INSTALL_PLUGINDIR})
|
||||
TARGET_LINK_LIBRARIES(mysql_install_db mysys)
|
||||
TARGET_LINK_LIBRARIES(mysql_install_db mysys shlwapi)
|
||||
|
||||
ADD_LIBRARY(winservice STATIC winservice.c)
|
||||
TARGET_LINK_LIBRARIES(winservice shell32)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2017, MariaDB
|
||||
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2019, MariaDB Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -3924,7 +3924,7 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name,
|
|||
// if the log entry matches, null string matching anything
|
||||
if (!log_name ||
|
||||
(log_name_len == fname_len &&
|
||||
!memcmp(full_fname, full_log_name, log_name_len)))
|
||||
!strncmp(full_fname, full_log_name, log_name_len)))
|
||||
{
|
||||
DBUG_PRINT("info", ("Found log file entry"));
|
||||
linfo->index_file_start_offset= offset;
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <shellapi.h>
|
||||
#include <accctrl.h>
|
||||
#include <aclapi.h>
|
||||
struct IUnknown;
|
||||
#include <shlwapi.h>
|
||||
|
||||
#define USAGETEXT \
|
||||
"mysql_install_db.exe Ver 1.00 for Windows\n" \
|
||||
|
@ -549,20 +551,78 @@ static int create_db_instance()
|
|||
DWORD cwd_len= MAX_PATH;
|
||||
char cmdline[3*MAX_PATH];
|
||||
FILE *in;
|
||||
bool cleanup_datadir= true;
|
||||
DWORD last_error;
|
||||
|
||||
verbose("Running bootstrap");
|
||||
|
||||
GetCurrentDirectory(cwd_len, cwd);
|
||||
CreateDirectory(opt_datadir, NULL); /*ignore error, it might already exist */
|
||||
|
||||
/* Create datadir and datadir/mysql, if they do not already exist. */
|
||||
|
||||
if (!CreateDirectory(opt_datadir, NULL) && (GetLastError() != ERROR_ALREADY_EXISTS))
|
||||
{
|
||||
last_error = GetLastError();
|
||||
switch(last_error)
|
||||
{
|
||||
case ERROR_ACCESS_DENIED:
|
||||
die("Can't create data directory '%s' (access denied)\n",
|
||||
opt_datadir);
|
||||
break;
|
||||
case ERROR_PATH_NOT_FOUND:
|
||||
die("Can't create data directory '%s' "
|
||||
"(one or more intermediate directories do not exist)\n",
|
||||
opt_datadir);
|
||||
break;
|
||||
default:
|
||||
die("Can't create data directory '%s', last error %u\n",
|
||||
opt_datadir, last_error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!SetCurrentDirectory(opt_datadir))
|
||||
{
|
||||
die("Cannot set current directory to '%s'\n",opt_datadir);
|
||||
return -1;
|
||||
last_error = GetLastError();
|
||||
switch (last_error)
|
||||
{
|
||||
case ERROR_DIRECTORY:
|
||||
die("Can't set current directory to '%s', the path is not a valid directory \n",
|
||||
opt_datadir);
|
||||
break;
|
||||
default:
|
||||
die("Can' set current directory to '%s', last error %u\n",
|
||||
opt_datadir, last_error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CreateDirectory("mysql",NULL);
|
||||
CreateDirectory("test", NULL);
|
||||
if (PathIsDirectoryEmpty(opt_datadir))
|
||||
{
|
||||
cleanup_datadir= false;
|
||||
}
|
||||
|
||||
if (!CreateDirectory("mysql",NULL))
|
||||
{
|
||||
last_error = GetLastError();
|
||||
DWORD attributes;
|
||||
switch(last_error)
|
||||
{
|
||||
case ERROR_ACCESS_DENIED:
|
||||
die("Can't create subdirectory 'mysql' in '%s' (access denied)\n",opt_datadir);
|
||||
break;
|
||||
case ERROR_ALREADY_EXISTS:
|
||||
attributes = GetFileAttributes("mysql");
|
||||
|
||||
if (attributes == INVALID_FILE_ATTRIBUTES)
|
||||
die("GetFileAttributes() failed for existing file '%s\\mysql', last error %u",
|
||||
opt_datadir, GetLastError());
|
||||
else if (!(attributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
die("File '%s\\mysql' exists, but it is not a directory", opt_datadir);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Set data directory permissions for both current user and
|
||||
|
@ -675,7 +735,7 @@ static int create_db_instance()
|
|||
}
|
||||
|
||||
end:
|
||||
if (ret)
|
||||
if (ret && cleanup_datadir)
|
||||
{
|
||||
SetCurrentDirectory(cwd);
|
||||
clean_directory(opt_datadir);
|
||||
|
|
|
@ -3793,7 +3793,8 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
|
|||
inner_join->select_options|= SELECT_DESCRIBE;
|
||||
}
|
||||
res= inner_join->optimize();
|
||||
sl->update_used_tables();
|
||||
if (!inner_join->cleaned)
|
||||
sl->update_used_tables();
|
||||
sl->update_correlated_cache();
|
||||
is_correlated_unit|= sl->is_correlated;
|
||||
inner_join->select_options= save_options;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2017, MariaDB Corporation
|
||||
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -542,7 +542,7 @@ bool log_in_use(const char* log_name)
|
|||
if ((linfo = tmp->current_linfo))
|
||||
{
|
||||
mysql_mutex_lock(&linfo->lock);
|
||||
result = !memcmp(log_name, linfo->log_file_name, log_name_len);
|
||||
result = !strncmp(log_name, linfo->log_file_name, log_name_len);
|
||||
mysql_mutex_unlock(&linfo->lock);
|
||||
if (result)
|
||||
break;
|
||||
|
|
|
@ -5717,7 +5717,8 @@ static bool is_candidate_key(KEY *key)
|
|||
KEY_PART_INFO *key_part;
|
||||
KEY_PART_INFO *key_part_end= key->key_part + key->user_defined_key_parts;
|
||||
|
||||
if (!(key->flags & HA_NOSAME) || (key->flags & HA_NULL_PART_KEY))
|
||||
if (!(key->flags & HA_NOSAME) || (key->flags & HA_NULL_PART_KEY) ||
|
||||
(key->flags & HA_KEY_HAS_PART_KEY_SEG))
|
||||
return false;
|
||||
|
||||
for (key_part= key->key_part; key_part < key_part_end; key_part++)
|
||||
|
@ -6203,9 +6204,7 @@ static int compare_uint(const uint *s, const uint *t)
|
|||
@retval false success
|
||||
*/
|
||||
|
||||
static bool fill_alter_inplace_info(THD *thd,
|
||||
TABLE *table,
|
||||
bool varchar,
|
||||
static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
||||
Alter_inplace_info *ha_alter_info)
|
||||
{
|
||||
Field **f_ptr, *field;
|
||||
|
@ -6213,7 +6212,6 @@ static bool fill_alter_inplace_info(THD *thd,
|
|||
Create_field *new_field;
|
||||
KEY_PART_INFO *key_part, *new_part;
|
||||
KEY_PART_INFO *end;
|
||||
uint candidate_key_count= 0;
|
||||
Alter_info *alter_info= ha_alter_info->alter_info;
|
||||
DBUG_ENTER("fill_alter_inplace_info");
|
||||
|
||||
|
@ -6489,8 +6487,13 @@ static bool fill_alter_inplace_info(THD *thd,
|
|||
Primary key index for the new table
|
||||
*/
|
||||
const KEY* const new_pk= (ha_alter_info->key_count > 0 &&
|
||||
is_candidate_key(ha_alter_info->key_info_buffer)) ?
|
||||
(!my_strcasecmp(system_charset_info,
|
||||
ha_alter_info->key_info_buffer->name,
|
||||
primary_key_name) ||
|
||||
is_candidate_key(ha_alter_info->key_info_buffer))) ?
|
||||
ha_alter_info->key_info_buffer : NULL;
|
||||
const KEY *const old_pk= table->s->primary_key == MAX_KEY ? NULL :
|
||||
table->key_info + table->s->primary_key;
|
||||
|
||||
DBUG_PRINT("info", ("index count old: %d new: %d",
|
||||
table->s->keys, ha_alter_info->key_count));
|
||||
|
@ -6572,8 +6575,7 @@ static bool fill_alter_inplace_info(THD *thd,
|
|||
(i) Old table doesn't have primary key, new table has it and vice-versa
|
||||
(ii) Primary key changed to another existing index
|
||||
*/
|
||||
if ((new_key == new_pk) !=
|
||||
((uint) (table_key - table->key_info) == table->s->primary_key))
|
||||
if ((new_key == new_pk) != (table_key == old_pk))
|
||||
goto index_changed;
|
||||
|
||||
/* Check that key comment is not changed. */
|
||||
|
@ -6634,22 +6636,6 @@ static bool fill_alter_inplace_info(THD *thd,
|
|||
|
||||
/* Now let us calculate flags for storage engine API. */
|
||||
|
||||
/* Count all existing candidate keys. */
|
||||
for (table_key= table->key_info; table_key < table_key_end; table_key++)
|
||||
{
|
||||
/*
|
||||
Check if key is a candidate key, This key is either already primary key
|
||||
or could be promoted to primary key if the original primary key is
|
||||
dropped.
|
||||
In MySQL one is allowed to create primary key with partial fields (i.e.
|
||||
primary key which is not considered candidate). For simplicity we count
|
||||
such key as a candidate key here.
|
||||
*/
|
||||
if (((uint) (table_key - table->key_info) == table->s->primary_key) ||
|
||||
is_candidate_key(table_key))
|
||||
candidate_key_count++;
|
||||
}
|
||||
|
||||
/* Figure out what kind of indexes we are dropping. */
|
||||
KEY **dropped_key;
|
||||
KEY **dropped_key_end= ha_alter_info->index_drop_buffer +
|
||||
|
@ -6662,21 +6648,10 @@ static bool fill_alter_inplace_info(THD *thd,
|
|||
|
||||
if (table_key->flags & HA_NOSAME)
|
||||
{
|
||||
/*
|
||||
Unique key. Check for PRIMARY KEY. Also see comment about primary
|
||||
and candidate keys above.
|
||||
*/
|
||||
if ((uint) (table_key - table->key_info) == table->s->primary_key)
|
||||
{
|
||||
if (table_key == old_pk)
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::DROP_PK_INDEX;
|
||||
candidate_key_count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::DROP_UNIQUE_INDEX;
|
||||
if (is_candidate_key(table_key))
|
||||
candidate_key_count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::DROP_INDEX;
|
||||
|
@ -6689,23 +6664,10 @@ static bool fill_alter_inplace_info(THD *thd,
|
|||
|
||||
if (new_key->flags & HA_NOSAME)
|
||||
{
|
||||
bool is_pk= !my_strcasecmp(system_charset_info, new_key->name, primary_key_name);
|
||||
|
||||
if ((!(new_key->flags & HA_KEY_HAS_PART_KEY_SEG) &&
|
||||
!(new_key->flags & HA_NULL_PART_KEY)) ||
|
||||
is_pk)
|
||||
{
|
||||
/* Candidate key or primary key! */
|
||||
if (candidate_key_count == 0 || is_pk)
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ADD_PK_INDEX;
|
||||
else
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ADD_UNIQUE_INDEX;
|
||||
candidate_key_count++;
|
||||
}
|
||||
if (new_key == new_pk)
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ADD_PK_INDEX;
|
||||
else
|
||||
{
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ADD_UNIQUE_INDEX;
|
||||
}
|
||||
}
|
||||
else
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ADD_INDEX;
|
||||
|
@ -9984,7 +9946,10 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
|
|||
{
|
||||
/* calculating table's checksum */
|
||||
ha_checksum crc= 0;
|
||||
uchar null_mask=256 - (1 << t->s->last_null_bit_pos);
|
||||
DBUG_ASSERT(t->s->last_null_bit_pos < 8);
|
||||
uchar null_mask= (t->s->last_null_bit_pos ?
|
||||
(256 - (1 << t->s->last_null_bit_pos)):
|
||||
0);
|
||||
|
||||
t->use_all_columns();
|
||||
|
||||
|
|
|
@ -15699,19 +15699,21 @@ subselect_end:
|
|||
lex->current_select = lex->current_select->return_after_parsing();
|
||||
lex->nest_level--;
|
||||
lex->current_select->n_child_sum_items += child->n_sum_items;
|
||||
/*
|
||||
A subselect can add fields to an outer select. Reserve space for
|
||||
them.
|
||||
*/
|
||||
lex->current_select->select_n_where_fields+=
|
||||
child->select_n_where_fields;
|
||||
|
||||
/*
|
||||
Aggregate functions in having clause may add fields to an outer
|
||||
select. Count them also.
|
||||
A subquery (and all the subsequent query blocks in a UNION) can
|
||||
add columns to an outer query block. Reserve space for them.
|
||||
Aggregate functions in having clause can also add fields to an
|
||||
outer select.
|
||||
*/
|
||||
lex->current_select->select_n_having_items+=
|
||||
child->select_n_having_items;
|
||||
for (SELECT_LEX *temp= child->master_unit()->first_select();
|
||||
temp != NULL; temp= temp->next_select())
|
||||
{
|
||||
lex->current_select->select_n_where_fields+=
|
||||
temp->select_n_where_fields;
|
||||
lex->current_select->select_n_having_items+=
|
||||
temp->select_n_having_items;
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
@ -219,11 +219,11 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR prefix, LPCSTR name, LPCSTR dir);
|
|||
DllExport BOOL PlugIsAbsolutePath(LPCSTR path);
|
||||
DllExport bool AllocSarea(PGLOBAL, uint);
|
||||
DllExport void FreeSarea(PGLOBAL);
|
||||
DllExport BOOL PlugSubSet(PGLOBAL, void *, uint);
|
||||
DllExport BOOL PlugSubSet(void *, uint);
|
||||
DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t);
|
||||
DllExport char *PlugDup(PGLOBAL g, const char *str);
|
||||
DllExport void *MakePtr(void *, OFFSET);
|
||||
DllExport void htrc(char const *fmt, ...);
|
||||
//DllExport int GetTraceValue(void);
|
||||
DllExport uint GetTraceValue(void);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
@ -233,6 +233,6 @@ DllExport uint GetTraceValue(void);
|
|||
/***********************************************************************/
|
||||
/* Non exported routine declarations. */
|
||||
/***********************************************************************/
|
||||
void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
|
||||
//void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
|
||||
|
||||
/*-------------------------- End of Global.H --------------------------*/
|
||||
|
|
|
@ -4191,7 +4191,7 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos)
|
|||
rc= rnd_next(buf);
|
||||
} else {
|
||||
PGLOBAL g = GetPlug((table) ? table->in_use : NULL, xp);
|
||||
strcpy(g->Message, "Not supported by this table type");
|
||||
// strcpy(g->Message, "Not supported by this table type");
|
||||
my_message(ER_ILLEGAL_HA, g->Message, MYF(0));
|
||||
rc= HA_ERR_INTERNAL_ERROR;
|
||||
} // endif SetRecpos
|
||||
|
@ -7307,7 +7307,7 @@ maria_declare_plugin(connect)
|
|||
PLUGIN_LICENSE_GPL,
|
||||
connect_init_func, /* Plugin Init */
|
||||
connect_done_func, /* Plugin Deinit */
|
||||
0x0107, /* version number (1.05) */
|
||||
0x0106, /* version number (1.06) */
|
||||
NULL, /* status variables */
|
||||
connect_system_variables, /* system variables */
|
||||
"1.06.0008", /* string version */
|
||||
|
|
|
@ -3055,7 +3055,7 @@ my_bool json_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
|||
|
||||
PGLOBAL g = (PGLOBAL)initid->ptr;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JAR);
|
||||
g->N = (int)n;
|
||||
return false;
|
||||
|
@ -3098,7 +3098,7 @@ void json_array_grp_clear(UDF_INIT *initid, char*, char*)
|
|||
{
|
||||
PGLOBAL g = (PGLOBAL)initid->ptr;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JAR);
|
||||
g->N = GetJsonGroupSize();
|
||||
} // end of json_array_grp_clear
|
||||
|
@ -3132,7 +3132,7 @@ my_bool json_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
|||
|
||||
PGLOBAL g = (PGLOBAL)initid->ptr;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JOB);
|
||||
g->N = (int)n;
|
||||
return false;
|
||||
|
@ -3169,7 +3169,7 @@ void json_object_grp_clear(UDF_INIT *initid, char*, char*)
|
|||
{
|
||||
PGLOBAL g = (PGLOBAL)initid->ptr;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JOB);
|
||||
g->N = GetJsonGroupSize();
|
||||
} // end of json_object_grp_clear
|
||||
|
@ -4418,7 +4418,7 @@ char *json_file(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||
} else if (initid->const_item)
|
||||
g->N = 1;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
fn = MakePSZ(g, args, 0);
|
||||
|
||||
if (args->arg_count > 1) {
|
||||
|
@ -5662,7 +5662,7 @@ char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||
if (bsp && !bsp->Changed)
|
||||
goto fin;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Xchk = NULL;
|
||||
fn = MakePSZ(g, args, 0);
|
||||
pretty = (args->arg_count > 2 && args->args[2]) ? (int)*(longlong*)args->args[2] : 3;
|
||||
|
|
|
@ -8,12 +8,19 @@ SELECT * FROM t2 WHERE command = 'drop table employee';
|
|||
command number message
|
||||
drop table employee 0 Execute: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
|
||||
|
||||
Warnings:
|
||||
Warning 1105 Execute: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
|
||||
|
||||
SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary number(8,2))';
|
||||
command number message
|
||||
create table employee (id int not null, name varchar(32), title char(16), salary number(8,2)) 0 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)";
|
||||
command number message
|
||||
insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
|
||||
CONNECTION='jdbc:oracle:thin:@localhost:1521:xe'
|
||||
OPTION_LIST='User=system,Password=manager';
|
||||
|
@ -27,8 +34,8 @@ OPTION_LIST='User=system,Password=manager';
|
|||
SELECT * FROM t1;
|
||||
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
|
||||
NULL SYSTEM EMPLOYEE ID 3 NUMBER 38 0 0 10 0 NULL
|
||||
NULL SYSTEM EMPLOYEE NAME 12 VARCHAR2 32 0 0 10 1 NULL
|
||||
NULL SYSTEM EMPLOYEE TITLE 1 CHAR 16 0 0 10 1 NULL
|
||||
NULL SYSTEM EMPLOYEE NAME 12 VARCHAR2 32 0 NULL 10 1 NULL
|
||||
NULL SYSTEM EMPLOYEE TITLE 1 CHAR 16 0 NULL 10 1 NULL
|
||||
NULL SYSTEM EMPLOYEE SALARY 3 NUMBER 8 0 2 10 1 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE SERVER 'oracle' FOREIGN DATA WRAPPER 'oracle.jdbc.driver.OracleDriver' OPTIONS (
|
||||
|
@ -52,7 +59,7 @@ Note 1105 EMPLOYEE: 1 affected rows
|
|||
SELECT * FROM t1;
|
||||
ID NAME TITLE SALARY
|
||||
4567 Trump Engineer 12560.50
|
||||
6214 Clinton Retired 0.00
|
||||
6214 Clinton Retired NULL
|
||||
DELETE FROM t1 WHERE id = 6214;
|
||||
Warnings:
|
||||
Note 1105 EMPLOYEE: 1 affected rows
|
||||
|
@ -63,8 +70,7 @@ DROP TABLE t1;
|
|||
SELECT * FROM t2 WHERE command = 'drop table employee';
|
||||
command number message
|
||||
drop table employee 0 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
DROP TABLE t2;
|
||||
DROP SERVER 'oracle';
|
||||
SET GLOBAL connect_jvm_path=NULL;
|
||||
SET GLOBAL connect_class_path=NULL;
|
||||
SET GLOBAL time_zone = SYSTEM;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar';
|
||||
SET GLOBAL connect_class_path='C:/MariaDB-10.0/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar';
|
||||
CREATE TABLE t2 (
|
||||
command varchar(128) not null,
|
||||
number int(5) not null flag=1,
|
||||
|
@ -9,12 +9,18 @@ OPTION_LIST='Execsrc=1';
|
|||
SELECT * FROM t2 WHERE command='drop table employee';
|
||||
command number message
|
||||
drop table employee 0 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas
|
||||
Warnings:
|
||||
Warning 1105 Execute: org.postgresql.util.PSQLException: ERREUR: la table « employee » n'existe pas
|
||||
SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2))';
|
||||
command number message
|
||||
create table employee (id int not null, name varchar(32), title char(16), salary decimal(8,2)) 0 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)";
|
||||
command number message
|
||||
insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
|
||||
CONNECTION='jdbc:postgresql://localhost/test?user=postgres&password=tinono'
|
||||
OPTION_LIST='Tabtype=TABLE,Maxres=10';
|
||||
|
@ -63,4 +69,6 @@ DROP SERVER 'postgresql';
|
|||
SELECT * FROM t2 WHERE command='drop table employee';
|
||||
command number message
|
||||
drop table employee 0 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
DROP TABLE t2;
|
||||
|
|
|
@ -23,7 +23,7 @@ id msg
|
|||
CREATE TABLE xt3 (
|
||||
id INT KEY NOT NULL,
|
||||
msg VARCHAR(32))
|
||||
ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10;
|
||||
ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=6;
|
||||
Warnings:
|
||||
Warning 1105 No file name. Table will use xt3.csv
|
||||
INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
|
||||
|
@ -92,7 +92,7 @@ id msg
|
|||
EXPLAIN PARTITIONS
|
||||
SELECT * FROM t1 WHERE id = 81;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 3 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t1 3 ALL NULL NULL NULL NULL 6 Using where
|
||||
DELETE FROM t1;
|
||||
Warnings:
|
||||
Note 1105 xt1: 4 affected rows
|
||||
|
|
|
@ -22,7 +22,7 @@ SELECT * FROM xt2;
|
|||
CREATE TABLE xt3 (
|
||||
id INT KEY NOT NULL,
|
||||
msg VARCHAR(32))
|
||||
ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10;
|
||||
ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=6;
|
||||
INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
|
||||
SELECT * FROM xt3;
|
||||
|
||||
|
|
|
@ -514,27 +514,31 @@ void FreeSarea(PGLOBAL g)
|
|||
/* Here there should be some verification done such as validity of */
|
||||
/* the address and size not larger than memory size. */
|
||||
/***********************************************************************/
|
||||
BOOL PlugSubSet(PGLOBAL g __attribute__((unused)), void *memp, uint size)
|
||||
BOOL PlugSubSet(void *memp, uint size)
|
||||
{
|
||||
PPOOLHEADER pph = (PPOOLHEADER)memp;
|
||||
|
||||
pph->To_Free = (OFFSET)sizeof(POOLHEADER);
|
||||
pph->FreeBlk = size - pph->To_Free;
|
||||
|
||||
return FALSE;
|
||||
} /* end of PlugSubSet */
|
||||
|
||||
/***********************************************************************/
|
||||
/* Use it to export a function that do throwing. */
|
||||
/***********************************************************************/
|
||||
void *DoThrow(int n)
|
||||
{
|
||||
throw n;
|
||||
} /* end of DoThrow */
|
||||
|
||||
/***********************************************************************/
|
||||
/* Program for sub-allocating one item in a storage area. */
|
||||
/* Note: SubAlloc routines of OS/2 are no more used to increase the */
|
||||
/* code portability and avoid problems when a grammar compiled under */
|
||||
/* one version of OS/2 is used under another version. */
|
||||
/* The simple way things are done here is also based on the fact */
|
||||
/* that no freeing of suballocated blocks is permitted in Plug. */
|
||||
/* The simple way things are done here is based on the fact */
|
||||
/* that no freeing of suballocated blocks is permitted in CONNECT. */
|
||||
/***********************************************************************/
|
||||
void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
|
||||
{
|
||||
PPOOLHEADER pph; /* Points on area header. */
|
||||
{
|
||||
PPOOLHEADER pph; /* Points on area header. */
|
||||
|
||||
if (!memp)
|
||||
/*******************************************************************/
|
||||
|
@ -559,8 +563,8 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
|
|||
if (trace(1))
|
||||
htrc("PlugSubAlloc: %s\n", g->Message);
|
||||
|
||||
throw 1234;
|
||||
} /* endif size OS32 code */
|
||||
DoThrow(1234);
|
||||
} /* endif size OS32 code */
|
||||
|
||||
/*********************************************************************/
|
||||
/* Do the suballocation the simplest way. */
|
||||
|
@ -574,7 +578,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
|
|||
memp, pph->To_Free, pph->FreeBlk);
|
||||
|
||||
return (memp);
|
||||
} /* end of PlugSubAlloc */
|
||||
} /* end of PlugSubAlloc */
|
||||
|
||||
/***********************************************************************/
|
||||
/* Program for sub-allocating and copying a string in a storage area. */
|
||||
|
|
|
@ -522,8 +522,15 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
|
|||
|
||||
// Get the function returning an instance of the external DEF class
|
||||
if (!(getdef = (XGETDEF)GetProcAddress((HINSTANCE)Hdll, getname))) {
|
||||
sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname);
|
||||
FreeLibrary((HMODULE)Hdll);
|
||||
char buf[256];
|
||||
DWORD rc = GetLastError();
|
||||
|
||||
sprintf(g->Message, MSG(PROCADD_ERROR), rc, getname);
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,
|
||||
(LPTSTR)buf, sizeof(buf), NULL);
|
||||
strcat(strcat(g->Message, ": "), buf);
|
||||
FreeLibrary((HMODULE)Hdll);
|
||||
return NULL;
|
||||
} // endif getdef
|
||||
#else // !__WIN__
|
||||
|
|
|
@ -13,7 +13,7 @@ typedef class TDBFMT *PTDBFMT;
|
|||
/***********************************************************************/
|
||||
/* Functions used externally. */
|
||||
/***********************************************************************/
|
||||
PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info);
|
||||
DllExport PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info);
|
||||
|
||||
/***********************************************************************/
|
||||
/* CSV table. */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/************* tabjson C++ Program Source Code File (.CPP) *************/
|
||||
/* PROGRAM NAME: tabjson Version 1.5 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */
|
||||
/* PROGRAM NAME: tabjson Version 1.6 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2018 */
|
||||
/* This program are the JSON class DB execution routines. */
|
||||
/***********************************************************************/
|
||||
|
||||
|
@ -173,6 +173,7 @@ JSONDISC::JSONDISC(PGLOBAL g, uint *lg)
|
|||
|
||||
int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
|
||||
{
|
||||
char filename[_MAX_PATH];
|
||||
bool mgo = (GetTypeID(topt->type) == TAB_MONGO);
|
||||
PCSZ level = GetStringTableOption(g, topt, "Level", NULL);
|
||||
|
||||
|
@ -209,6 +210,12 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
|
|||
return 0;
|
||||
} // endif Fn
|
||||
|
||||
if (tdp->Fn) {
|
||||
// We used the file name relative to recorded datapath
|
||||
PlugSetPath(filename, tdp->Fn, tdp->GetPath());
|
||||
tdp->Fn = PlugDup(g, filename);
|
||||
} // endif Fn
|
||||
|
||||
if (trace(1))
|
||||
htrc("File %s objname=%s pretty=%d lvl=%d\n",
|
||||
tdp->Fn, tdp->Objname, tdp->Pretty, lvl);
|
||||
|
@ -299,7 +306,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
|
|||
memset(G, 0, sizeof(GLOBAL));
|
||||
G->Sarea_Size = tdp->Lrecl * 10;
|
||||
G->Sarea = PlugSubAlloc(g, NULL, G->Sarea_Size);
|
||||
PlugSubSet(G, G->Sarea, G->Sarea_Size);
|
||||
PlugSubSet(G->Sarea, G->Sarea_Size);
|
||||
G->jump_level = 0;
|
||||
tjnp->SetG(G);
|
||||
|
||||
|
@ -342,7 +349,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
|
|||
strncpy(colname, jpp->GetKey(), 64);
|
||||
fmt[bf] = 0;
|
||||
|
||||
if (Find(g, jpp->GetVal(), MY_MIN(lvl, 0)))
|
||||
if (Find(g, jpp->GetVal(), colname, MY_MIN(lvl, 0)))
|
||||
goto err;
|
||||
|
||||
} // endfor jpp
|
||||
|
@ -385,7 +392,7 @@ err:
|
|||
return 0;
|
||||
} // end of GetColumns
|
||||
|
||||
bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
|
||||
bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j)
|
||||
{
|
||||
char *p, *pc = colname + strlen(colname);
|
||||
int ars;
|
||||
|
@ -413,12 +420,14 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
|
|||
job = (PJOB)jsp;
|
||||
|
||||
for (PJPR jrp = job->GetFirst(); jrp; jrp = jrp->GetNext()) {
|
||||
if (*jrp->GetKey() != '$') {
|
||||
strncat(strncat(fmt, sep, 128), jrp->GetKey(), 128);
|
||||
strncat(strncat(colname, "_", 64), jrp->GetKey(), 64);
|
||||
PCSZ k = jrp->GetKey();
|
||||
|
||||
if (*k != '$') {
|
||||
strncat(strncat(fmt, sep, 128), k, 128);
|
||||
strncat(strncat(colname, "_", 64), k, 64);
|
||||
} // endif Key
|
||||
|
||||
if (Find(g, jrp->GetVal(), j + 1))
|
||||
if (Find(g, jrp->GetVal(), k, j + 1))
|
||||
return true;
|
||||
|
||||
*p = *pc = 0;
|
||||
|
@ -428,13 +437,13 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
|
|||
case TYPE_JAR:
|
||||
jar = (PJAR)jsp;
|
||||
|
||||
if (all || (tdp->Xcol && !stricmp(tdp->Xcol, colname)))
|
||||
if (all || (tdp->Xcol && !stricmp(tdp->Xcol, key)))
|
||||
ars = jar->GetSize(false);
|
||||
else
|
||||
ars = MY_MIN(jar->GetSize(false), 1);
|
||||
|
||||
for (int k = 0; k < ars; k++) {
|
||||
if (!tdp->Xcol || stricmp(tdp->Xcol, colname)) {
|
||||
if (!tdp->Xcol || stricmp(tdp->Xcol, key)) {
|
||||
sprintf(buf, "%d", k);
|
||||
|
||||
if (tdp->Uri)
|
||||
|
@ -448,7 +457,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
|
|||
} else
|
||||
strncat(fmt, (tdp->Uri ? sep : "[*]"), 128);
|
||||
|
||||
if (Find(g, jar->GetValue(k), j))
|
||||
if (Find(g, jar->GetValue(k), "", j))
|
||||
return true;
|
||||
|
||||
*p = *pc = 0;
|
||||
|
@ -522,7 +531,9 @@ void JSONDISC::AddColumn(PGLOBAL g)
|
|||
n++;
|
||||
} // endif jcp
|
||||
|
||||
pjcp = jcp;
|
||||
if (jcp)
|
||||
pjcp = jcp;
|
||||
|
||||
} // end of AddColumn
|
||||
|
||||
|
||||
|
@ -549,7 +560,7 @@ JSONDEF::JSONDEF(void)
|
|||
/***********************************************************************/
|
||||
/* DefineAM: define specific AM block values. */
|
||||
/***********************************************************************/
|
||||
bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
|
||||
bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
Schema = GetStringCatInfo(g, "DBname", Schema);
|
||||
Jmode = (JMODE)GetIntCatInfo("Jmode", MODE_OBJECT);
|
||||
|
@ -561,7 +572,8 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
|
|||
Sep = *GetStringCatInfo(g, "Separator", ".");
|
||||
Accept = GetBoolCatInfo("Accept", false);
|
||||
|
||||
if (Uri = GetStringCatInfo(g, "Connect", NULL)) {
|
||||
// Don't use url as uri when called from REST OEM module
|
||||
if (stricmp(am, "REST") && (Uri = GetStringCatInfo(g, "Connect", NULL))) {
|
||||
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
|
||||
Collname = GetStringCatInfo(g, "Name",
|
||||
(Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
|
||||
|
@ -670,7 +682,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
|
|||
memset(G, 0, sizeof(GLOBAL));
|
||||
G->Sarea_Size = Lrecl * 10;
|
||||
G->Sarea = PlugSubAlloc(g, NULL, G->Sarea_Size);
|
||||
PlugSubSet(G, G->Sarea, G->Sarea_Size);
|
||||
PlugSubSet(G->Sarea, G->Sarea_Size);
|
||||
G->jump_level = 0;
|
||||
((TDBJSN*)tdbp)->G = G;
|
||||
} else {
|
||||
|
@ -963,7 +975,7 @@ int TDBJSN::ReadDB(PGLOBAL g)
|
|||
return rc;
|
||||
|
||||
// Recover the memory used for parsing
|
||||
PlugSubSet(G, G->Sarea, G->Sarea_Size);
|
||||
PlugSubSet(G->Sarea, G->Sarea_Size);
|
||||
|
||||
if ((Row = ParseJson(G, To_Line, strlen(To_Line), &Pretty, &Comma))) {
|
||||
Row = FindRow(g);
|
||||
|
@ -1079,13 +1091,13 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
|
|||
} // end of PrepareWriting
|
||||
|
||||
/***********************************************************************/
|
||||
/* WriteDB: Data Base write routine for DOS access method. */
|
||||
/* WriteDB: Data Base write routine for JSON access method. */
|
||||
/***********************************************************************/
|
||||
int TDBJSN::WriteDB(PGLOBAL g)
|
||||
{
|
||||
int rc = TDBDOS::WriteDB(g);
|
||||
|
||||
PlugSubSet(G, G->Sarea, G->Sarea_Size);
|
||||
PlugSubSet(G->Sarea, G->Sarea_Size);
|
||||
Row->Clear();
|
||||
return rc;
|
||||
} // end of WriteDB
|
||||
|
@ -2340,7 +2352,7 @@ void TDBJSON::CloseDB(PGLOBAL g)
|
|||
TDBJCL::TDBJCL(PJDEF tdp) : TDBCAT(tdp)
|
||||
{
|
||||
Topt = tdp->GetTopt();
|
||||
Db = tdp->Schema;
|
||||
Db = tdp->Schema;
|
||||
Dsn = tdp->Uri;
|
||||
} // end of TDBJCL constructor
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*************** tabjson H Declares Source Code File (.H) **************/
|
||||
/* Name: tabjson.h Version 1.3 */
|
||||
/* */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2018 */
|
||||
/* */
|
||||
/* This file contains the JSON classes declares. */
|
||||
/***********************************************************************/
|
||||
#include "osutil.h"
|
||||
//#include "osutil.h" // Unuseful and bad for OEM
|
||||
#include "block.h"
|
||||
#include "colblk.h"
|
||||
#include "json.h"
|
||||
|
@ -16,7 +16,7 @@ typedef class JSONDEF *PJDEF;
|
|||
typedef class TDBJSON *PJTDB;
|
||||
typedef class JSONCOL *PJCOL;
|
||||
class TDBJSN;
|
||||
PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info);
|
||||
DllExport PQRYRES JSONColumns(PGLOBAL, PCSZ, PCSZ, PTOS, bool);
|
||||
|
||||
/***********************************************************************/
|
||||
/* The JSON tree node. Can be an Object or an Array. */
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
// Functions
|
||||
int GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt);
|
||||
bool Find(PGLOBAL g, PJVAL jvp, int j);
|
||||
bool Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j);
|
||||
void AddColumn(PGLOBAL g);
|
||||
|
||||
// Members
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* */
|
||||
/* COPYRIGHT: */
|
||||
/* ---------- */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2000-2017 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2000-2018 */
|
||||
/* */
|
||||
/* WHAT THIS PROGRAM DOES: */
|
||||
/* ----------------------- */
|
||||
|
@ -95,23 +95,23 @@ bool ExactInfo(void);
|
|||
/* Constructor. */
|
||||
/***********************************************************************/
|
||||
ODBCDEF::ODBCDEF(void)
|
||||
{
|
||||
{
|
||||
Connect = NULL;
|
||||
Catver = 0;
|
||||
UseCnc = false;
|
||||
} // end of ODBCDEF constructor
|
||||
} // end of ODBCDEF constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* DefineAM: define specific AM block values from XDB file. */
|
||||
/***********************************************************************/
|
||||
bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
{
|
||||
Desc = Connect = GetStringCatInfo(g, "Connect", NULL);
|
||||
|
||||
if (!Connect && !Catfunc) {
|
||||
sprintf(g->Message, "Missing connection for ODBC table %s", Name);
|
||||
return true;
|
||||
} // endif Connect
|
||||
} // endif Connect
|
||||
|
||||
if (EXTDEF::DefineAM(g, am, poff))
|
||||
return true;
|
||||
|
@ -123,13 +123,13 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
|||
Qto= GetIntCatInfo("QueryTimeout", DEFAULT_QUERY_TIMEOUT);
|
||||
UseCnc = GetBoolCatInfo("UseDSN", false);
|
||||
return false;
|
||||
} // end of DefineAM
|
||||
} // end of DefineAM
|
||||
|
||||
/***********************************************************************/
|
||||
/* GetTable: makes a new Table Description Block. */
|
||||
/***********************************************************************/
|
||||
PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
|
||||
{
|
||||
{
|
||||
PTDB tdbp = NULL;
|
||||
|
||||
/*********************************************************************/
|
||||
|
@ -158,10 +158,10 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
|
|||
tdbp = new(g) TDBMUL(tdbp);
|
||||
else if (Multiple == 2)
|
||||
strcpy(g->Message, MSG(NO_ODBC_MUL));
|
||||
} // endswitch Catfunc
|
||||
} // endswitch Catfunc
|
||||
|
||||
return tdbp;
|
||||
} // end of GetTable
|
||||
} // end of GetTable
|
||||
|
||||
/* -------------------------- Class TDBODBC -------------------------- */
|
||||
|
||||
|
@ -169,7 +169,7 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
|
|||
/* Implementation of the TDBODBC class. */
|
||||
/***********************************************************************/
|
||||
TDBODBC::TDBODBC(PODEF tdp) : TDBEXT(tdp)
|
||||
{
|
||||
{
|
||||
Ocp = NULL;
|
||||
Cnp = NULL;
|
||||
|
||||
|
@ -191,19 +191,19 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBEXT(tdp)
|
|||
Ops.UseCnc = false;
|
||||
} // endif tdp
|
||||
|
||||
} // end of TDBODBC standard constructor
|
||||
} // end of TDBODBC standard constructor
|
||||
|
||||
TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBEXT(tdbp)
|
||||
{
|
||||
{
|
||||
Ocp = tdbp->Ocp; // is that right ?
|
||||
Cnp = tdbp->Cnp;
|
||||
Connect = tdbp->Connect;
|
||||
Ops = tdbp->Ops;
|
||||
} // end of TDBODBC copy constructor
|
||||
} // end of TDBODBC copy constructor
|
||||
|
||||
// Method
|
||||
PTDB TDBODBC::Clone(PTABS t)
|
||||
{
|
||||
{
|
||||
PTDB tp;
|
||||
PODBCCOL cp1, cp2;
|
||||
PGLOBAL g = t->G; // Is this really useful ???
|
||||
|
@ -213,18 +213,18 @@ PTDB TDBODBC::Clone(PTABS t)
|
|||
for (cp1 = (PODBCCOL)Columns; cp1; cp1 = (PODBCCOL)cp1->GetNext()) {
|
||||
cp2 = new(g) ODBCCOL(cp1, tp); // Make a copy
|
||||
NewPointer(t, cp1, cp2);
|
||||
} // endfor cp1
|
||||
} // endfor cp1
|
||||
|
||||
return tp;
|
||||
} // end of CopyOne
|
||||
} // end of CopyOne
|
||||
|
||||
/***********************************************************************/
|
||||
/* Allocate ODBC column description block. */
|
||||
/***********************************************************************/
|
||||
PCOL TDBODBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
|
||||
{
|
||||
{
|
||||
return new(g) ODBCCOL(cdp, this, cprec, n);
|
||||
} // end of MakeCol
|
||||
} // end of MakeCol
|
||||
|
||||
/***********************************************************************/
|
||||
/* Extract the filename from connect string and return it. */
|
||||
|
@ -232,7 +232,7 @@ PCOL TDBODBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
|
|||
/* with a place holder to be used by SetFile. */
|
||||
/***********************************************************************/
|
||||
PCSZ TDBODBC::GetFile(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (Connect) {
|
||||
char *p1, *p2;
|
||||
int i;
|
||||
|
@ -263,18 +263,18 @@ PCSZ TDBODBC::GetFile(PGLOBAL g)
|
|||
memcpy(MulConn, Connect, p1 - Connect);
|
||||
MulConn[p1 - Connect] = '\0';
|
||||
strcat(strcat(MulConn, "%s"), (p2) ? p2 : ";");
|
||||
} // endif p1
|
||||
} // endif p1
|
||||
|
||||
} // endif Connect
|
||||
} // endif Connect
|
||||
|
||||
return (DBQ) ? DBQ : (PSZ)"???";
|
||||
} // end of GetFile
|
||||
} // end of GetFile
|
||||
|
||||
/***********************************************************************/
|
||||
/* Set DBQ and get the new file name into the connect string. */
|
||||
/***********************************************************************/
|
||||
void TDBODBC::SetFile(PGLOBAL g, PCSZ fn)
|
||||
{
|
||||
{
|
||||
if (MulConn) {
|
||||
int n = strlen(MulConn) + strlen(fn) - 1;
|
||||
|
||||
|
@ -283,20 +283,20 @@ void TDBODBC::SetFile(PGLOBAL g, PCSZ fn)
|
|||
// of having to reallocate it is reduced.
|
||||
BufSize = n + 6;
|
||||
Connect = (char*)PlugSubAlloc(g, NULL, BufSize);
|
||||
} // endif n
|
||||
} // endif n
|
||||
|
||||
// Make the complete connect string
|
||||
sprintf(Connect, MulConn, fn);
|
||||
} // endif MultConn
|
||||
} // endif MultConn
|
||||
|
||||
DBQ = PlugDup(g, fn);
|
||||
} // end of SetFile
|
||||
} // end of SetFile
|
||||
|
||||
/***********************************************************************/
|
||||
/* MakeInsert: make the Insert statement used with ODBC connection. */
|
||||
/***********************************************************************/
|
||||
bool TDBODBC::MakeInsert(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PCSZ schmp = NULL;
|
||||
char *catp = NULL, buf[NAM_LEN * 3];
|
||||
int len = 0;
|
||||
|
@ -377,7 +377,7 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
|
|||
} else
|
||||
Query->Append(buf);
|
||||
|
||||
} // endfor colp
|
||||
} // endfor colp
|
||||
|
||||
Query->Append(") VALUES (");
|
||||
|
||||
|
@ -390,32 +390,32 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
|
|||
Query->RepLast(')');
|
||||
|
||||
return oom;
|
||||
} // end of MakeInsert
|
||||
} // end of MakeInsert
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBC Bind Parameter function. */
|
||||
/***********************************************************************/
|
||||
bool TDBODBC::BindParameters(PGLOBAL g)
|
||||
{
|
||||
PODBCCOL colp;
|
||||
{
|
||||
PODBCCOL colp;
|
||||
|
||||
for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) {
|
||||
colp->AllocateBuffers(g, 0);
|
||||
for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) {
|
||||
colp->AllocateBuffers(g, 0);
|
||||
|
||||
if (Ocp->BindParam(colp))
|
||||
return true;
|
||||
if (Ocp->BindParam(colp))
|
||||
return true;
|
||||
|
||||
} // endfor colp
|
||||
} // endfor colp
|
||||
|
||||
return false;
|
||||
} // end of BindParameters
|
||||
return false;
|
||||
} // end of BindParameters
|
||||
|
||||
#if 0
|
||||
/***********************************************************************/
|
||||
/* MakeUpdate: make the SQL statement to send to ODBC connection. */
|
||||
/***********************************************************************/
|
||||
char *TDBODBC::MakeUpdate(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
char *qc, *stmt = NULL, cmd[8], tab[96], end[1024];
|
||||
|
||||
stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
|
||||
|
@ -440,60 +440,60 @@ char *TDBODBC::MakeUpdate(PGLOBAL g)
|
|||
|
||||
strcat(stmt, end);
|
||||
return stmt;
|
||||
} // end of MakeUpdate
|
||||
} // end of MakeUpdate
|
||||
|
||||
/***********************************************************************/
|
||||
/* MakeDelete: make the SQL statement to send to ODBC connection. */
|
||||
/***********************************************************************/
|
||||
char *TDBODBC::MakeDelete(PGLOBAL g)
|
||||
{
|
||||
char *qc, *stmt = NULL, cmd[8], from[8], tab[96], end[512];
|
||||
{
|
||||
char *qc, *stmt = NULL, cmd[8], from[8], tab[96], end[512];
|
||||
|
||||
stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
|
||||
memset(end, 0, sizeof(end));
|
||||
stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
|
||||
memset(end, 0, sizeof(end));
|
||||
|
||||
if (sscanf(Qrystr, "%s %s `%[^`]`%511c", cmd, from, tab, end) > 2 ||
|
||||
sscanf(Qrystr, "%s %s \"%[^\"]\"%511c", cmd, from, tab, end) > 2)
|
||||
qc = Ocp->GetQuoteChar();
|
||||
else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2)
|
||||
qc = (Quoted) ? Quote : "";
|
||||
else {
|
||||
strcpy(g->Message, "Cannot use this DELETE command");
|
||||
return NULL;
|
||||
} // endif sscanf
|
||||
if (sscanf(Qrystr, "%s %s `%[^`]`%511c", cmd, from, tab, end) > 2 ||
|
||||
sscanf(Qrystr, "%s %s \"%[^\"]\"%511c", cmd, from, tab, end) > 2)
|
||||
qc = Ocp->GetQuoteChar();
|
||||
else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2)
|
||||
qc = (Quoted) ? Quote : "";
|
||||
else {
|
||||
strcpy(g->Message, "Cannot use this DELETE command");
|
||||
return NULL;
|
||||
} // endif sscanf
|
||||
|
||||
assert(!stricmp(cmd, "delete") && !stricmp(from, "from"));
|
||||
strcat(strcat(strcat(strcpy(stmt, "DELETE FROM "), qc), TableName), qc);
|
||||
assert(!stricmp(cmd, "delete") && !stricmp(from, "from"));
|
||||
strcat(strcat(strcat(strcpy(stmt, "DELETE FROM "), qc), TableName), qc);
|
||||
|
||||
if (*end) {
|
||||
for (int i = 0; end[i]; i++)
|
||||
if (end[i] == '`')
|
||||
end[i] = *qc;
|
||||
if (*end) {
|
||||
for (int i = 0; end[i]; i++)
|
||||
if (end[i] == '`')
|
||||
end[i] = *qc;
|
||||
|
||||
strcat(stmt, end);
|
||||
} // endif end
|
||||
strcat(stmt, end);
|
||||
} // endif end
|
||||
|
||||
return stmt;
|
||||
} // end of MakeDelete
|
||||
return stmt;
|
||||
} // end of MakeDelete
|
||||
#endif // 0
|
||||
|
||||
/***********************************************************************/
|
||||
/* ResetSize: call by TDBMUL when calculating size estimate. */
|
||||
/***********************************************************************/
|
||||
void TDBODBC::ResetSize(void)
|
||||
{
|
||||
{
|
||||
MaxSize = -1;
|
||||
|
||||
if (Ocp && Ocp->IsOpen())
|
||||
Ocp->Close();
|
||||
|
||||
} // end of ResetSize
|
||||
} // end of ResetSize
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBC Cardinality: returns table size in number of rows. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::Cardinality(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (!g)
|
||||
return (Mode == MODE_ANY && !Srcdef) ? 1 : 0;
|
||||
|
||||
|
@ -526,7 +526,7 @@ int TDBODBC::Cardinality(PGLOBAL g)
|
|||
Cardinal = 10; // To make MySQL happy
|
||||
|
||||
return Cardinal;
|
||||
} // end of Cardinality
|
||||
} // end of Cardinality
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBC Access Method opening routine. */
|
||||
|
@ -535,7 +535,7 @@ int TDBODBC::Cardinality(PGLOBAL g)
|
|||
/* join block of next table if it exists or else are discarted. */
|
||||
/***********************************************************************/
|
||||
bool TDBODBC::OpenDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
bool rc = true;
|
||||
|
||||
if (trace(1))
|
||||
|
@ -571,7 +571,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
|||
Fpos = 0;
|
||||
Curpos = 1;
|
||||
return false;
|
||||
} // endif use
|
||||
} // endif use
|
||||
|
||||
/*********************************************************************/
|
||||
/* Open an ODBC connection for this table. */
|
||||
|
@ -593,7 +593,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
|||
Use = USE_OPEN; // Do it now in case we are recursively called
|
||||
|
||||
/*********************************************************************/
|
||||
/* Make the command and allocate whatever is used for getting results. */
|
||||
/* Make the command and allocate whatever is used for getting results*/
|
||||
/*********************************************************************/
|
||||
if (Mode == MODE_READ || Mode == MODE_READX) {
|
||||
if (Memory > 1 && !Srcdef) {
|
||||
|
@ -624,7 +624,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
|||
} else
|
||||
return true;
|
||||
|
||||
} // endif Memory
|
||||
} // endif Memory
|
||||
|
||||
if (!(rc = MakeSQL(g, false))) {
|
||||
for (PODBCCOL colp = (PODBCCOL)Columns; colp;
|
||||
|
@ -635,7 +635,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
|||
rc = (Mode == MODE_READ)
|
||||
? ((Rows = Ocp->ExecDirectSQL(Query->GetStr(), (PODBCCOL)Columns)) < 0)
|
||||
: false;
|
||||
} // endif rc
|
||||
} // endif rc
|
||||
|
||||
} else if (Mode == MODE_INSERT) {
|
||||
if (!(rc = MakeInsert(g))) {
|
||||
|
@ -645,7 +645,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
|||
} else
|
||||
rc = BindParameters(g);
|
||||
|
||||
} // endif rc
|
||||
} // endif rc
|
||||
|
||||
} else if (Mode == MODE_UPDATE || Mode == MODE_DELETE) {
|
||||
rc = false; // wait for CheckCond before calling MakeCommand(g);
|
||||
|
@ -655,30 +655,30 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
|||
if (rc) {
|
||||
Ocp->Close();
|
||||
return true;
|
||||
} // endif rc
|
||||
} // endif rc
|
||||
|
||||
/*********************************************************************/
|
||||
/* Reset statistics values. */
|
||||
/*********************************************************************/
|
||||
num_read = num_there = num_eq[0] = num_eq[1] = 0;
|
||||
return false;
|
||||
} // end of OpenDB
|
||||
} // end of OpenDB
|
||||
|
||||
#if 0
|
||||
/***********************************************************************/
|
||||
/* GetRecpos: return the position of last read record. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::GetRecpos(void)
|
||||
{
|
||||
{
|
||||
return Fpos;
|
||||
} // end of GetRecpos
|
||||
} // end of GetRecpos
|
||||
#endif // 0
|
||||
|
||||
/***********************************************************************/
|
||||
/* SetRecpos: set the position of next read record. */
|
||||
/***********************************************************************/
|
||||
bool TDBODBC::SetRecpos(PGLOBAL g, int recpos)
|
||||
{
|
||||
{
|
||||
if (Ocp->m_Full) {
|
||||
Fpos = 0;
|
||||
CurNum = recpos - 1;
|
||||
|
@ -696,14 +696,15 @@ bool TDBODBC::SetRecpos(PGLOBAL g, int recpos)
|
|||
} // endif recpos
|
||||
|
||||
} else {
|
||||
strcpy(g->Message, "This action requires a scrollable cursor");
|
||||
strcpy(g->Message,
|
||||
"This action requires Memory setting or a scrollable cursor");
|
||||
return true;
|
||||
} // endif's
|
||||
|
||||
// Indicate the table position was externally set
|
||||
Placed = true;
|
||||
return false;
|
||||
} // end of SetRecpos
|
||||
} // end of SetRecpos
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base indexed read routine for ODBC access method. */
|
||||
|
@ -721,7 +722,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
|
|||
Rows = Ocp->ExecDirectSQL((char*)Query->GetStr(), (PODBCCOL)Columns);
|
||||
Mode = MODE_READ;
|
||||
return (Rows < 0);
|
||||
} // endif key
|
||||
} // endif key
|
||||
|
||||
return false;
|
||||
} else {
|
||||
|
@ -737,7 +738,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
|
|||
if ((To_CondFil = hc->CheckCond(g, To_CondFil, Cond)))
|
||||
PlugSubAlloc(g, NULL, strlen(To_CondFil->Body) + 1);
|
||||
|
||||
} // endif active_index
|
||||
} // endif active_index
|
||||
|
||||
if (To_CondFil)
|
||||
if (Query->Append(" AND ") || Query->Append(To_CondFil->Body)) {
|
||||
|
@ -762,7 +763,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
|
|||
/* VRDNDOS: Data Base read routine for odbc access method. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::ReadDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (trace(2))
|
||||
|
@ -784,7 +785,7 @@ int TDBODBC::ReadDB(PGLOBAL g)
|
|||
} else
|
||||
return RC_FX; // Error
|
||||
|
||||
} // endif Mode
|
||||
} // endif Mode
|
||||
|
||||
/*********************************************************************/
|
||||
/* Now start the reading process. */
|
||||
|
@ -813,7 +814,7 @@ int TDBODBC::ReadDB(PGLOBAL g)
|
|||
Qrp->Nblin++;
|
||||
|
||||
Fpos++; // Used for memory and pos
|
||||
} // endif rc
|
||||
} // endif rc
|
||||
|
||||
} // endif Placed
|
||||
|
||||
|
@ -821,13 +822,13 @@ int TDBODBC::ReadDB(PGLOBAL g)
|
|||
htrc(" Read: Rbuf=%d rc=%d\n", Rbuf, rc);
|
||||
|
||||
return rc;
|
||||
} // end of ReadDB
|
||||
} // end of ReadDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base Insert write routine for ODBC access method. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::WriteDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
int n = Ocp->ExecuteSQL();
|
||||
|
||||
if (n < 0) {
|
||||
|
@ -837,13 +838,13 @@ int TDBODBC::WriteDB(PGLOBAL g)
|
|||
AftRows += n;
|
||||
|
||||
return RC_OK;
|
||||
} // end of WriteDB
|
||||
} // end of WriteDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base delete line routine for ODBC access method. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::DeleteDB(PGLOBAL g, int irc)
|
||||
{
|
||||
{
|
||||
if (irc == RC_FX) {
|
||||
if (!Query && MakeCommand(g))
|
||||
return RC_FX;
|
||||
|
@ -863,13 +864,13 @@ int TDBODBC::DeleteDB(PGLOBAL g, int irc)
|
|||
} else
|
||||
return RC_OK; // Ignore
|
||||
|
||||
} // end of DeleteDB
|
||||
} // end of DeleteDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base close routine for ODBC access method. */
|
||||
/***********************************************************************/
|
||||
void TDBODBC::CloseDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (Ocp)
|
||||
|
||||
Ocp->Close();
|
||||
|
@ -877,7 +878,7 @@ void TDBODBC::CloseDB(PGLOBAL g)
|
|||
if (trace(1))
|
||||
htrc("ODBC CloseDB: closing %s\n", Name);
|
||||
|
||||
} // end of CloseDB
|
||||
} // end of CloseDB
|
||||
|
||||
/* --------------------------- ODBCCOL ------------------------------- */
|
||||
|
||||
|
@ -886,33 +887,33 @@ void TDBODBC::CloseDB(PGLOBAL g)
|
|||
/***********************************************************************/
|
||||
ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am)
|
||||
: EXTCOL(cdp, tdbp, cprec, i, am)
|
||||
{
|
||||
{
|
||||
// Set additional ODBC access method information for column.
|
||||
Slen = 0;
|
||||
StrLen = &Slen;
|
||||
Sqlbuf = NULL;
|
||||
} // end of ODBCCOL constructor
|
||||
} // end of ODBCCOL constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBCCOL private constructor. */
|
||||
/***********************************************************************/
|
||||
ODBCCOL::ODBCCOL(void) : EXTCOL()
|
||||
{
|
||||
{
|
||||
Slen = 0;
|
||||
StrLen = &Slen;
|
||||
Sqlbuf = NULL;
|
||||
} // end of ODBCCOL constructor
|
||||
} // end of ODBCCOL constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBCCOL constructor used for copying columns. */
|
||||
/* tdbp is the pointer to the new table descriptor. */
|
||||
/***********************************************************************/
|
||||
ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
|
||||
{
|
||||
{
|
||||
Slen = col1->Slen;
|
||||
StrLen = col1->StrLen;
|
||||
Sqlbuf = col1->Sqlbuf;
|
||||
} // end of ODBCCOL copy constructor
|
||||
} // end of ODBCCOL copy constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* ReadColumn: when SQLFetch is used there is nothing to do as the */
|
||||
|
@ -920,7 +921,7 @@ ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
|
|||
/* when calculating MaxSize (Bufp is NULL even when Rows is not). */
|
||||
/***********************************************************************/
|
||||
void ODBCCOL::ReadColumn(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PTDBODBC tdbp = (PTDBODBC)To_Tdb;
|
||||
int i = tdbp->Fpos - 1, n = tdbp->CurNum;
|
||||
|
||||
|
@ -953,7 +954,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
|
|||
else
|
||||
Value->SetValue_pvblk(Blkp, n);
|
||||
|
||||
} // endif Bufp
|
||||
} // endif Bufp
|
||||
|
||||
if (Buf_Type == TYPE_DATE) {
|
||||
struct tm dbtime;
|
||||
|
@ -980,7 +981,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
|
|||
|
||||
htrc("ODBC Column %s: rows=%d buf=%p type=%d value=%s\n",
|
||||
Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf));
|
||||
} // endif trace
|
||||
} // endif trace
|
||||
|
||||
put:
|
||||
if (tdbp->Memory != 2)
|
||||
|
@ -997,7 +998,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
|
|||
} else
|
||||
Crp->Kdata->SetValue(Value, i);
|
||||
|
||||
} // end of ReadColumn
|
||||
} // end of ReadColumn
|
||||
|
||||
/***********************************************************************/
|
||||
/* AllocateBuffers: allocate the extended buffer for SQLExtendedFetch */
|
||||
|
@ -1005,7 +1006,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
|
|||
/* for the ending null character. */
|
||||
/***********************************************************************/
|
||||
void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows)
|
||||
{
|
||||
{
|
||||
if (Buf_Type == TYPE_DATE)
|
||||
Sqlbuf = (TIMESTAMP_STRUCT*)PlugSubAlloc(g, NULL,
|
||||
sizeof(TIMESTAMP_STRUCT));
|
||||
|
@ -1019,31 +1020,31 @@ void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows)
|
|||
Blkp = AllocValBlock(g, NULL, Buf_Type, rows, GetBuflen(),
|
||||
GetScale(), true, false, false);
|
||||
Bufp = Blkp->GetValPointer();
|
||||
} // endelse
|
||||
} // endelse
|
||||
|
||||
if (rows > 1)
|
||||
StrLen = (SQLLEN *)PlugSubAlloc(g, NULL, rows * sizeof(SQLLEN));
|
||||
|
||||
} // end of AllocateBuffers
|
||||
} // end of AllocateBuffers
|
||||
|
||||
/***********************************************************************/
|
||||
/* Returns the buffer to use for Fetch or Extended Fetch. */
|
||||
/***********************************************************************/
|
||||
void *ODBCCOL::GetBuffer(DWORD rows)
|
||||
{
|
||||
{
|
||||
if (rows && To_Tdb) {
|
||||
assert(rows == (DWORD)((TDBODBC*)To_Tdb)->Rows);
|
||||
return Bufp;
|
||||
} else
|
||||
return (Buf_Type == TYPE_DATE) ? Sqlbuf : Value->GetTo_Val();
|
||||
|
||||
} // end of GetBuffer
|
||||
} // end of GetBuffer
|
||||
|
||||
/***********************************************************************/
|
||||
/* Returns the buffer length to use for Fetch or Extended Fetch. */
|
||||
/***********************************************************************/
|
||||
SWORD ODBCCOL::GetBuflen(void)
|
||||
{
|
||||
{
|
||||
SWORD flen;
|
||||
|
||||
switch (Buf_Type) {
|
||||
|
@ -1059,13 +1060,13 @@ SWORD ODBCCOL::GetBuflen(void)
|
|||
} // endswitch Buf_Type
|
||||
|
||||
return flen;
|
||||
} // end of GetBuflen
|
||||
} // end of GetBuflen
|
||||
|
||||
/***********************************************************************/
|
||||
/* WriteColumn: make sure the bind buffer is updated. */
|
||||
/***********************************************************************/
|
||||
void ODBCCOL::WriteColumn(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
/*********************************************************************/
|
||||
/* Do convert the column value if necessary. */
|
||||
/*********************************************************************/
|
||||
|
@ -1095,7 +1096,7 @@ void ODBCCOL::WriteColumn(PGLOBAL g)
|
|||
*StrLen = (Value->IsNull()) ? SQL_NULL_DATA :
|
||||
(IsTypeChar(Buf_Type)) ? SQL_NTS : 0;
|
||||
|
||||
} // end of WriteColumn
|
||||
} // end of WriteColumn
|
||||
|
||||
/* -------------------------- Class TDBXDBC -------------------------- */
|
||||
|
||||
|
@ -1119,7 +1120,7 @@ TDBXDBC::TDBXDBC(PTDBXDBC tdbp) : TDBODBC(tdbp)
|
|||
} // end of TDBXDBC copy constructor
|
||||
|
||||
PTDB TDBXDBC::Clone(PTABS t)
|
||||
{
|
||||
{
|
||||
PTDB tp;
|
||||
PXSRCCOL cp1, cp2;
|
||||
PGLOBAL g = t->G; // Is this really useful ???
|
||||
|
@ -1129,29 +1130,29 @@ PTDB TDBXDBC::Clone(PTABS t)
|
|||
for (cp1 = (PXSRCCOL)Columns; cp1; cp1 = (PXSRCCOL)cp1->GetNext()) {
|
||||
cp2 = new(g) XSRCCOL(cp1, tp); // Make a copy
|
||||
NewPointer(t, cp1, cp2);
|
||||
} // endfor cp1
|
||||
} // endfor cp1
|
||||
|
||||
return tp;
|
||||
} // end of CopyOne
|
||||
} // end of CopyOne
|
||||
|
||||
/***********************************************************************/
|
||||
/* Allocate XSRC column description block. */
|
||||
/***********************************************************************/
|
||||
PCOL TDBXDBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
|
||||
{
|
||||
{
|
||||
PXSRCCOL colp = new(g) XSRCCOL(cdp, this, cprec, n);
|
||||
|
||||
if (!colp->Flag)
|
||||
Cmdcol = colp->GetName();
|
||||
|
||||
return colp;
|
||||
} // end of MakeCol
|
||||
} // end of MakeCol
|
||||
|
||||
/***********************************************************************/
|
||||
/* MakeCMD: make the SQL statement to send to ODBC connection. */
|
||||
/***********************************************************************/
|
||||
PCMD TDBXDBC::MakeCMD(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PCMD xcmd = NULL;
|
||||
|
||||
if (To_CondFil) {
|
||||
|
@ -1171,14 +1172,14 @@ PCMD TDBXDBC::MakeCMD(PGLOBAL g)
|
|||
xcmd = new(g) CMD(g, Srcdef);
|
||||
|
||||
return xcmd;
|
||||
} // end of MakeCMD
|
||||
} // end of MakeCMD
|
||||
|
||||
#if 0
|
||||
/***********************************************************************/
|
||||
/* ODBC Bind Parameter function. */
|
||||
/***********************************************************************/
|
||||
bool TDBXDBC::BindParameters(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PODBCCOL colp;
|
||||
|
||||
for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) {
|
||||
|
@ -1190,19 +1191,19 @@ bool TDBXDBC::BindParameters(PGLOBAL g)
|
|||
} // endfor colp
|
||||
|
||||
return false;
|
||||
} // end of BindParameters
|
||||
} // end of BindParameters
|
||||
#endif // 0
|
||||
|
||||
/***********************************************************************/
|
||||
/* XDBC GetMaxSize: returns table size (not always one row). */
|
||||
/***********************************************************************/
|
||||
int TDBXDBC::GetMaxSize(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (MaxSize < 0)
|
||||
MaxSize = 10; // Just a guess
|
||||
|
||||
return MaxSize;
|
||||
} // end of GetMaxSize
|
||||
} // end of GetMaxSize
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBC Access Method opening routine. */
|
||||
|
@ -1211,7 +1212,7 @@ int TDBXDBC::GetMaxSize(PGLOBAL g)
|
|||
/* join block of next table if it exists or else are discarted. */
|
||||
/***********************************************************************/
|
||||
bool TDBXDBC::OpenDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
bool rc = false;
|
||||
|
||||
if (trace(1))
|
||||
|
@ -1221,7 +1222,7 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
|
|||
if (Use == USE_OPEN) {
|
||||
strcpy(g->Message, "Multiple execution is not allowed");
|
||||
return true;
|
||||
} // endif use
|
||||
} // endif use
|
||||
|
||||
/*********************************************************************/
|
||||
/* Open an ODBC connection for this table. */
|
||||
|
@ -1243,7 +1244,7 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
|
|||
if (Mode != MODE_READ && Mode != MODE_READX) {
|
||||
strcpy(g->Message, "No INSERT/DELETE/UPDATE of XDBC tables");
|
||||
return true;
|
||||
} // endif Mode
|
||||
} // endif Mode
|
||||
|
||||
/*********************************************************************/
|
||||
/* Get the command to execute. */
|
||||
|
@ -1256,13 +1257,13 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
|
|||
|
||||
Rows = 1;
|
||||
return false;
|
||||
} // end of OpenDB
|
||||
} // end of OpenDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* ReadDB: Data Base read routine for xdbc access method. */
|
||||
/***********************************************************************/
|
||||
int TDBXDBC::ReadDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (Cmdlist) {
|
||||
if (!Query)
|
||||
Query = new(g)STRING(g, 0, Cmdlist->Cmd);
|
||||
|
@ -1280,25 +1281,25 @@ int TDBXDBC::ReadDB(PGLOBAL g)
|
|||
return RC_EF;
|
||||
} // endif Cmdlist
|
||||
|
||||
} // end of ReadDB
|
||||
} // end of ReadDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base delete line routine for ODBC access method. */
|
||||
/* Data Base write line routine for XDBC access method. */
|
||||
/***********************************************************************/
|
||||
int TDBXDBC::WriteDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
strcpy(g->Message, "Execsrc tables are read only");
|
||||
return RC_FX;
|
||||
} // end of DeleteDB
|
||||
} // end of DeleteDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base delete line routine for ODBC access method. */
|
||||
/* Data Base delete line routine for XDBC access method. */
|
||||
/***********************************************************************/
|
||||
int TDBXDBC::DeleteDB(PGLOBAL g, int irc)
|
||||
{
|
||||
{
|
||||
strcpy(g->Message, MSG(NO_ODBC_DELETE));
|
||||
return RC_FX;
|
||||
} // end of DeleteDB
|
||||
} // end of DeleteDB
|
||||
|
||||
/* --------------------------- XSRCCOL ------------------------------- */
|
||||
|
||||
|
@ -1307,25 +1308,25 @@ int TDBXDBC::DeleteDB(PGLOBAL g, int irc)
|
|||
/***********************************************************************/
|
||||
XSRCCOL::XSRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am)
|
||||
: ODBCCOL(cdp, tdbp, cprec, i, am)
|
||||
{
|
||||
{
|
||||
// Set additional ODBC access method information for column.
|
||||
Flag = cdp->GetOffset();
|
||||
} // end of XSRCCOL constructor
|
||||
} // end of XSRCCOL constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* XSRCCOL constructor used for copying columns. */
|
||||
/* tdbp is the pointer to the new table descriptor. */
|
||||
/***********************************************************************/
|
||||
XSRCCOL::XSRCCOL(XSRCCOL *col1, PTDB tdbp) : ODBCCOL(col1, tdbp)
|
||||
{
|
||||
{
|
||||
Flag = col1->Flag;
|
||||
} // end of XSRCCOL copy constructor
|
||||
} // end of XSRCCOL copy constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* ReadColumn: set column value according to Flag. */
|
||||
/***********************************************************************/
|
||||
void XSRCCOL::ReadColumn(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PTDBXDBC tdbp = (PTDBXDBC)To_Tdb;
|
||||
|
||||
switch (Flag) {
|
||||
|
@ -1335,15 +1336,15 @@ void XSRCCOL::ReadColumn(PGLOBAL g)
|
|||
default: Value->SetValue_psz("Invalid Flag"); break;
|
||||
} // endswitch Flag
|
||||
|
||||
} // end of ReadColumn
|
||||
} // end of ReadColumn
|
||||
|
||||
/***********************************************************************/
|
||||
/* WriteColumn: Should never be called. */
|
||||
/***********************************************************************/
|
||||
void XSRCCOL::WriteColumn(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
// Should never be called
|
||||
} // end of WriteColumn
|
||||
} // end of WriteColumn
|
||||
|
||||
/* ---------------------------TDBDRV class --------------------------- */
|
||||
|
||||
|
@ -1351,9 +1352,9 @@ void XSRCCOL::WriteColumn(PGLOBAL g)
|
|||
/* GetResult: Get the list of ODBC drivers. */
|
||||
/***********************************************************************/
|
||||
PQRYRES TDBDRV::GetResult(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
return ODBCDrivers(g, Maxres, false);
|
||||
} // end of GetResult
|
||||
} // end of GetResult
|
||||
|
||||
/* ---------------------------TDBSRC class --------------------------- */
|
||||
|
||||
|
@ -1361,9 +1362,9 @@ PQRYRES TDBDRV::GetResult(PGLOBAL g)
|
|||
/* GetResult: Get the list of ODBC data sources. */
|
||||
/***********************************************************************/
|
||||
PQRYRES TDBSRC::GetResult(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
return ODBCDataSources(g, Maxres, false);
|
||||
} // end of GetResult
|
||||
} // end of GetResult
|
||||
|
||||
/* ---------------------------TDBOTB class --------------------------- */
|
||||
|
||||
|
@ -1371,7 +1372,7 @@ PQRYRES TDBSRC::GetResult(PGLOBAL g)
|
|||
/* TDBOTB class constructor. */
|
||||
/***********************************************************************/
|
||||
TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
|
||||
{
|
||||
{
|
||||
Dsn = tdp->GetConnect();
|
||||
Schema = tdp->GetTabschema();
|
||||
Tab = tdp->GetTabname();
|
||||
|
@ -1381,15 +1382,15 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
|
|||
Ops.Cto = tdp->Cto;
|
||||
Ops.Qto = tdp->Qto;
|
||||
Ops.UseCnc = tdp->UseCnc;
|
||||
} // end of TDBOTB constructor
|
||||
} // end of TDBOTB constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* GetResult: Get the list of ODBC tables. */
|
||||
/***********************************************************************/
|
||||
PQRYRES TDBOTB::GetResult(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
return ODBCTables(g, Dsn, Schema, Tab, Tabtyp, Maxres, false, &Ops);
|
||||
} // end of GetResult
|
||||
} // end of GetResult
|
||||
|
||||
/* ---------------------------TDBOCL class --------------------------- */
|
||||
|
||||
|
@ -1405,8 +1406,8 @@ TDBOCL::TDBOCL(PODEF tdp) : TDBOTB(tdp)
|
|||
/* GetResult: Get the list of ODBC table columns. */
|
||||
/***********************************************************************/
|
||||
PQRYRES TDBOCL::GetResult(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
return ODBCColumns(g, Dsn, Schema, Tab, Colpat, Maxres, false, &Ops);
|
||||
} // end of GetResult
|
||||
} // end of GetResult
|
||||
|
||||
/* ------------------------ End of Tabodbc --------------------------- */
|
||||
|
|
|
@ -163,8 +163,11 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
|||
return NULL;
|
||||
|
||||
tdp->Tabname = tab;
|
||||
tdp->Tabname = (char*)GetStringTableOption(g, topt, "Tabname", tab);
|
||||
tdp->Rowname = (char*)GetStringTableOption(g, topt, "Rownode", NULL);
|
||||
tdp->Zipped = GetBooleanTableOption(g, topt, "Zipped", false);
|
||||
tdp->Entry = GetStringTableOption(g, topt, "Entry", NULL);
|
||||
tdp->Skip = GetBooleanTableOption(g, topt, "Skipnull", false);
|
||||
|
||||
if (!(op = GetStringTableOption(g, topt, "Xmlsup", NULL)))
|
||||
#if defined(__WIN__)
|
||||
|
@ -280,7 +283,9 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
|||
if (!vp->atp)
|
||||
node = vp->nl->GetItem(g, vp->k++, tdp->Usedom ? node : NULL);
|
||||
|
||||
strncat(fmt, colname, XLEN(fmt));
|
||||
if (!j)
|
||||
strncat(fmt, colname, XLEN(fmt));
|
||||
|
||||
strncat(fmt, "/", XLEN(fmt));
|
||||
strncat(xcol->Name, "_", XLEN(xcol->Name));
|
||||
j++;
|
||||
|
@ -302,6 +307,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
|||
case RC_INFO:
|
||||
PushWarning(g, txmp);
|
||||
case RC_OK:
|
||||
xcol->Cbn = !strlen(buf);
|
||||
break;
|
||||
default:
|
||||
goto err;
|
||||
|
@ -327,9 +333,9 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
|||
|
||||
xcp->Len = MY_MAX(xcp->Len, xcol->Len);
|
||||
xcp->Scale = MY_MAX(xcp->Scale, xcol->Scale);
|
||||
xcp->Cbn |= xcol->Cbn;
|
||||
xcp->Cbn |= (xcol->Cbn || !xcol->Len);
|
||||
xcp->Found = true;
|
||||
} else {
|
||||
} else if(xcol->Len || !tdp->Skip) {
|
||||
// New column
|
||||
xcp = new(g) XMCOL(g, xcol, fmt, i);
|
||||
length[0] = MY_MAX(length[0], strlen(xcol->Name));
|
||||
|
@ -344,7 +350,8 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
|||
n++;
|
||||
} // endif xcp
|
||||
|
||||
pxcp = xcp;
|
||||
if (xcp)
|
||||
pxcp = xcp;
|
||||
|
||||
if (vp->atp)
|
||||
vp->atp = vp->atp->GetNext(g);
|
||||
|
@ -445,6 +452,7 @@ XMLDEF::XMLDEF(void)
|
|||
Usedom = false;
|
||||
Zipped = false;
|
||||
Mulentries = false;
|
||||
Skip = false;
|
||||
} // end of XMLDEF constructor
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -681,6 +689,14 @@ PTDB TDBXML::Clone(PTABS t)
|
|||
return tp;
|
||||
} // end of Clone
|
||||
|
||||
/***********************************************************************/
|
||||
/* Must not be in tabxml.h because of OEM tables */
|
||||
/***********************************************************************/
|
||||
const CHARSET_INFO *TDBXML::data_charset()
|
||||
{
|
||||
return &my_charset_utf8_general_ci;
|
||||
} // end of data_charset
|
||||
|
||||
/***********************************************************************/
|
||||
/* Allocate XML column description block. */
|
||||
/***********************************************************************/
|
||||
|
@ -806,127 +822,141 @@ bool TDBXML::Initialize(PGLOBAL g)
|
|||
} // endif Bufdone
|
||||
|
||||
#if !defined(UNIX)
|
||||
if (!Root) try {
|
||||
if (!Root) try {
|
||||
#else
|
||||
if (!Root) {
|
||||
if (!Root) {
|
||||
#endif
|
||||
char tabpath[64], filename[_MAX_PATH];
|
||||
char tabpath[64], filename[_MAX_PATH];
|
||||
|
||||
// We used the file name relative to recorded datapath
|
||||
PlugSetPath(filename, Xfile, GetPath());
|
||||
// We used the file name relative to recorded datapath
|
||||
PlugSetPath(filename, Xfile, GetPath());
|
||||
|
||||
// Load or re-use the table file
|
||||
rc = LoadTableFile(g, filename);
|
||||
// Load or re-use the table file
|
||||
rc = LoadTableFile(g, filename);
|
||||
|
||||
if (rc == RC_OK) {
|
||||
// Get root node
|
||||
if (!(Root = Docp->GetRoot(g))) {
|
||||
// This should never happen as load should have failed
|
||||
strcpy(g->Message, MSG(EMPTY_DOC));
|
||||
goto error;
|
||||
} // endif Root
|
||||
if (rc == RC_OK) {
|
||||
// Get root node
|
||||
if (!(Root = Docp->GetRoot(g))) {
|
||||
// This should never happen as load should have failed
|
||||
strcpy(g->Message, MSG(EMPTY_DOC));
|
||||
goto error;
|
||||
} // endif Root
|
||||
|
||||
// If tabname is not an Xpath,
|
||||
// construct one that will find it anywhere
|
||||
if (!strchr(Tabname, '/'))
|
||||
strcat(strcpy(tabpath, "//"), Tabname);
|
||||
else
|
||||
strcpy(tabpath, Tabname);
|
||||
// If tabname is not an Xpath,
|
||||
// construct one that will find it anywhere
|
||||
if (!strchr(Tabname, '/'))
|
||||
strcat(strcpy(tabpath, "//"), Tabname);
|
||||
else
|
||||
strcpy(tabpath, Tabname);
|
||||
|
||||
// Evaluate table xpath
|
||||
if ((TabNode = Root->SelectSingleNode(g, tabpath))) {
|
||||
if (TabNode->GetType() != XML_ELEMENT_NODE) {
|
||||
sprintf(g->Message, MSG(BAD_NODE_TYPE), TabNode->GetType());
|
||||
goto error;
|
||||
} // endif Type
|
||||
// Evaluate table xpath
|
||||
if ((TabNode = Root->SelectSingleNode(g, tabpath))) {
|
||||
if (TabNode->GetType() != XML_ELEMENT_NODE) {
|
||||
sprintf(g->Message, MSG(BAD_NODE_TYPE), TabNode->GetType());
|
||||
goto error;
|
||||
} // endif Type
|
||||
|
||||
} else if (Mode == MODE_INSERT && XmlDB) {
|
||||
// We are adding a new table to a multi-table file
|
||||
} else if (Mode == MODE_INSERT && XmlDB) {
|
||||
// We are adding a new table to a multi-table file
|
||||
|
||||
// If XmlDB is not an Xpath,
|
||||
// construct one that will find it anywhere
|
||||
if (!strchr(XmlDB, '/'))
|
||||
strcat(strcpy(tabpath, "//"), XmlDB);
|
||||
else
|
||||
strcpy(tabpath, XmlDB);
|
||||
// If XmlDB is not an Xpath,
|
||||
// construct one that will find it anywhere
|
||||
if (!strchr(XmlDB, '/'))
|
||||
strcat(strcpy(tabpath, "//"), XmlDB);
|
||||
else
|
||||
strcpy(tabpath, XmlDB);
|
||||
|
||||
if (!(DBnode = Root->SelectSingleNode(g, tabpath))) {
|
||||
// DB node does not exist yet; we cannot create it
|
||||
// because we don't know where it should be placed
|
||||
sprintf(g->Message, MSG(MISSING_NODE), XmlDB, Xfile);
|
||||
goto error;
|
||||
} // endif DBnode
|
||||
if (!(DBnode = Root->SelectSingleNode(g, tabpath))) {
|
||||
// DB node does not exist yet; we cannot create it
|
||||
// because we don't know where it should be placed
|
||||
sprintf(g->Message, MSG(MISSING_NODE), XmlDB, Xfile);
|
||||
goto error;
|
||||
} // endif DBnode
|
||||
|
||||
if (!(TabNode = DBnode->AddChildNode(g, Tabname))) {
|
||||
sprintf(g->Message, MSG(FAIL_ADD_NODE), Tabname);
|
||||
goto error;
|
||||
} // endif TabNode
|
||||
if (!(TabNode = DBnode->AddChildNode(g, Tabname))) {
|
||||
sprintf(g->Message, MSG(FAIL_ADD_NODE), Tabname);
|
||||
goto error;
|
||||
} // endif TabNode
|
||||
|
||||
DBnode->AddText(g, "\n");
|
||||
} else
|
||||
TabNode = Root; // Try this ?
|
||||
DBnode->AddText(g, "\n");
|
||||
} else {
|
||||
TabNode = Root; // Try this ?
|
||||
Tabname = TabNode->GetName(g);
|
||||
} // endif's
|
||||
|
||||
} else if (rc == RC_NF || rc == RC_EF) {
|
||||
// The XML file does not exist or is void
|
||||
if (Mode == MODE_INSERT) {
|
||||
// New Document
|
||||
char buf[64];
|
||||
} else if (rc == RC_NF || rc == RC_EF) {
|
||||
// The XML file does not exist or is void
|
||||
if (Mode == MODE_INSERT) {
|
||||
// New Document
|
||||
char buf[64];
|
||||
|
||||
// Create the XML node
|
||||
if (Docp->NewDoc(g, "1.0")) {
|
||||
strcpy(g->Message, MSG(NEW_DOC_FAILED));
|
||||
goto error;
|
||||
} // endif NewDoc
|
||||
// Create the XML node
|
||||
if (Docp->NewDoc(g, "1.0")) {
|
||||
strcpy(g->Message, MSG(NEW_DOC_FAILED));
|
||||
goto error;
|
||||
} // endif NewDoc
|
||||
|
||||
// Now we can link the Xblock
|
||||
To_Xb = Docp->LinkXblock(g, Mode, rc, filename);
|
||||
// Now we can link the Xblock
|
||||
To_Xb = Docp->LinkXblock(g, Mode, rc, filename);
|
||||
|
||||
// Add a CONNECT comment node
|
||||
strcpy(buf, " Created by the MariaDB CONNECT Storage Engine");
|
||||
Docp->AddComment(g, buf);
|
||||
// Add a CONNECT comment node
|
||||
strcpy(buf, " Created by the MariaDB CONNECT Storage Engine");
|
||||
Docp->AddComment(g, buf);
|
||||
|
||||
if (XmlDB) {
|
||||
// This is a multi-table file
|
||||
DBnode = Root = Docp->NewRoot(g, XmlDB);
|
||||
DBnode->AddText(g, "\n");
|
||||
TabNode = DBnode->AddChildNode(g, Tabname);
|
||||
DBnode->AddText(g, "\n");
|
||||
} else
|
||||
TabNode = Root = Docp->NewRoot(g, Tabname);
|
||||
if (XmlDB) {
|
||||
// This is a multi-table file
|
||||
DBnode = Root = Docp->NewRoot(g, XmlDB);
|
||||
DBnode->AddText(g, "\n");
|
||||
TabNode = DBnode->AddChildNode(g, Tabname);
|
||||
DBnode->AddText(g, "\n");
|
||||
} else
|
||||
TabNode = Root = Docp->NewRoot(g, Tabname);
|
||||
|
||||
if (TabNode == NULL || Root == NULL) {
|
||||
strcpy(g->Message, MSG(XML_INIT_ERROR));
|
||||
goto error;
|
||||
} else if (SetTabNode(g))
|
||||
goto error;
|
||||
if (TabNode == NULL || Root == NULL) {
|
||||
strcpy(g->Message, MSG(XML_INIT_ERROR));
|
||||
goto error;
|
||||
} else if (SetTabNode(g))
|
||||
goto error;
|
||||
|
||||
} else {
|
||||
sprintf(g->Message, MSG(FILE_UNFOUND), Xfile);
|
||||
} else {
|
||||
sprintf(g->Message, MSG(FILE_UNFOUND), Xfile);
|
||||
|
||||
if (Mode == MODE_READ) {
|
||||
PushWarning(g, this);
|
||||
Void = true;
|
||||
} // endif Mode
|
||||
if (Mode == MODE_READ) {
|
||||
PushWarning(g, this);
|
||||
Void = true;
|
||||
} // endif Mode
|
||||
|
||||
goto error;
|
||||
} // endif Mode
|
||||
goto error;
|
||||
} // endif Mode
|
||||
|
||||
} else if (rc == RC_INFO) {
|
||||
// Loading failed
|
||||
sprintf(g->Message, MSG(LOADING_FAILED), Xfile);
|
||||
goto error;
|
||||
} else // (rc == RC_FX)
|
||||
goto error;
|
||||
} else if (rc == RC_INFO) {
|
||||
// Loading failed
|
||||
sprintf(g->Message, MSG(LOADING_FAILED), Xfile);
|
||||
goto error;
|
||||
} else // (rc == RC_FX)
|
||||
goto error;
|
||||
|
||||
// Get row node list
|
||||
if (Rowname)
|
||||
Nlist = TabNode->SelectNodes(g, Rowname);
|
||||
else
|
||||
Nlist = TabNode->GetChildElements(g);
|
||||
if (!Rowname) {
|
||||
for (PXNODE n = TabNode->GetChild(g); n; n = n->GetNext(g))
|
||||
if (n->GetType() == XML_ELEMENT_NODE) {
|
||||
Rowname = n->GetName(g);
|
||||
break;
|
||||
} // endif Type
|
||||
|
||||
Docp->SetNofree(true); // For libxml2
|
||||
if (!Rowname)
|
||||
Rowname = TabNode->GetName(g);
|
||||
} // endif Rowname
|
||||
|
||||
// Get row node list
|
||||
if (strcmp(Rowname, Tabname))
|
||||
Nlist = TabNode->SelectNodes(g, Rowname);
|
||||
else
|
||||
Nrow = 1;
|
||||
|
||||
|
||||
Docp->SetNofree(true); // For libxml2
|
||||
#if defined(__WIN__)
|
||||
} catch(_com_error e) {
|
||||
} catch (_com_error e) {
|
||||
// We come here if a DOM command threw an error
|
||||
char buf[128];
|
||||
|
||||
|
@ -1213,10 +1243,14 @@ int TDBXML::ReadDB(PGLOBAL g)
|
|||
htrc("TDBXML ReadDB: Irow=%d RowNode=%p\n", Irow, RowNode);
|
||||
|
||||
// Get the new row node
|
||||
if ((RowNode = Nlist->GetItem(g, Irow, RowNode)) == NULL) {
|
||||
sprintf(g->Message, MSG(MISSING_ROWNODE), Irow);
|
||||
return RC_FX;
|
||||
} // endif RowNode
|
||||
if (Nlist) {
|
||||
if ((RowNode = Nlist->GetItem(g, Irow, RowNode)) == NULL) {
|
||||
sprintf(g->Message, MSG(MISSING_ROWNODE), Irow);
|
||||
return RC_FX;
|
||||
} // endif RowNode
|
||||
|
||||
} else
|
||||
RowNode = TabNode;
|
||||
|
||||
if (Colname && Coltype == 2)
|
||||
Clist = RowNode->SelectNodes(g, Colname, Clist);
|
||||
|
@ -1271,6 +1305,7 @@ int TDBXML::WriteDB(PGLOBAL g)
|
|||
/***********************************************************************/
|
||||
int TDBXML::DeleteDB(PGLOBAL g, int irc)
|
||||
{
|
||||
// TODO: Handle null Nlist
|
||||
if (irc == RC_FX) {
|
||||
// Delete all rows
|
||||
for (Irow = 0; Irow < Nrow; Irow++)
|
||||
|
@ -2209,8 +2244,9 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
|
|||
TDBXCT::TDBXCT(PXMLDEF tdp) : TDBCAT(tdp)
|
||||
{
|
||||
Topt = tdp->GetTopt();
|
||||
Db = (char*)tdp->GetDB();
|
||||
Tabn = tdp->Tabname;
|
||||
//Db = (char*)tdp->GetDB();
|
||||
Db = (char*)tdp->Schema;
|
||||
Tabn = tdp->Tabname;
|
||||
} // end of TDBXCT constructor
|
||||
|
||||
/***********************************************************************/
|
||||
|
|
|
@ -9,6 +9,8 @@ typedef class XMLDEF *PXMLDEF;
|
|||
typedef class TDBXML *PTDBXML;
|
||||
typedef class XMLCOL *PXMLCOL;
|
||||
|
||||
DllExport PQRYRES XMLColumns(PGLOBAL, char *, char *, PTOS, bool);
|
||||
|
||||
/* --------------------------- XML classes --------------------------- */
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -50,6 +52,7 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */
|
|||
bool Usedom; /* True: DOM, False: libxml2 */
|
||||
bool Zipped; /* True: Zipped XML file(s) */
|
||||
bool Mulentries; /* True: multiple entries in zip file*/
|
||||
bool Skip; /* Skip null columns */
|
||||
}; // end of XMLDEF
|
||||
|
||||
#if defined(INCLUDE_TDBXML)
|
||||
|
@ -100,8 +103,7 @@ class DllExport TDBXML : public TDBASE {
|
|||
virtual int DeleteDB(PGLOBAL g, int irc);
|
||||
virtual void CloseDB(PGLOBAL g);
|
||||
virtual int CheckWrite(PGLOBAL g) {Checked = true; return 0;}
|
||||
virtual const CHARSET_INFO *data_charset()
|
||||
{return &my_charset_utf8_general_ci;}
|
||||
virtual const CHARSET_INFO *data_charset();
|
||||
|
||||
protected:
|
||||
// Members
|
||||
|
|
|
@ -107,7 +107,7 @@ bool user_connect::user_init()
|
|||
g= PlugInit(NULL, worksize);
|
||||
|
||||
// Check whether the initialization is complete
|
||||
if (!g || !g->Sarea || PlugSubSet(g, g->Sarea, g->Sarea_Size)
|
||||
if (!g || !g->Sarea || PlugSubSet(g->Sarea, g->Sarea_Size)
|
||||
|| !(dup= PlgMakeUser(g))) {
|
||||
if (g)
|
||||
printf("%s\n", g->Message);
|
||||
|
@ -172,7 +172,7 @@ bool user_connect::CheckCleanup(bool force)
|
|||
|
||||
} // endif worksize
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Xchk = NULL;
|
||||
g->Createas = 0;
|
||||
g->Alchecked = 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2005, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2013, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2013, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -3795,12 +3795,14 @@ check_if_ok_to_rename:
|
|||
continue;
|
||||
}
|
||||
|
||||
dict_foreign_t* foreign;
|
||||
|
||||
for (dict_foreign_set::iterator it
|
||||
= prebuilt->table->foreign_set.begin();
|
||||
it != prebuilt->table->foreign_set.end();
|
||||
++it) {
|
||||
|
||||
dict_foreign_t* foreign = *it;
|
||||
foreign = *it;
|
||||
const char* fid = strchr(foreign->id, '/');
|
||||
|
||||
DBUG_ASSERT(fid);
|
||||
|
@ -3811,7 +3813,6 @@ check_if_ok_to_rename:
|
|||
|
||||
if (!my_strcasecmp(system_charset_info,
|
||||
fid, drop->name)) {
|
||||
drop_fk[n_drop_fk++] = foreign;
|
||||
goto found_fk;
|
||||
}
|
||||
}
|
||||
|
@ -3820,12 +3821,19 @@ check_if_ok_to_rename:
|
|||
drop->name);
|
||||
goto err_exit;
|
||||
found_fk:
|
||||
for (ulint i = n_drop_fk; i--; ) {
|
||||
if (drop_fk[i] == foreign) {
|
||||
goto dup_fk;
|
||||
}
|
||||
}
|
||||
drop_fk[n_drop_fk++] = foreign;
|
||||
dup_fk:
|
||||
continue;
|
||||
}
|
||||
|
||||
DBUG_ASSERT(n_drop_fk > 0);
|
||||
DBUG_ASSERT(n_drop_fk
|
||||
== ha_alter_info->alter_info->drop_list.elements);
|
||||
<= ha_alter_info->alter_info->drop_list.elements);
|
||||
} else {
|
||||
drop_fk = NULL;
|
||||
}
|
||||
|
@ -4696,7 +4704,7 @@ err_exit:
|
|||
rename_foreign:
|
||||
trx->op_info = "renaming column in SYS_FOREIGN_COLS";
|
||||
|
||||
std::list<dict_foreign_t*> fk_evict;
|
||||
std::set<dict_foreign_t*> fk_evict;
|
||||
bool foreign_modified;
|
||||
|
||||
for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin();
|
||||
|
@ -4736,7 +4744,7 @@ rename_foreign:
|
|||
}
|
||||
|
||||
if (foreign_modified) {
|
||||
fk_evict.push_back(foreign);
|
||||
fk_evict.insert(foreign);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4778,7 +4786,7 @@ rename_foreign:
|
|||
}
|
||||
|
||||
if (foreign_modified) {
|
||||
fk_evict.push_back(foreign);
|
||||
fk_evict.insert(foreign);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5174,7 +5182,7 @@ commit_try_rebuild(
|
|||
& Alter_inplace_info::DROP_FOREIGN_KEY)
|
||||
|| ctx->num_to_drop_fk > 0);
|
||||
DBUG_ASSERT(ctx->num_to_drop_fk
|
||||
== ha_alter_info->alter_info->drop_list.elements);
|
||||
<= ha_alter_info->alter_info->drop_list.elements);
|
||||
|
||||
for (dict_index_t* index = dict_table_get_first_index(rebuilt_table);
|
||||
index;
|
||||
|
@ -5426,7 +5434,7 @@ commit_try_norebuild(
|
|||
& Alter_inplace_info::DROP_FOREIGN_KEY)
|
||||
|| ctx->num_to_drop_fk > 0);
|
||||
DBUG_ASSERT(ctx->num_to_drop_fk
|
||||
== ha_alter_info->alter_info->drop_list.elements);
|
||||
<= ha_alter_info->alter_info->drop_list.elements);
|
||||
|
||||
for (ulint i = 0; i < ctx->num_to_add_index; i++) {
|
||||
dict_index_t* index = ctx->add_index[i];
|
||||
|
@ -5747,7 +5755,6 @@ ha_innobase::commit_inplace_alter_table(
|
|||
Alter_inplace_info* ha_alter_info,
|
||||
bool commit)
|
||||
{
|
||||
dberr_t error;
|
||||
ha_innobase_inplace_ctx* ctx0
|
||||
= static_cast<ha_innobase_inplace_ctx*>
|
||||
(ha_alter_info->handler_ctx);
|
||||
|
@ -5827,7 +5834,7 @@ ha_innobase::commit_inplace_alter_table(
|
|||
transactions collected during crash recovery could be
|
||||
holding InnoDB locks only, not MySQL locks. */
|
||||
|
||||
error = row_merge_lock_table(
|
||||
dberr_t error = row_merge_lock_table(
|
||||
prebuilt->trx, ctx->old_table, LOCK_X);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
|
@ -6012,9 +6019,9 @@ rollback_trx:
|
|||
file operations that will be performed in
|
||||
commit_cache_rebuild(), and if none, generate
|
||||
the redo log for these operations. */
|
||||
error = fil_mtr_rename_log(ctx->old_table,
|
||||
ctx->new_table,
|
||||
ctx->tmp_name, &mtr);
|
||||
dberr_t error = fil_mtr_rename_log(
|
||||
ctx->old_table, ctx->new_table, ctx->tmp_name,
|
||||
&mtr);
|
||||
if (error != DB_SUCCESS) {
|
||||
/* Out of memory or a problem will occur
|
||||
when renaming files. */
|
||||
|
@ -6139,39 +6146,30 @@ rollback_trx:
|
|||
/* Rename the tablespace files. */
|
||||
commit_cache_rebuild(ctx);
|
||||
|
||||
error = innobase_update_foreign_cache(ctx, user_thd);
|
||||
if (error != DB_SUCCESS) {
|
||||
goto foreign_fail;
|
||||
if (innobase_update_foreign_cache(ctx, user_thd)
|
||||
!= DB_SUCCESS
|
||||
&& prebuilt->trx->check_foreigns) {
|
||||
foreign_fail:
|
||||
push_warning_printf(
|
||||
user_thd,
|
||||
Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_ALTER_INFO,
|
||||
"failed to load FOREIGN KEY"
|
||||
" constraints");
|
||||
}
|
||||
} else {
|
||||
error = innobase_update_foreign_cache(ctx, user_thd);
|
||||
bool fk_fail = innobase_update_foreign_cache(
|
||||
ctx, user_thd) != DB_SUCCESS;
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
foreign_fail:
|
||||
/* The data dictionary cache
|
||||
should be corrupted now. The
|
||||
best solution should be to
|
||||
kill and restart the server,
|
||||
but the *.frm file has not
|
||||
been replaced yet. */
|
||||
my_error(ER_CANNOT_ADD_FOREIGN,
|
||||
MYF(0));
|
||||
sql_print_error(
|
||||
"InnoDB: dict_load_foreigns()"
|
||||
" returned %u for %s",
|
||||
(unsigned) error,
|
||||
thd_query_string(user_thd)
|
||||
->str);
|
||||
ut_ad(0);
|
||||
} else {
|
||||
if (!commit_cache_norebuild(
|
||||
ctx, table, trx)) {
|
||||
ut_a(!prebuilt->trx->check_foreigns);
|
||||
}
|
||||
if (!commit_cache_norebuild(ctx, table, trx)) {
|
||||
fk_fail = true;
|
||||
ut_ad(!prebuilt->trx->check_foreigns);
|
||||
}
|
||||
|
||||
innobase_rename_columns_cache(
|
||||
ha_alter_info, table,
|
||||
ctx->new_table);
|
||||
innobase_rename_columns_cache(ha_alter_info, table,
|
||||
ctx->new_table);
|
||||
if (fk_fail && prebuilt->trx->check_foreigns) {
|
||||
goto foreign_fail;
|
||||
}
|
||||
}
|
||||
DBUG_INJECT_CRASH("ib_commit_inplace_crash",
|
||||
|
|
|
@ -45,7 +45,7 @@ Created 1/20/1994 Heikki Tuuri
|
|||
|
||||
#define INNODB_VERSION_MAJOR 5
|
||||
#define INNODB_VERSION_MINOR 6
|
||||
#define INNODB_VERSION_BUGFIX 42
|
||||
#define INNODB_VERSION_BUGFIX 43
|
||||
|
||||
/* The following is the InnoDB version as shown in
|
||||
SELECT plugin_version FROM information_schema.plugins;
|
||||
|
|
|
@ -5279,9 +5279,6 @@ row_rename_table_for_mysql(
|
|||
" = TO_BINARY(:old_table_name);\n"
|
||||
"END;\n"
|
||||
, FALSE, trx);
|
||||
if (err != DB_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
} else if (n_constraints_to_drop > 0) {
|
||||
/* Drop some constraints of tmp tables. */
|
||||
|
|
174
storage/tokudb/PerconaFT/COPYING.APACHEv2
Normal file
174
storage/tokudb/PerconaFT/COPYING.APACHEv2
Normal file
|
@ -0,0 +1,174 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
|
@ -104,11 +104,14 @@ All source code and test contributions must be provided under a [BSD 2-Clause][b
|
|||
License
|
||||
-------
|
||||
|
||||
Portions of the PerconaFT library (the 'locktree' and 'omt') are available under the Apache version 2 license.
|
||||
PerconaFT is available under the GPL version 2, and AGPL version 3.
|
||||
See [COPYING.AGPLv3][agpllicense],
|
||||
See [COPYING.APACHEv2][apachelicense],
|
||||
[COPYING.AGPLv3][agpllicense],
|
||||
[COPYING.GPLv2][gpllicense], and
|
||||
[PATENTS][patents].
|
||||
|
||||
[apachelicense]: http://github.com/Percona/PerconaFT/blob/master/COPYING.APACHEv2
|
||||
[agpllicense]: http://github.com/Percona/PerconaFT/blob/master/COPYING.AGPLv3
|
||||
[gpllicense]: http://github.com/Percona/PerconaFT/blob/master/COPYING.GPLv2
|
||||
[patents]: http://github.com/Percona/PerconaFT/blob/master/PATENTS
|
||||
|
|
|
@ -46,11 +46,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
void set_test_txn_sync_callback(void (*) (pthread_t, void*), void*);
|
||||
#define toku_test_txn_sync_callback(a) ((test_txn_sync_callback)? test_txn_sync_callback( a,test_txn_sync_callback_extra) : (void) 0)
|
||||
|
||||
#if TOKU_DEBUG_TXN_SYNC
|
||||
#if defined(TOKU_DEBUG_TXN_SYNC)
|
||||
#define toku_debug_txn_sync(a) toku_test_txn_sync_callback(a)
|
||||
#else
|
||||
#define toku_debug_txn_sync(a) ((void) 0)
|
||||
#endif
|
||||
#endif // defined(TOKU_DEBUG_TXN_SYNC)
|
||||
|
||||
typedef struct txn_manager *TXN_MANAGER;
|
||||
|
||||
|
|
|
@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -184,9 +184,9 @@ void toku_instr_file_io_end(toku_io_instrumentation &io_instr, ssize_t count) {
|
|||
|
||||
void toku_instr_mutex_init(const toku_instr_key &key, toku_mutex_t &mutex) {
|
||||
mutex.psi_mutex = PSI_MUTEX_CALL(init_mutex)(key.id(), &mutex.pmutex);
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
mutex.instr_key_id = key.id();
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
}
|
||||
|
||||
void toku_instr_mutex_destroy(PSI_mutex *&mutex_instr) {
|
||||
|
@ -242,9 +242,9 @@ void toku_instr_mutex_unlock(PSI_mutex *mutex_instr) {
|
|||
|
||||
void toku_instr_cond_init(const toku_instr_key &key, toku_cond_t &cond) {
|
||||
cond.psi_cond = PSI_COND_CALL(init_cond)(key.id(), &cond.pcond);
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
cond.instr_key_id = key.id();
|
||||
#endif
|
||||
#endif // // defined(TOKU_PTHREAD_DEBUG)
|
||||
}
|
||||
|
||||
void toku_instr_cond_destroy(PSI_cond *&cond_instr) {
|
||||
|
@ -295,9 +295,9 @@ void toku_instr_cond_broadcast(const toku_cond_t &cond) {
|
|||
void toku_instr_rwlock_init(const toku_instr_key &key,
|
||||
toku_pthread_rwlock_t &rwlock) {
|
||||
rwlock.psi_rwlock = PSI_RWLOCK_CALL(init_rwlock)(key.id(), &rwlock.rwlock);
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
rwlock.instr_key_id = key.id();
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
}
|
||||
|
||||
void toku_instr_rwlock_destroy(PSI_rwlock *&rwlock_instr) {
|
||||
|
|
|
@ -12,8 +12,15 @@
|
|||
// undefine them here to avoid compilation errors.
|
||||
#undef __STDC_FORMAT_MACROS
|
||||
#undef __STDC_LIMIT_MACROS
|
||||
#include <mysql/psi/mysql_file.h> // PSI_file
|
||||
#include <mysql/psi/mysql_thread.h> // PSI_mutex
|
||||
#include "mysql/psi/mysql_file.h" // PSI_file
|
||||
#include "mysql/psi/mysql_thread.h" // PSI_mutex
|
||||
#include "mysql/psi/mysql_stage.h" // PSI_stage
|
||||
|
||||
#if (MYSQL_VERSION_ID >= 80000) && ( MYSQL_VERSION_ID <= 100000)
|
||||
#include "mysql/psi/mysql_cond.h"
|
||||
#include "mysql/psi/mysql_mutex.h"
|
||||
#include "mysql/psi/mysql_rwlock.h"
|
||||
#endif // (MYSQL_VERSION_ID >= nn)
|
||||
|
||||
#ifndef HAVE_PSI_MUTEX_INTERFACE
|
||||
#error HAVE_PSI_MUTEX_INTERFACE required
|
||||
|
|
|
@ -64,23 +64,23 @@ struct toku_mutex_t {
|
|||
pthread_mutex_t pmutex;
|
||||
struct PSI_mutex
|
||||
*psi_mutex; /* The performance schema instrumentation hook */
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
pthread_t owner; // = pthread_self(); // for debugging
|
||||
bool locked;
|
||||
bool valid;
|
||||
pfs_key_t instr_key_id;
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
};
|
||||
|
||||
struct toku_cond_t {
|
||||
pthread_cond_t pcond;
|
||||
struct PSI_cond *psi_cond;
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
pfs_key_t instr_key_id;
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
};
|
||||
|
||||
#ifdef TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
#define TOKU_COND_INITIALIZER \
|
||||
{ \
|
||||
.pcond = PTHREAD_COND_INITIALIZER, .psi_cond = nullptr, \
|
||||
|
@ -89,14 +89,14 @@ struct toku_cond_t {
|
|||
#else
|
||||
#define TOKU_COND_INITIALIZER \
|
||||
{ .pcond = PTHREAD_COND_INITIALIZER, .psi_cond = nullptr }
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
|
||||
struct toku_pthread_rwlock_t {
|
||||
pthread_rwlock_t rwlock;
|
||||
struct PSI_rwlock *psi_rwlock;
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
pfs_key_t instr_key_id;
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
};
|
||||
|
||||
typedef struct toku_mutex_aligned {
|
||||
|
@ -117,7 +117,7 @@ typedef struct toku_mutex_aligned {
|
|||
#define ZERO_MUTEX_INITIALIZER \
|
||||
{}
|
||||
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
#define TOKU_MUTEX_INITIALIZER \
|
||||
{ \
|
||||
.pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr, .owner = 0, \
|
||||
|
@ -126,12 +126,12 @@ typedef struct toku_mutex_aligned {
|
|||
#else
|
||||
#define TOKU_MUTEX_INITIALIZER \
|
||||
{ .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr }
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
|
||||
// Darwin doesn't provide adaptive mutexes
|
||||
#if defined(__APPLE__)
|
||||
#define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_DEFAULT
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
|
||||
{ \
|
||||
.pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr, .owner = 0, \
|
||||
|
@ -140,10 +140,10 @@ typedef struct toku_mutex_aligned {
|
|||
#else
|
||||
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
|
||||
{ .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr }
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
#else // __FreeBSD__, __linux__, at least
|
||||
#define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_ADAPTIVE_NP
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
|
||||
{ \
|
||||
.pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, .psi_mutex = nullptr, \
|
||||
|
@ -152,8 +152,8 @@ typedef struct toku_mutex_aligned {
|
|||
#else
|
||||
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
|
||||
{ .pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, .psi_mutex = nullptr }
|
||||
#endif
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
// Different OSes implement mutexes as different amounts of nested structs.
|
||||
// C++ will fill out all missing values with zeroes if you provide at least one
|
||||
|
@ -198,7 +198,7 @@ toku_mutexattr_destroy(toku_pthread_mutexattr_t *attr) {
|
|||
assert_zero(r);
|
||||
}
|
||||
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
static inline void toku_mutex_assert_locked(const toku_mutex_t *mutex) {
|
||||
invariant(mutex->locked);
|
||||
invariant(mutex->owner == pthread_self());
|
||||
|
@ -207,7 +207,7 @@ static inline void toku_mutex_assert_locked(const toku_mutex_t *mutex) {
|
|||
static inline void
|
||||
toku_mutex_assert_locked(const toku_mutex_t *mutex __attribute__((unused))) {
|
||||
}
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
|
||||
// asserting that a mutex is unlocked only makes sense
|
||||
// if the calling thread can guaruntee that no other threads
|
||||
|
@ -217,7 +217,7 @@ toku_mutex_assert_locked(const toku_mutex_t *mutex __attribute__((unused))) {
|
|||
// when a node is locked the caller knows that no other threads
|
||||
// can be trying to lock its childrens' mutexes. the children
|
||||
// are in one of two fixed states: locked or unlocked.
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
static inline void
|
||||
toku_mutex_assert_unlocked(toku_mutex_t *mutex) {
|
||||
invariant(mutex->owner == 0);
|
||||
|
@ -226,7 +226,7 @@ toku_mutex_assert_unlocked(toku_mutex_t *mutex) {
|
|||
#else
|
||||
static inline void toku_mutex_assert_unlocked(toku_mutex_t *mutex
|
||||
__attribute__((unused))) {}
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
|
||||
#define toku_mutex_lock(M) \
|
||||
toku_mutex_lock_with_source_location(M, __FILE__, __LINE__)
|
||||
|
@ -241,13 +241,13 @@ static inline void toku_cond_init(toku_cond_t *cond,
|
|||
toku_mutex_trylock_with_source_location(M, __FILE__, __LINE__)
|
||||
|
||||
inline void toku_mutex_unlock(toku_mutex_t *mutex) {
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
invariant(mutex->owner == pthread_self());
|
||||
invariant(mutex->valid);
|
||||
invariant(mutex->locked);
|
||||
mutex->locked = false;
|
||||
mutex->owner = 0;
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
toku_instr_mutex_unlock(mutex->psi_mutex);
|
||||
int r = pthread_mutex_unlock(&mutex->pmutex);
|
||||
assert_zero(r);
|
||||
|
@ -264,13 +264,13 @@ inline void toku_mutex_lock_with_source_location(toku_mutex_t *mutex,
|
|||
toku_instr_mutex_lock_end(mutex_instr, r);
|
||||
|
||||
assert_zero(r);
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
invariant(mutex->valid);
|
||||
invariant(!mutex->locked);
|
||||
invariant(mutex->owner == 0);
|
||||
mutex->locked = true;
|
||||
mutex->owner = pthread_self();
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
}
|
||||
|
||||
inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex,
|
||||
|
@ -283,7 +283,7 @@ inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex,
|
|||
const int r = pthread_mutex_lock(&mutex->pmutex);
|
||||
toku_instr_mutex_lock_end(mutex_instr, r);
|
||||
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
if (r == 0) {
|
||||
invariant(mutex->valid);
|
||||
invariant(!mutex->locked);
|
||||
|
@ -291,7 +291,7 @@ inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex,
|
|||
mutex->locked = true;
|
||||
mutex->owner = pthread_self();
|
||||
}
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -320,11 +320,11 @@ inline void toku_cond_wait_with_source_location(toku_cond_t *cond,
|
|||
const char *src_file,
|
||||
uint src_line) {
|
||||
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
invariant(mutex->locked);
|
||||
mutex->locked = false;
|
||||
mutex->owner = 0;
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
|
||||
/* Instrumentation start */
|
||||
toku_cond_instrumentation cond_instr;
|
||||
|
@ -342,11 +342,11 @@ inline void toku_cond_wait_with_source_location(toku_cond_t *cond,
|
|||
toku_instr_cond_wait_end(cond_instr, r);
|
||||
|
||||
assert_zero(r);
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
invariant(!mutex->locked);
|
||||
mutex->locked = true;
|
||||
mutex->owner = pthread_self();
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
}
|
||||
|
||||
inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond,
|
||||
|
@ -354,11 +354,11 @@ inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond,
|
|||
toku_timespec_t *wakeup_at,
|
||||
const char *src_file,
|
||||
uint src_line) {
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
invariant(mutex->locked);
|
||||
mutex->locked = false;
|
||||
mutex->owner = 0;
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
|
||||
/* Instrumentation start */
|
||||
toku_cond_instrumentation cond_instr;
|
||||
|
@ -376,11 +376,11 @@ inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond,
|
|||
/* Instrumentation end */
|
||||
toku_instr_cond_wait_end(cond_instr, r);
|
||||
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
invariant(!mutex->locked);
|
||||
mutex->locked = true;
|
||||
mutex->owner = pthread_self();
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -399,26 +399,26 @@ inline void toku_cond_broadcast(toku_cond_t *cond) {
|
|||
inline void toku_mutex_init(const toku_instr_key &key,
|
||||
toku_mutex_t *mutex,
|
||||
const toku_pthread_mutexattr_t *attr) {
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
mutex->valid = true;
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
toku_instr_mutex_init(key, *mutex);
|
||||
const int r = pthread_mutex_init(&mutex->pmutex, attr);
|
||||
assert_zero(r);
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
mutex->locked = false;
|
||||
invariant(mutex->valid);
|
||||
mutex->valid = true;
|
||||
mutex->owner = 0;
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
}
|
||||
|
||||
inline void toku_mutex_destroy(toku_mutex_t *mutex) {
|
||||
#if TOKU_PTHREAD_DEBUG
|
||||
#if defined(TOKU_PTHREAD_DEBUG)
|
||||
invariant(mutex->valid);
|
||||
mutex->valid = false;
|
||||
invariant(!mutex->locked);
|
||||
#endif
|
||||
#endif // defined(TOKU_PTHREAD_DEBUG)
|
||||
toku_instr_mutex_destroy(mutex->psi_mutex);
|
||||
int r = pthread_mutex_destroy(&mutex->pmutex);
|
||||
assert_zero(r);
|
||||
|
|
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
======= */
|
||||
|
||||
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
|
||||
|
|
|
@ -7254,6 +7254,16 @@ int ha_tokudb::create(
|
|||
tokudb_trx_data *trx = NULL;
|
||||
THD* thd = ha_thd();
|
||||
|
||||
String database_name, table_name, dictionary_name;
|
||||
tokudb_split_dname(name, database_name, table_name, dictionary_name);
|
||||
if (database_name.is_empty() || table_name.is_empty()) {
|
||||
push_warning_printf(thd,
|
||||
Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_TABLE_NAME,
|
||||
"TokuDB: Table Name or Database Name is empty");
|
||||
DBUG_RETURN(ER_TABLE_NAME);
|
||||
}
|
||||
|
||||
memset(&kc_info, 0, sizeof(kc_info));
|
||||
|
||||
#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100999
|
||||
|
|
|
@ -571,10 +571,10 @@ static int tokudb_init_func(void *p) {
|
|||
|
||||
db_env->set_update(db_env, tokudb_update_fun);
|
||||
|
||||
db_env_set_direct_io(tokudb::sysvars::directio == TRUE);
|
||||
db_env_set_direct_io(tokudb::sysvars::directio);
|
||||
|
||||
db_env_set_compress_buffers_before_eviction(
|
||||
tokudb::sysvars::compress_buffers_before_eviction == TRUE);
|
||||
tokudb::sysvars::compress_buffers_before_eviction);
|
||||
|
||||
db_env->change_fsync_log_period(db_env, tokudb::sysvars::fsync_log_period);
|
||||
|
||||
|
|
|
@ -190,7 +190,6 @@ inline bool tokudb_killed_thd_callback(void* extra,
|
|||
return thd_kill_level(thd) != 0;
|
||||
}
|
||||
|
||||
extern HASH tokudb_open_tables;
|
||||
extern const char* tokudb_hton_name;
|
||||
extern int tokudb_hton_initialized;
|
||||
extern tokudb::thread::rwlock_t tokudb_hton_initialized_lock;
|
||||
|
|
2
storage/tokudb/mysql-test/tokudb_bugs/r/PS-4979.result
Normal file
2
storage/tokudb/mysql-test/tokudb_bugs/r/PS-4979.result
Normal file
|
@ -0,0 +1,2 @@
|
|||
CREATE TABLE `#mysql50#q.q`(f1 INT KEY) ENGINE=TOKUDB;
|
||||
ERROR 42000: Incorrect table name '#mysql50#q.q'
|
13
storage/tokudb/mysql-test/tokudb_bugs/t/PS-4979.test
Normal file
13
storage/tokudb/mysql-test/tokudb_bugs/t/PS-4979.test
Normal file
|
@ -0,0 +1,13 @@
|
|||
--source include/have_tokudb.inc
|
||||
# PS-4979 : Dropping TokuDB table with non-alphanumeric characters could lead
|
||||
# to a crash
|
||||
#
|
||||
# `#mysql50#q.q` is an invalid table name, but the server side doesn't detect it
|
||||
# and complain. Instead it passes in an empty table name to the engine. The
|
||||
# engine expects a table name in the form of a relative path like
|
||||
# "./databasename/tablename". InnoDB detects this in parsing the table name
|
||||
# during the creation and returns an error.
|
||||
# MariaDB server detect above error.
|
||||
|
||||
--error ER_WRONG_TABLE_NAME
|
||||
CREATE TABLE `#mysql50#q.q`(f1 INT KEY) ENGINE=TOKUDB;
|
|
@ -182,14 +182,14 @@ void* job_manager_t::real_thread_func() {
|
|||
if (res == tokudb::thread::semaphore_t::E_INTERRUPTED || _shutdown) {
|
||||
break;
|
||||
} else if (res == tokudb::thread::semaphore_t::E_SIGNALLED) {
|
||||
#if TOKUDB_DEBUG
|
||||
#if defined(TOKUDB_DEBUG)
|
||||
if (TOKUDB_UNLIKELY(
|
||||
tokudb::sysvars::debug_pause_background_job_manager)) {
|
||||
_sem.signal();
|
||||
tokudb::time::sleep_microsec(250000);
|
||||
continue;
|
||||
}
|
||||
#endif // TOKUDB_DEBUG
|
||||
#endif // defined(TOKUDB_DEBUG)
|
||||
|
||||
mutex_t_lock(_mutex);
|
||||
assert_debug(_background_jobs.size() > 0);
|
||||
|
|
|
@ -661,13 +661,13 @@ static MYSQL_THDVAR_ULONGLONG(
|
|||
~0ULL,
|
||||
1);
|
||||
|
||||
static MYSQL_THDVAR_STR(
|
||||
last_lock_timeout,
|
||||
PLUGIN_VAR_MEMALLOC,
|
||||
"last lock timeout",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
static MYSQL_THDVAR_STR(last_lock_timeout,
|
||||
PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_NOCMDOPT |
|
||||
PLUGIN_VAR_READONLY,
|
||||
"last lock timeout",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
static MYSQL_THDVAR_BOOL(
|
||||
load_save_space,
|
||||
|
|
|
@ -113,10 +113,10 @@ extern my_bool gdb_on_fatal;
|
|||
|
||||
extern my_bool check_jemalloc;
|
||||
|
||||
#if TOKUDB_DEBUG
|
||||
#if defined(TOKUDB_DEBUG)
|
||||
// used to control background job manager
|
||||
extern my_bool debug_pause_background_job_manager;
|
||||
#endif // TOKUDB_DEBUG
|
||||
#endif // defined(TOKUDB_DEBUG)
|
||||
|
||||
// session/thread
|
||||
my_bool alter_print_error(THD* thd);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2005, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2013, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -3811,12 +3811,14 @@ check_if_ok_to_rename:
|
|||
continue;
|
||||
}
|
||||
|
||||
dict_foreign_t* foreign;
|
||||
|
||||
for (dict_foreign_set::iterator it
|
||||
= prebuilt->table->foreign_set.begin();
|
||||
it != prebuilt->table->foreign_set.end();
|
||||
++it) {
|
||||
|
||||
dict_foreign_t* foreign = *it;
|
||||
foreign = *it;
|
||||
const char* fid = strchr(foreign->id, '/');
|
||||
|
||||
DBUG_ASSERT(fid);
|
||||
|
@ -3827,7 +3829,6 @@ check_if_ok_to_rename:
|
|||
|
||||
if (!my_strcasecmp(system_charset_info,
|
||||
fid, drop->name)) {
|
||||
drop_fk[n_drop_fk++] = foreign;
|
||||
goto found_fk;
|
||||
}
|
||||
}
|
||||
|
@ -3836,12 +3837,19 @@ check_if_ok_to_rename:
|
|||
drop->name);
|
||||
goto err_exit;
|
||||
found_fk:
|
||||
for (ulint i = n_drop_fk; i--; ) {
|
||||
if (drop_fk[i] == foreign) {
|
||||
goto dup_fk;
|
||||
}
|
||||
}
|
||||
drop_fk[n_drop_fk++] = foreign;
|
||||
dup_fk:
|
||||
continue;
|
||||
}
|
||||
|
||||
DBUG_ASSERT(n_drop_fk > 0);
|
||||
DBUG_ASSERT(n_drop_fk
|
||||
== ha_alter_info->alter_info->drop_list.elements);
|
||||
<= ha_alter_info->alter_info->drop_list.elements);
|
||||
} else {
|
||||
drop_fk = NULL;
|
||||
}
|
||||
|
@ -4712,7 +4720,7 @@ err_exit:
|
|||
rename_foreign:
|
||||
trx->op_info = "renaming column in SYS_FOREIGN_COLS";
|
||||
|
||||
std::list<dict_foreign_t*> fk_evict;
|
||||
std::set<dict_foreign_t*> fk_evict;
|
||||
bool foreign_modified;
|
||||
|
||||
for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin();
|
||||
|
@ -4752,7 +4760,7 @@ rename_foreign:
|
|||
}
|
||||
|
||||
if (foreign_modified) {
|
||||
fk_evict.push_back(foreign);
|
||||
fk_evict.insert(foreign);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4794,7 +4802,7 @@ rename_foreign:
|
|||
}
|
||||
|
||||
if (foreign_modified) {
|
||||
fk_evict.push_back(foreign);
|
||||
fk_evict.insert(foreign);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5190,7 +5198,7 @@ commit_try_rebuild(
|
|||
& Alter_inplace_info::DROP_FOREIGN_KEY)
|
||||
|| ctx->num_to_drop_fk > 0);
|
||||
DBUG_ASSERT(ctx->num_to_drop_fk
|
||||
== ha_alter_info->alter_info->drop_list.elements);
|
||||
<= ha_alter_info->alter_info->drop_list.elements);
|
||||
|
||||
for (dict_index_t* index = dict_table_get_first_index(rebuilt_table);
|
||||
index;
|
||||
|
@ -5444,7 +5452,7 @@ commit_try_norebuild(
|
|||
& Alter_inplace_info::DROP_FOREIGN_KEY)
|
||||
|| ctx->num_to_drop_fk > 0);
|
||||
DBUG_ASSERT(ctx->num_to_drop_fk
|
||||
== ha_alter_info->alter_info->drop_list.elements);
|
||||
<= ha_alter_info->alter_info->drop_list.elements);
|
||||
|
||||
for (ulint i = 0; i < ctx->num_to_add_index; i++) {
|
||||
dict_index_t* index = ctx->add_index[i];
|
||||
|
@ -5765,7 +5773,6 @@ ha_innobase::commit_inplace_alter_table(
|
|||
Alter_inplace_info* ha_alter_info,
|
||||
bool commit)
|
||||
{
|
||||
dberr_t error;
|
||||
ha_innobase_inplace_ctx* ctx0
|
||||
= static_cast<ha_innobase_inplace_ctx*>
|
||||
(ha_alter_info->handler_ctx);
|
||||
|
@ -5845,7 +5852,7 @@ ha_innobase::commit_inplace_alter_table(
|
|||
transactions collected during crash recovery could be
|
||||
holding InnoDB locks only, not MySQL locks. */
|
||||
|
||||
error = row_merge_lock_table(
|
||||
dberr_t error = row_merge_lock_table(
|
||||
prebuilt->trx, ctx->old_table, LOCK_X);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
|
@ -6030,9 +6037,9 @@ rollback_trx:
|
|||
file operations that will be performed in
|
||||
commit_cache_rebuild(), and if none, generate
|
||||
the redo log for these operations. */
|
||||
error = fil_mtr_rename_log(ctx->old_table,
|
||||
ctx->new_table,
|
||||
ctx->tmp_name, &mtr);
|
||||
dberr_t error = fil_mtr_rename_log(
|
||||
ctx->old_table, ctx->new_table, ctx->tmp_name,
|
||||
&mtr);
|
||||
if (error != DB_SUCCESS) {
|
||||
/* Out of memory or a problem will occur
|
||||
when renaming files. */
|
||||
|
@ -6157,39 +6164,30 @@ rollback_trx:
|
|||
/* Rename the tablespace files. */
|
||||
commit_cache_rebuild(ctx);
|
||||
|
||||
error = innobase_update_foreign_cache(ctx, user_thd);
|
||||
if (error != DB_SUCCESS) {
|
||||
goto foreign_fail;
|
||||
if (innobase_update_foreign_cache(ctx, user_thd)
|
||||
!= DB_SUCCESS
|
||||
&& prebuilt->trx->check_foreigns) {
|
||||
foreign_fail:
|
||||
push_warning_printf(
|
||||
user_thd,
|
||||
Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_ALTER_INFO,
|
||||
"failed to load FOREIGN KEY"
|
||||
" constraints");
|
||||
}
|
||||
} else {
|
||||
error = innobase_update_foreign_cache(ctx, user_thd);
|
||||
bool fk_fail = innobase_update_foreign_cache(
|
||||
ctx, user_thd) != DB_SUCCESS;
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
foreign_fail:
|
||||
/* The data dictionary cache
|
||||
should be corrupted now. The
|
||||
best solution should be to
|
||||
kill and restart the server,
|
||||
but the *.frm file has not
|
||||
been replaced yet. */
|
||||
my_error(ER_CANNOT_ADD_FOREIGN,
|
||||
MYF(0));
|
||||
sql_print_error(
|
||||
"InnoDB: dict_load_foreigns()"
|
||||
" returned %u for %s",
|
||||
(unsigned) error,
|
||||
thd_query_string(user_thd)
|
||||
->str);
|
||||
ut_ad(0);
|
||||
} else {
|
||||
if (!commit_cache_norebuild(
|
||||
ctx, table, trx)) {
|
||||
ut_a(!prebuilt->trx->check_foreigns);
|
||||
}
|
||||
if (!commit_cache_norebuild(ctx, table, trx)) {
|
||||
fk_fail = true;
|
||||
ut_ad(!prebuilt->trx->check_foreigns);
|
||||
}
|
||||
|
||||
innobase_rename_columns_cache(
|
||||
ha_alter_info, table,
|
||||
ctx->new_table);
|
||||
innobase_rename_columns_cache(ha_alter_info, table,
|
||||
ctx->new_table);
|
||||
if (fk_fail && prebuilt->trx->check_foreigns) {
|
||||
goto foreign_fail;
|
||||
}
|
||||
}
|
||||
DBUG_INJECT_CRASH("ib_commit_inplace_crash",
|
||||
|
|
|
@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri
|
|||
|
||||
#define INNODB_VERSION_MAJOR 5
|
||||
#define INNODB_VERSION_MINOR 6
|
||||
#define INNODB_VERSION_BUGFIX 41
|
||||
#define INNODB_VERSION_BUGFIX 42
|
||||
|
||||
#ifndef PERCONA_INNODB_VERSION
|
||||
#define PERCONA_INNODB_VERSION 84.1
|
||||
#define PERCONA_INNODB_VERSION 84.2
|
||||
#endif
|
||||
|
||||
/* Enable UNIV_LOG_ARCHIVE in XtraDB */
|
||||
|
|
|
@ -1864,6 +1864,8 @@ log_online_purge_changed_page_bitmaps(
|
|||
|
||||
for (i = 0; i < bitmap_files.count; i++) {
|
||||
|
||||
char full_bmp_file_name[2 * FN_REFLEN + 2];
|
||||
|
||||
/* We consider the end LSN of the current bitmap, derived from
|
||||
the start LSN of the subsequent bitmap file, to determine
|
||||
whether to remove the current bitmap. Note that bitmap_files
|
||||
|
@ -1879,8 +1881,45 @@ log_online_purge_changed_page_bitmaps(
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
/* In some non-trivial cases the sequence of .xdb files may
|
||||
have gaps. For instance:
|
||||
ib_modified_log_1_0.xdb
|
||||
ib_modified_log_2_<mmm>.xdb
|
||||
ib_modified_log_4_<nnn>.xdb
|
||||
Adding this check as a safety precaution. */
|
||||
if (bitmap_files.files[i].name[0] == '\0')
|
||||
continue;
|
||||
|
||||
/* If redo log tracking is enabled, reuse 'bmp_file_home'
|
||||
from 'log_bmp_sys'. Otherwise, compose the full '.xdb' file
|
||||
path from 'srv_data_home', adding a path separator if
|
||||
necessary. */
|
||||
if (log_bmp_sys != NULL) {
|
||||
ut_snprintf(full_bmp_file_name,
|
||||
sizeof(full_bmp_file_name),
|
||||
"%s%s", log_bmp_sys->bmp_file_home,
|
||||
bitmap_files.files[i].name);
|
||||
}
|
||||
else {
|
||||
char separator[2] = {0, 0};
|
||||
const size_t srv_data_home_len =
|
||||
strlen(srv_data_home);
|
||||
|
||||
ut_a(srv_data_home_len < FN_REFLEN);
|
||||
if (srv_data_home_len != 0 &&
|
||||
srv_data_home[srv_data_home_len - 1] !=
|
||||
SRV_PATH_SEPARATOR) {
|
||||
separator[0] = SRV_PATH_SEPARATOR;
|
||||
}
|
||||
ut_snprintf(full_bmp_file_name,
|
||||
sizeof(full_bmp_file_name), "%s%s%s",
|
||||
srv_data_home, separator,
|
||||
bitmap_files.files[i].name);
|
||||
}
|
||||
|
||||
if (!os_file_delete_if_exists(innodb_file_bmp_key,
|
||||
bitmap_files.files[i].name)) {
|
||||
full_bmp_file_name)) {
|
||||
|
||||
os_file_get_last_error(TRUE);
|
||||
result = TRUE;
|
||||
|
|
|
@ -5132,18 +5132,6 @@ row_rename_table_for_mysql(
|
|||
goto funct_exit;
|
||||
}
|
||||
|
||||
/* Wait for background fts sync to finish */
|
||||
for (retry = 1; dict_fts_index_syncing(table); ++retry) {
|
||||
DICT_BG_YIELD(trx);
|
||||
if (retry % 100 == 0) {
|
||||
ib_logf(IB_LOG_LEVEL_INFO,
|
||||
"Unable to rename table %s to new name"
|
||||
" %s because FTS sync is running on table."
|
||||
" Retrying\n",
|
||||
old_name, new_name);
|
||||
}
|
||||
}
|
||||
|
||||
/* We use the private SQL parser of Innobase to generate the query
|
||||
graphs needed in updating the dictionary data from system tables. */
|
||||
|
||||
|
|
|
@ -185,7 +185,11 @@ fi
|
|||
user='@MYSQLD_USER@'
|
||||
|
||||
su_kill() {
|
||||
su - $user -s /bin/sh -c "kill $*" >/dev/null 2>&1
|
||||
if test "$USER" = "$user"; then
|
||||
kill $* >/dev/null 2>&1
|
||||
else
|
||||
su - $user -s /bin/sh -c "kill $*" >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
|
|
|
@ -34,7 +34,7 @@ void test_concurrently(const char *test, pthread_handler handler, int n, int m)
|
|||
bad= 0;
|
||||
|
||||
diag("Testing %s with %d threads, %d iterations... ", test, n, m);
|
||||
for (i= n; i; i--)
|
||||
for (i= 0; i < n; i++)
|
||||
{
|
||||
if (pthread_create(&threads[i], 0, handler, &m) != 0)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ void test_concurrently(const char *test, pthread_handler handler, int n, int m)
|
|||
}
|
||||
}
|
||||
|
||||
for (i= n; i; i--)
|
||||
for (i= 0; i < n; i++)
|
||||
pthread_join(threads[i], 0);
|
||||
|
||||
now= my_interval_timer() - now;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue