Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f80e4ed9
Commit
f80e4ed9
authored
Oct 01, 2014
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.0-connect -> 10.0
parents
e2567fb6
38c3fd20
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
457 additions
and
53 deletions
+457
-53
storage/connect/array.cpp
storage/connect/array.cpp
+6
-4
storage/connect/filamap.cpp
storage/connect/filamap.cpp
+3
-3
storage/connect/filamap.h
storage/connect/filamap.h
+1
-1
storage/connect/filamtxt.cpp
storage/connect/filamtxt.cpp
+1
-1
storage/connect/filter.cpp
storage/connect/filter.cpp
+27
-1
storage/connect/global.h
storage/connect/global.h
+4
-1
storage/connect/mysql-test/connect/r/datest.result
storage/connect/mysql-test/connect/r/datest.result
+32
-0
storage/connect/mysql-test/connect/r/mrr.result
storage/connect/mysql-test/connect/r/mrr.result
+117
-0
storage/connect/mysql-test/connect/r/updelx2.result
storage/connect/mysql-test/connect/r/updelx2.result
+133
-0
storage/connect/mysql-test/connect/t/datest.test
storage/connect/mysql-test/connect/t/datest.test
+16
-0
storage/connect/mysql-test/connect/t/mrr.test
storage/connect/mysql-test/connect/t/mrr.test
+66
-0
storage/connect/mysql-test/connect/t/updelx2.test
storage/connect/mysql-test/connect/t/updelx2.test
+22
-0
storage/connect/plgdbsem.h
storage/connect/plgdbsem.h
+1
-1
storage/connect/tabdos.cpp
storage/connect/tabdos.cpp
+5
-8
storage/connect/tabmysql.cpp
storage/connect/tabmysql.cpp
+3
-2
storage/connect/tabutil.h
storage/connect/tabutil.h
+1
-1
storage/connect/tabwmi.cpp
storage/connect/tabwmi.cpp
+1
-1
storage/connect/tabxcl.cpp
storage/connect/tabxcl.cpp
+17
-3
storage/connect/tabxcl.h
storage/connect/tabxcl.h
+1
-0
storage/connect/value.cpp
storage/connect/value.cpp
+0
-26
No files found.
storage/connect/array.cpp
View file @
f80e4ed9
...
...
@@ -25,6 +25,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdint.h> // for uintprt_h
#endif // !WIN32
/***********************************************************************/
...
...
@@ -129,7 +130,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp)
break
;
case
TYPE_VOID
:
// Integer stored inside pp->Value
par
->
AddValue
(
g
,
(
int
)
parmp
->
Value
);
par
->
AddValue
(
g
,
parmp
->
Intval
);
break
;
}
// endswitch valtyp
...
...
@@ -585,7 +586,7 @@ bool ARRAY::CanBeShort(void)
/***********************************************************************/
int
ARRAY
::
Convert
(
PGLOBAL
g
,
int
k
,
PVAL
vp
)
{
int
i
;
int
i
,
prec
=
0
;
bool
b
=
FALSE
;
PMBV
ovblk
=
Valblk
;
PVBLK
ovblp
=
Vblp
;
...
...
@@ -595,6 +596,7 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp)
switch
(
Type
)
{
case
TYPE_DOUBLE
:
prec
=
2
;
case
TYPE_SHORT
:
case
TYPE_INT
:
case
TYPE_DATE
:
...
...
@@ -607,13 +609,13 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp)
Size
=
Nval
;
Nval
=
0
;
Vblp
=
Valblk
->
Allocate
(
g
,
Type
,
Len
,
0
,
Size
);
Vblp
=
Valblk
->
Allocate
(
g
,
Type
,
Len
,
prec
,
Size
);
if
(
!
Valblk
->
GetMemp
())
// The error message was built by PlgDBalloc
return
TYPE_ERROR
;
else
Value
=
AllocateValue
(
g
,
Type
,
Len
,
0
,
NULL
);
Value
=
AllocateValue
(
g
,
Type
,
Len
,
prec
,
NULL
);
/*********************************************************************/
/* Converting STRING to DATE can be done according to date format. */
...
...
storage/connect/filamap.cpp
View file @
f80e4ed9
...
...
@@ -290,8 +290,8 @@ bool MAPFAM::RecordPos(PGLOBAL g)
/***********************************************************************/
int
MAPFAM
::
InitDelete
(
PGLOBAL
g
,
int
fpos
,
int
spos
)
{
Fpos
=
Memory
+
fpos
;
Mempos
=
Memory
+
spos
;
Fpos
=
Memory
+
(
ptrdiff_t
)
fpos
;
Mempos
=
Memory
+
(
ptrdiff_t
)
spos
;
return
RC_OK
;
}
// end of InitDelete
...
...
@@ -685,7 +685,7 @@ bool MPXFAM::SetPos(PGLOBAL g, int pos)
/***********************************************************************/
int
MPXFAM
::
InitDelete
(
PGLOBAL
g
,
int
fpos
,
int
spos
)
{
Fpos
=
Memory
+
Headlen
+
fpos
*
Lrecl
;
Fpos
=
Memory
+
Headlen
+
(
ptrdiff_t
)
fpos
*
Lrecl
;
Mempos
=
Fpos
+
Lrecl
;
return
RC_OK
;
}
// end of InitDelete
...
...
storage/connect/filamap.h
View file @
f80e4ed9
...
...
@@ -104,7 +104,7 @@ class DllExport MPXFAM : public MBKFAM {
virtual
int
MaxBlkSize
(
PGLOBAL
g
,
int
s
)
{
return
TXTFAM
::
MaxBlkSize
(
g
,
s
);}
virtual
bool
SetPos
(
PGLOBAL
g
,
int
recpos
);
virtual
int
GetNextPos
(
void
)
{
return
(
int
)
Fpos
+
Nrec
;}
virtual
int
GetNextPos
(
void
)
{
return
GetPos
()
+
1
;}
virtual
bool
DeferReading
(
void
)
{
return
false
;}
virtual
int
ReadBuffer
(
PGLOBAL
g
);
virtual
int
WriteBuffer
(
PGLOBAL
g
);
...
...
storage/connect/filamtxt.cpp
View file @
f80e4ed9
...
...
@@ -287,7 +287,7 @@ bool TXTFAM::AddListValue(PGLOBAL g, int type, void *val, PPARM *top)
// *((int*)pp->Value) = *((int*)val);
// break;
case
TYPE_VOID
:
pp
->
Value
=
(
void
*
)(
intptr
)
*
(
int
*
)
val
;
pp
->
Intval
=
*
(
int
*
)
val
;
break
;
// case TYPE_STRING:
// pp->Value = PlugSubAlloc(g, NULL, strlen((char*)val) + 1);
...
...
storage/connect/filter.cpp
View file @
f80e4ed9
...
...
@@ -63,7 +63,7 @@ static PPARM MakeParm(PGLOBAL g, PXOB xp)
}
// end of MakeParm
/***********************************************************************/
/* Routines called
externally by FILTER function.
*/
/* Routines called
internally/externally by FILTER functions.
*/
/***********************************************************************/
bool
PlugEvalLike
(
PGLOBAL
,
LPCSTR
,
LPCSTR
,
bool
);
//bool ReadSubQuery(PGLOBAL, PSUBQ);
...
...
@@ -72,6 +72,32 @@ bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
BYTE
OpBmp
(
PGLOBAL
g
,
OPVAL
opc
);
PARRAY
MakeValueArray
(
PGLOBAL
g
,
PPARM
pp
);
/***********************************************************************/
/* Returns the bitmap representing the conditions that must not be */
/* met when returning from TestValue for a given operator. */
/* Bit one is EQ, bit 2 is LT, and bit 3 is GT. */
/***********************************************************************/
BYTE
OpBmp
(
PGLOBAL
g
,
OPVAL
opc
)
{
BYTE
bt
;
switch
(
opc
)
{
case
OP_IN
:
case
OP_EQ
:
bt
=
0x06
;
break
;
case
OP_NE
:
bt
=
0x01
;
break
;
case
OP_GT
:
bt
=
0x03
;
break
;
case
OP_GE
:
bt
=
0x02
;
break
;
case
OP_LT
:
bt
=
0x05
;
break
;
case
OP_LE
:
bt
=
0x04
;
break
;
case
OP_EXIST
:
bt
=
0x00
;
break
;
default:
sprintf
(
g
->
Message
,
MSG
(
BAD_FILTER_OP
),
opc
);
longjmp
(
g
->
jumper
[
g
->
jump_level
],
TYPE_ARRAY
);
}
// endswitch opc
return
bt
;
}
// end of OpBmp
/***********************************************************************/
/* Routines called externally by CondFilter. */
/***********************************************************************/
...
...
storage/connect/global.h
View file @
f80e4ed9
...
...
@@ -205,7 +205,10 @@ typedef struct _activity { /* Describes activity and language */
/*---------------- UNIT ?????????? VERSION ? ----------------------*/
typedef
struct
_parm
{
union
{
void
*
Value
;
int
Intval
;
};
// end union
short
Type
,
Domain
;
PPARM
Next
;
}
PARM
;
...
...
storage/connect/mysql-test/connect/r/datest.result
0 → 100644
View file @
f80e4ed9
#
# Testing out of range dates as (var)char
#
CREATE TABLE t1 (
id INT NOT NULL,
dat CHAR(10) NOT NULL,
tim CHAR(8) DEFAULT '09:35:08',
datim CHAR(19) DEFAULT '1789-08-10 14:20:30')
ENGINE=CONNECT TABLE_TYPE=FIX;
Warnings:
Warning 1105 No file name. Table will use t1.fix
INSERT INTO t1(id,dat) VALUES(1,'1515-04-01'),(2,'2014-07-26'),(3,'2118-11-02');
SELECT * FROM t1;
id dat tim datim
1 1515-04-01 09:35:08 1789-08-10 14:20:30
2 2014-07-26 09:35:08 1789-08-10 14:20:30
3 2118-11-02 09:35:08 1789-08-10 14:20:30
SELECT id, DATE(datim) FROM t1 LIMIT 1;
id DATE(datim)
1 1789-08-10
SELECT id, DAYNAME(dat) FROM t1;
id DAYNAME(dat)
1 Thursday
2 Saturday
3 Wednesday
SELECT id, DAYNAME(datim) FROM t1 LIMIT 1;
id DAYNAME(datim)
1 Monday
SELECT id, TIME(tim) FROM t1 LIMIT 1;
id TIME(tim)
1 09:35:08.000000
DROP TABLE t1;
storage/connect/mysql-test/connect/r/mrr.result
0 → 100644
View file @
f80e4ed9
#
# Show MRR setting. The way it is done is because the t3 table cannot be directly based on
# the information_schema.session_variables table. Not being a CONNECT table, it would be
# read using an intermediate MYSQL table using the MySQL API and could not reflect the
# current session variable change (the call would create another session) This would be
# correct only for querying GLOBAL variables but is not what we want to do here.
#
CREATE TABLE t2 (
name VARCHAR(64) NOT NULL,
value VARCHAR(1024) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DOS;
Warnings:
Warning 1105 No file name. Table will use t2.dos
INSERT INTO t2 SELECT * FROM information_schema.session_variables WHERE variable_name = 'OPTIMIZER_SWITCH';
create table t3 (
name CHAR(32) NOT NULL,
value CHAR(64) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=t2 OPTION_LIST='Colname=value';
SELECT value FROM t3 WHERE value LIKE 'mrr%';
value
mrr=off
mrr_cost_based=off
mrr_sort_keys=off
#
# Testing indexing with MRR OFF
#
CREATE TABLE t1
(
matricule INT(4) KEY NOT NULL field_format='Z',
nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F',
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5) NOT NULL,
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2;
SELECT * FROM t1 LIMIT 10;
matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation
5745 ESCOURCHE BENEDICTE 2 1935 7 1962-12-01 1994-05-01 18345 14275.50 0 M TECHN
9692 VICENTE LAURENCE 2 1941 8 1967-10-01 1989-01-01 16212 13032.80 0 M ANGL
9146 NICOLAS ROGER 1 1941 6 1964-07-01 1995-02-01 34173 25098.65 0 M SANS
2985 TESSEREAU MARIE HELENE 2 1941 9 1967-01-01 1990-01-01 19323 14933.78 0 V SANS
3368 MOGADOR ALAIN 1 1941 1 1961-09-01 1993-11-01 43303 31420.55 0 C SANS
7394 CHAUSSEE ERIC DENIS 1 1944 9 1965-11-01 1983-12-01 32002 23583.86 0 M ANGL
4655 MAILLOT GEORGES 1 1945 5 1970-09-01 1986-12-01 24700 18541.64 0 C ANGL
2825 CAMILLE NADINE 2 1956 9 1994-01-01 1993-01-01 19494 15050.45 0 M SANS
1460 BRUYERES JEAN MARC 1 1958 8 1984-08-01 1988-05-01 20902 15980.07 0 M SANS
4974 LONES GERARD 1 1959 10 1979-01-01 1994-12-01 16081 12916.70 0 M SANS
# Without MRR, the rows are retrieved sorted by name
SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI');
matricule nom prenom sitmat net
5324 CERF CLAUDE M 9503.34
7703 CERF NICOLE M 12025.61
3110 CERF VALERIE M 10472.37
4454 ETANG BEATRICE M 11017.61
1022 ETANG GERARD L 8729.58
8222 ETANG LIONEL M 13497.90
2492 ETANG PASCAL VINCENT M 11986.62
1977 FOCH BERNADETTE . 8145.03
5707 FOCH DENIS C 7679.36
2552 FOCH FRANCK M 10745.81
2634 FOCH JOCELYNE M 10473.09
5765 FOCH ROBERT M 12916.32
4080 FOCH SERGE M 9658.24
5898 ITALIE DENIS M 9502.41
7606 ITALIE JACQUES C 7679.45
1067 ITALIE SVETLANA M 11713.61
5853 ROI CHANTAL . 8147.06
2995 ROI JEAN M 11715.50
2531 ROI MICHEL L 10240.44
5846 ROI PATRICIA M 15669.57
#
# Testing indexing with MRR ON
#
SET @@LOCAL.OPTIMIZER_SWITCH='mrr=on';
# Refresh the t2 table to reflect the change
UPDATE t2, information_schema.session_variables SET value = variable_value WHERE variable_name = 'OPTIMIZER_SWITCH';
# Check that MRR is ON for the session
SELECT value FROM t3 WHERE value LIKE 'mrr%';
value
mrr=on
mrr_cost_based=off
mrr_sort_keys=off
# With MRR, the rows are retrieved sorted by their position in the table
SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI');
matricule nom prenom sitmat net
1977 FOCH BERNADETTE . 8145.03
2995 ROI JEAN M 11715.50
3110 CERF VALERIE M 10472.37
5324 CERF CLAUDE M 9503.34
4080 FOCH SERGE M 9658.24
4454 ETANG BEATRICE M 11017.61
5898 ITALIE DENIS M 9502.41
2552 FOCH FRANCK M 10745.81
2531 ROI MICHEL L 10240.44
5853 ROI CHANTAL . 8147.06
8222 ETANG LIONEL M 13497.90
5707 FOCH DENIS C 7679.36
1067 ITALIE SVETLANA M 11713.61
7606 ITALIE JACQUES C 7679.45
7703 CERF NICOLE M 12025.61
2634 FOCH JOCELYNE M 10473.09
1022 ETANG GERARD L 8729.58
5846 ROI PATRICIA M 15669.57
2492 ETANG PASCAL VINCENT M 11986.62
5765 FOCH ROBERT M 12916.32
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
SET @@LOCAL.OPTIMIZER_SWITCH='mrr=off';
storage/connect/mysql-test/connect/r/updelx2.result
0 → 100644
View file @
f80e4ed9
#
# Testing multiple indexed UPDATE and DELETE
#
CREATE TABLE t1 (
id INT(4) NOT NULL,
msg VARCHAR(16) NOT NULL,
INDEX IDM(id,msg))
ENGINE=CONNECT TABLE_TYPE=DOS;
Warnings:
Warning 1105 No file name. Table will use t1.dos
INSERT INTO t1 VALUES(1,'one'),(4, 'four'),(7,'seven'),(8,'eight'),(10,'ten'),(11,'eleven'),(40,'forty'),(35,'thirty five'),(60,'sixty'),(72,'seventy two'),(81,'eighty one');
INSERT INTO t1 VALUES(1,'un'),(4, 'quatre'),(7,'sept'),(8,'huit'),(10,'dix'),(11,'onze'),(40,'quarante'),(35,'trente cinq'),(60,'soixante'),(72,'soixante douze'),(81,'quatrevingt un');
SELECT * FROM t1 IGNORE INDEX (IDM);
id msg
1 one
4 four
7 seven
8 eight
10 ten
11 eleven
40 forty
35 thirty five
60 sixty
72 seventy two
81 eighty one
1 un
4 quatre
7 sept
8 huit
10 dix
11 onze
40 quarante
35 trente cinq
60 soixante
72 soixante douze
81 quatrevingt un
UPDATE t1 SET msg = 'dieci' WHERE id = 10;
SELECT * FROM t1 IGNORE INDEX (IDM);
id msg
1 one
4 four
7 seven
8 eight
10 dieci
11 eleven
40 forty
35 thirty five
60 sixty
72 seventy two
81 eighty one
1 un
4 quatre
7 sept
8 huit
10 dieci
11 onze
40 quarante
35 trente cinq
60 soixante
72 soixante douze
81 quatrevingt un
UPDATE t1 SET msg = 'septante deux' WHERE id = 72;
SELECT * FROM t1 IGNORE INDEX (IDM);
id msg
1 one
4 four
7 seven
8 eight
10 dieci
11 eleven
40 forty
35 thirty five
60 sixty
72 septante deux
81 eighty one
1 un
4 quatre
7 sept
8 huit
10 dieci
11 onze
40 quarante
35 trente cinq
60 soixante
72 septante deux
81 quatrevingt un
UPDATE t1 SET id=2, msg='deux' WHERE id=4 AND msg='quatre';
SELECT * FROM t1 IGNORE INDEX (IDM);
id msg
1 one
4 four
7 seven
8 eight
10 dieci
11 eleven
40 forty
35 thirty five
60 sixty
72 septante deux
81 eighty one
1 un
2 deux
7 sept
8 huit
10 dieci
11 onze
40 quarante
35 trente cinq
60 soixante
72 septante deux
81 quatrevingt un
DELETE FROM t1 WHERE id IN (8,40);
SELECT * FROM t1 IGNORE INDEX (IDM);
id msg
1 one
4 four
7 seven
10 dieci
11 eleven
35 thirty five
60 sixty
72 septante deux
81 eighty one
1 un
2 deux
7 sept
10 dieci
11 onze
35 trente cinq
60 soixante
72 septante deux
81 quatrevingt un
DROP TABLE t1;
storage/connect/mysql-test/connect/t/datest.test
0 → 100644
View file @
f80e4ed9
--
echo
#
--
echo
# Testing out of range dates as (var)char
--
echo
#
CREATE
TABLE
t1
(
id
INT
NOT
NULL
,
dat
CHAR
(
10
)
NOT
NULL
,
tim
CHAR
(
8
)
DEFAULT
'09:35:08'
,
datim
CHAR
(
19
)
DEFAULT
'1789-08-10 14:20:30'
)
ENGINE
=
CONNECT
TABLE_TYPE
=
FIX
;
INSERT
INTO
t1
(
id
,
dat
)
VALUES
(
1
,
'1515-04-01'
),(
2
,
'2014-07-26'
),(
3
,
'2118-11-02'
);
SELECT
*
FROM
t1
;
SELECT
id
,
DATE
(
datim
)
FROM
t1
LIMIT
1
;
SELECT
id
,
DAYNAME
(
dat
)
FROM
t1
;
SELECT
id
,
DAYNAME
(
datim
)
FROM
t1
LIMIT
1
;
SELECT
id
,
TIME
(
tim
)
FROM
t1
LIMIT
1
;
DROP
TABLE
t1
;
storage/connect/mysql-test/connect/t/mrr.test
0 → 100644
View file @
f80e4ed9
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
--
copy_file
$MTR_SUITE_DIR
/
std_data
/
emp
.
txt
$MYSQLD_DATADIR
/
test
/
emp
.
txt
--
echo
#
--
echo
# Show MRR setting. The way it is done is because the t3 table cannot be directly based on
--
echo
# the information_schema.session_variables table. Not being a CONNECT table, it would be
--
echo
# read using an intermediate MYSQL table using the MySQL API and could not reflect the
--
echo
# current session variable change (the call would create another session) This would be
--
echo
# correct only for querying GLOBAL variables but is not what we want to do here.
--
echo
#
CREATE
TABLE
t2
(
name
VARCHAR
(
64
)
NOT
NULL
,
value
VARCHAR
(
1024
)
NOT
NULL
)
ENGINE
=
CONNECT
TABLE_TYPE
=
DOS
;
INSERT
INTO
t2
SELECT
*
FROM
information_schema
.
session_variables
WHERE
variable_name
=
'OPTIMIZER_SWITCH'
;
# Check that MRR is OFF by default
create
table
t3
(
name
CHAR
(
32
)
NOT
NULL
,
value
CHAR
(
64
)
NOT
NULL
)
ENGINE
=
CONNECT
TABLE_TYPE
=
XCOL
TABNAME
=
t2
OPTION_LIST
=
'Colname=value'
;
SELECT
value
FROM
t3
WHERE
value
LIKE
'mrr%'
;
--
echo
#
--
echo
# Testing indexing with MRR OFF
--
echo
#
CREATE
TABLE
t1
(
matricule
INT
(
4
)
KEY
NOT
NULL
field_format
=
'Z'
,
nom
VARCHAR
(
16
)
NOT
NULL
,
prenom
VARCHAR
(
20
)
NOT
NULL
,
sexe
SMALLINT
(
1
)
NOT
NULL
COMMENT
'sexe 1:M 2:F'
,
aanais
INT
(
4
)
NOT
NULL
,
mmnais
INT
(
2
)
NOT
NULL
,
ddentree
DATE
NOT
NULL
date_format
=
'YYYYMM'
,
ddnom
DATE
NOT
NULL
date_format
=
'YYYYMM'
,
brut
INT
(
5
)
NOT
NULL
,
net
DOUBLE
(
8
,
2
)
NOT
NULL
,
service
INT
(
2
)
NOT
NULL
,
sitmat
CHAR
(
1
)
NOT
NULL
,
formation
CHAR
(
5
)
NOT
NULL
,
INDEX
NP
(
nom
,
prenom
)
)
ENGINE
=
CONNECT
TABLE_TYPE
=
FIX
FILE_NAME
=
'emp.txt'
ENDING
=
2
;
SELECT
*
FROM
t1
LIMIT
10
;
--
echo
# Without MRR, the rows are retrieved sorted by name
SELECT
matricule
,
nom
,
prenom
,
sitmat
,
net
FROM
t1
WHERE
nom
IN
(
'ETANG'
,
'FOCH'
,
'CERF'
,
'ITALIE'
,
'ROI'
);
--
echo
#
--
echo
# Testing indexing with MRR ON
--
echo
#
SET
@@
LOCAL
.
OPTIMIZER_SWITCH
=
'mrr=on'
;
--
echo
# Refresh the t2 table to reflect the change
UPDATE
t2
,
information_schema
.
session_variables
SET
value
=
variable_value
WHERE
variable_name
=
'OPTIMIZER_SWITCH'
;
--
echo
# Check that MRR is ON for the session
SELECT
value
FROM
t3
WHERE
value
LIKE
'mrr%'
;
--
echo
# With MRR, the rows are retrieved sorted by their position in the table
SELECT
matricule
,
nom
,
prenom
,
sitmat
,
net
FROM
t1
WHERE
nom
IN
(
'ETANG'
,
'FOCH'
,
'CERF'
,
'ITALIE'
,
'ROI'
);
DROP
TABLE
t1
;
DROP
TABLE
t2
;
DROP
TABLE
t3
;
#
# Clean up
#
SET
@@
LOCAL
.
OPTIMIZER_SWITCH
=
'mrr=off'
;
--
remove_file
$MYSQLD_DATADIR
/
test
/
emp
.
txt
storage/connect/mysql-test/connect/t/updelx2.test
0 → 100644
View file @
f80e4ed9
--
source
include
/
not_embedded
.
inc
--
echo
#
--
echo
# Testing multiple indexed UPDATE and DELETE
--
echo
#
CREATE
TABLE
t1
(
id
INT
(
4
)
NOT
NULL
,
msg
VARCHAR
(
16
)
NOT
NULL
,
INDEX
IDM
(
id
,
msg
))
ENGINE
=
CONNECT
TABLE_TYPE
=
DOS
;
INSERT
INTO
t1
VALUES
(
1
,
'one'
),(
4
,
'four'
),(
7
,
'seven'
),(
8
,
'eight'
),(
10
,
'ten'
),(
11
,
'eleven'
),(
40
,
'forty'
),(
35
,
'thirty five'
),(
60
,
'sixty'
),(
72
,
'seventy two'
),(
81
,
'eighty one'
);
INSERT
INTO
t1
VALUES
(
1
,
'un'
),(
4
,
'quatre'
),(
7
,
'sept'
),(
8
,
'huit'
),(
10
,
'dix'
),(
11
,
'onze'
),(
40
,
'quarante'
),(
35
,
'trente cinq'
),(
60
,
'soixante'
),(
72
,
'soixante douze'
),(
81
,
'quatrevingt un'
);
SELECT
*
FROM
t1
IGNORE
INDEX
(
IDM
);
UPDATE
t1
SET
msg
=
'dieci'
WHERE
id
=
10
;
SELECT
*
FROM
t1
IGNORE
INDEX
(
IDM
);
UPDATE
t1
SET
msg
=
'septante deux'
WHERE
id
=
72
;
SELECT
*
FROM
t1
IGNORE
INDEX
(
IDM
);
UPDATE
t1
SET
id
=
2
,
msg
=
'deux'
WHERE
id
=
4
AND
msg
=
'quatre'
;
SELECT
*
FROM
t1
IGNORE
INDEX
(
IDM
);
DELETE
FROM
t1
WHERE
id
IN
(
8
,
40
);
SELECT
*
FROM
t1
IGNORE
INDEX
(
IDM
);
DROP
TABLE
t1
;
storage/connect/plgdbsem.h
View file @
f80e4ed9
...
...
@@ -582,7 +582,7 @@ DllExport void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size);
DllExport
void
*
PlgDBalloc
(
PGLOBAL
,
void
*
,
MBLOCK
&
);
DllExport
void
*
PlgDBrealloc
(
PGLOBAL
,
void
*
,
MBLOCK
&
,
size_t
);
DllExport
void
NewPointer
(
PTABS
,
void
*
,
void
*
);
DllExport
char
*
GetIni
(
int
n
=
0
);
//lExport char *GetIni(int n= 0); // Not used anymore
DllExport
void
SetTrc
(
void
);
DllExport
char
*
GetListOption
(
PGLOBAL
,
const
char
*
,
const
char
*
,
const
char
*
def
=
NULL
);
...
...
storage/connect/tabdos.cpp
View file @
f80e4ed9
...
...
@@ -322,7 +322,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
&&
mode
==
MODE_UPDATE
)
&&
!
(
tmp
==
TMP_FORCE
&&
(
mode
==
MODE_UPDATE
||
mode
==
MODE_DELETE
));
PTXF
txfp
;
PTXF
txfp
=
NULL
;
PTDBASE
tdbp
;
/*********************************************************************/
...
...
@@ -575,7 +575,6 @@ int TDBDOS::MakeBlockValues(PGLOBAL g)
{
int
i
,
lg
,
nrec
,
rc
,
n
=
0
;
int
curnum
,
curblk
,
block
,
savndv
,
savnbm
;
int
last
__attribute__
((
unused
));
void
*
savmin
,
*
savmax
;
bool
blocked
,
xdb2
=
false
;
//POOLHEADER save;
...
...
@@ -612,7 +611,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g)
// to Rows+1 by unblocked variable length table access methods.
curblk
=
-
1
;
curnum
=
nrec
-
1
;
last
=
0
;
//
last = 0;
Txfp
->
Block
=
block
;
// This is useful mainly for
Txfp
->
CurBlk
=
curblk
;
// blocked tables (ZLBFAM), for
Txfp
->
CurNum
=
curnum
;
// others it is just to be clean.
...
...
@@ -743,7 +742,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g)
Txfp
->
BlkPos
[
curblk
]
=
Txfp
->
GetPos
();
}
// endif CurNum
last
=
curnum
+
1
;
// curnum is zero based
//
last = curnum + 1; // curnum is zero based
Txfp
->
CurBlk
=
curblk
;
// Used in COLDOS::SetMinMax
Txfp
->
CurNum
=
curnum
;
// Used in COLDOS::SetMinMax
}
// endif blocked
...
...
@@ -1353,7 +1352,6 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv)
//bool conv = false, xdb2 = false, ok = false, b[2];
//PXOB *xarg1, *xarg2 = NULL, xp[2];
int
i
,
n
=
0
,
type
[
2
]
=
{
0
,
0
};
int
ctype
__attribute__
((
unused
));
bool
conv
=
false
,
xdb2
=
false
,
ok
=
false
;
PXOB
*
xarg2
=
NULL
,
xp
[
2
];
PCOL
colp
;
...
...
@@ -1361,12 +1359,11 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv)
//SFROW *sfr[2];
PBF
*
fp
=
NULL
,
bfp
=
NULL
;
ctype
=
TYPE_ERROR
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
switch
(
arg
[
i
]
->
GetType
())
{
case
TYPE_CONST
:
type
[
i
]
=
1
;
ctype
=
arg
[
i
]
->
GetResultType
();
//
ctype = arg[i]->GetResultType();
break
;
case
TYPE_COLBLK
:
conv
=
cnv
[
i
];
...
...
@@ -1391,7 +1388,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv)
// correlated subquery, it has a constant value during
// each execution of the subquery.
type
[
i
]
=
1
;
ctype
=
arg
[
i
]
->
GetResultType
();
//
ctype = arg[i]->GetResultType();
}
// endif this
break
;
...
...
storage/connect/tabmysql.cpp
View file @
f80e4ed9
...
...
@@ -888,6 +888,7 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
}
else
if
(
Mode
==
MODE_INSERT
)
{
if
(
Srcdef
)
{
strcpy
(
g
->
Message
,
"No insert into anonym views"
);
Myc
.
Close
();
return
true
;
}
// endif Srcdef
...
...
@@ -906,12 +907,12 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
}
// endif MakeInsert
if
(
m_Rc
!=
RC_FX
)
{
int
rc
__attribute__
((
unused
));
char
cmd
[
64
];
int
w
;
sprintf
(
cmd
,
"ALTER TABLE `%s` DISABLE KEYS"
,
Tabname
);
rc
=
Myc
.
ExecSQL
(
g
,
cmd
,
&
w
);
// may fail for some engines
m_Rc
=
Myc
.
ExecSQL
(
g
,
cmd
,
&
w
);
// may fail for some engines
}
// endif m_Rc
}
else
...
...
storage/connect/tabutil.h
View file @
f80e4ed9
...
...
@@ -114,7 +114,7 @@ class DllExport PRXCOL : public COLBLK {
{
return
false
;}
virtual
void
ReadColumn
(
PGLOBAL
g
);
virtual
void
WriteColumn
(
PGLOBAL
g
);
bool
Init
(
PGLOBAL
g
,
PTDBASE
tp
=
NULL
);
virtual
bool
Init
(
PGLOBAL
g
,
PTDBASE
tp
=
NULL
);
protected:
// Default constructor not to be used
...
...
storage/connect/tabwmi.cpp
View file @
f80e4ed9
...
...
@@ -200,7 +200,7 @@ PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *cls, bool info)
}
// endif res
len
=
(
unsigned
)
SysStringLen
(
propname
);
length
[
0
]
=
max
(
length
[
0
],
len
);
length
[
0
]
=
MY_MAX
(
length
[
0
],
len
);
}
// enfor i
res
=
SafeArrayDestroy
(
prnlist
);
...
...
storage/connect/tabxcl.cpp
View file @
f80e4ed9
...
...
@@ -184,7 +184,7 @@ bool TDBXCL::OpenDB(PGLOBAL g)
/* Check and initialize the subtable columns. */
/*********************************************************************/
for
(
PCOL
cp
=
Columns
;
cp
;
cp
=
cp
->
GetNext
())
if
(((
P
XCL
COL
)
cp
)
->
Init
(
g
))
if
(((
P
PRX
COL
)
cp
)
->
Init
(
g
))
return
TRUE
;
/*********************************************************************/
...
...
@@ -240,12 +240,25 @@ XCLCOL::XCLCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i)
:
PRXCOL
(
cdp
,
tdbp
,
cprec
,
i
,
"XCL"
)
{
// Set additional XXL access method information for column.
Cbuf
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
Long
+
1
);
Cbuf
=
NULL
;
// Will be allocated later
Cp
=
NULL
;
// Pointer to current position in Cbuf
Sep
=
((
PTDBXCL
)
tdbp
)
->
Sep
;
AddStatus
(
BUF_READ
);
// Only evaluated from TDBXCL::ReadDB
}
// end of XCLCOL constructor
/***********************************************************************/
/* XCLCOL initialization routine. */
/* Allocate Cbuf that will contain the Colp value. */
/***********************************************************************/
bool
XCLCOL
::
Init
(
PGLOBAL
g
,
PTDBASE
tp
)
{
if
(
PRXCOL
::
Init
(
g
,
tp
))
return
true
;
Cbuf
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
Colp
->
GetLength
()
+
1
);
return
false
;
}
// end of Init
/***********************************************************************/
/* What this routine does is to get the comma-separated string */
/* from the source table column, extract the single values and */
...
...
@@ -255,7 +268,8 @@ void XCLCOL::ReadColumn(PGLOBAL g)
{
if
(((
PTDBXCL
)
To_Tdb
)
->
New
)
{
Colp
->
Eval
(
g
);
strcpy
(
Cbuf
,
To_Val
->
GetCharValue
());
strncpy
(
Cbuf
,
To_Val
->
GetCharValue
(),
Colp
->
GetLength
());
Cbuf
[
Colp
->
GetLength
()]
=
0
;
Cp
=
Cbuf
;
}
// endif New
...
...
storage/connect/tabxcl.h
View file @
f80e4ed9
...
...
@@ -90,6 +90,7 @@ class XCLCOL : public PRXCOL {
// Methods
virtual
void
Reset
(
void
)
{
Colp
->
Reset
();}
// Evaluated only by TDBXCL
virtual
void
ReadColumn
(
PGLOBAL
g
);
virtual
bool
Init
(
PGLOBAL
g
,
PTDBASE
tp
=
NULL
);
protected:
// Default constructor not to be used
...
...
storage/connect/value.cpp
View file @
f80e4ed9
...
...
@@ -91,32 +91,6 @@ PSZ strlwr(PSZ s);
}
#endif // !WIN32
/***********************************************************************/
/* Returns the bitmap representing the conditions that must not be */
/* met when returning from TestValue for a given operator. */
/* Bit one is EQ, bit 2 is LT, and bit 3 is GT. */
/***********************************************************************/
BYTE
OpBmp
(
PGLOBAL
g
,
OPVAL
opc
)
{
BYTE
bt
;
switch
(
opc
)
{
case
OP_IN
:
case
OP_EQ
:
bt
=
0x06
;
break
;
case
OP_NE
:
bt
=
0x01
;
break
;
case
OP_GT
:
bt
=
0x03
;
break
;
case
OP_GE
:
bt
=
0x02
;
break
;
case
OP_LT
:
bt
=
0x05
;
break
;
case
OP_LE
:
bt
=
0x04
;
break
;
case
OP_EXIST
:
bt
=
0x00
;
break
;
default:
sprintf
(
g
->
Message
,
MSG
(
BAD_FILTER_OP
),
opc
);
longjmp
(
g
->
jumper
[
g
->
jump_level
],
TYPE_ARRAY
);
}
// endswitch opc
return
bt
;
}
// end of OpBmp
/***********************************************************************/
/* Get a long long number from its character representation. */
/* IN p: Pointer to the numeric string */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment