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
b520febb
Commit
b520febb
authored
Jul 09, 2015
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Plain Diff
Resolving conflict on ha_connect.cc
parents
0e270f73
fdd9af56
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
401 additions
and
14 deletions
+401
-14
.gitignore
.gitignore
+4
-0
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+4
-2
storage/connect/mysql-test/connect/r/endian.result
storage/connect/mysql-test/connect/r/endian.result
+105
-0
storage/connect/mysql-test/connect/r/mysql_index.result
storage/connect/mysql-test/connect/r/mysql_index.result
+114
-0
storage/connect/mysql-test/connect/t/endian.test
storage/connect/mysql-test/connect/t/endian.test
+88
-0
storage/connect/mysql-test/connect/t/mysql_index.test
storage/connect/mysql-test/connect/t/mysql_index.test
+66
-0
storage/connect/tabmysql.cpp
storage/connect/tabmysql.cpp
+20
-12
No files found.
.gitignore
View file @
b520febb
...
...
@@ -281,6 +281,10 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
*.vcproj.*
*.vcproj.*.*
*.vcproj.*.*.*
*.vcxproj
*.vcxproj.*
*.vcxproj.*.*
*.vcxproj.*.*.*
# Build results
[Dd]ebug/
...
...
storage/connect/ha_connect.cc
View file @
b520febb
...
...
@@ -169,7 +169,7 @@
#define JSONMAX 10 // JSON Default max grp size
extern
"C"
{
char
version
[]
=
"Version 1.03.0007 Ju
ne 03
, 2015"
;
char
version
[]
=
"Version 1.03.0007 Ju
ly 05
, 2015"
;
#if defined(__WIN__)
char
compver
[]
=
"Version 1.03.0007 "
__DATE__
" "
__TIME__
;
char
slash
=
'\\'
;
...
...
@@ -2237,7 +2237,9 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL op, char q,
case
OP_EQ
:
case
OP_GT
:
case
OP_GE
:
oom
|=
qry
->
Append
((
PSZ
)
GetValStr
(
op
,
false
));
case
OP_LT
:
case
OP_LE
:
oom
|=
qry
->
Append
((
PSZ
)
GetValStr
(
op
,
false
));
break
;
default:
oom
|=
qry
->
Append
(
" ??? "
);
...
...
storage/connect/mysql-test/connect/r/endian.result
0 → 100644
View file @
b520febb
SET time_zone='+00:00';
#
# Testing little endian table
#
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) NOT NULL,
birth DATE NOT NULL FIELD_FORMAT='L',
id CHAR(5) NOT NULL FIELD_FORMAT='L2',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='LF',
dept INT(4) NOT NULL FIELD_FORMAT='L2'
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat';
SELECT * FROM t1;
fig name birth id salary dept
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
123 OLIVER 1953-08-10 23456 3400.68 2158
3123 FOO 2002-07-23 888 0.00 318
INSERT INTO t1 VALUES (5555,'RONALD','1980-02-26','3333',4444.44,555);
SELECT * FROM t1;
fig name birth id salary dept
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
123 OLIVER 1953-08-10 23456 3400.68 2158
3123 FOO 2002-07-23 888 0.00 318
5555 RONALD 1980-02-26 3333 4444.44 555
DROP TABLE t1;
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) NOT NULL,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S'
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat' OPTION_LIST='Endian=Little';
SELECT * FROM t1;
fig name birth id salary dept
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
123 OLIVER 1953-08-10 23456 3400.68 2158
3123 FOO 2002-07-23 888 0.00 318
5555 RONALD 1980-02-26 3333 4444.44 555
#
# Testing big endian table
#
CREATE TABLE t2 (
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) NOT NULL,
birth DATE NOT NULL FIELD_FORMAT='B',
id CHAR(5) NOT NULL FIELD_FORMAT='BS',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='BF',
dept INT(4) NOT NULL FIELD_FORMAT='B2'
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.bin';
INSERT INTO t2 SELECT * FROM t1;
SELECT * FROM t2;
fig name birth id salary dept
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
123 OLIVER 1953-08-10 23456 3400.68 2158
3123 FOO 2002-07-23 888 0.00 318
5555 RONALD 1980-02-26 3333 4444.44 555
DROP TABLE t2;
CREATE TABLE t2 (
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) NOT NULL,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='2'
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.bin' OPTION_LIST='Endian=Big';
SELECT * FROM t2;
fig name birth id salary dept
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
123 OLIVER 1953-08-10 23456 3400.68 2158
3123 FOO 2002-07-23 888 0.00 318
5555 RONALD 1980-02-26 3333 4444.44 555
DROP TABLE t2;
CREATE TABLE t2 (
fig CHAR(4) NOT NULL,
name CHAR(10) NOT NULL,
birth DATE NOT NULL,
id SMALLINT(5) NOT NULL,
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept SMALLINT(4) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.bin' OPTION_LIST='Endian=Big';
SELECT * FROM t2;
fig name birth id salary dept
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
123 OLIVER 1953-08-10 23456 3400.68 2158
3123 FOO 2002-07-23 888 0.00 318
5555 RONALD 1980-02-26 3333 4444.44 555
DROP TABLE t2;
CREATE TABLE t2 (
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) NOT NULL,
birth DATE NOT NULL FIELD_FORMAT='B',
id CHAR(5) NOT NULL FIELD_FORMAT='BS',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='BF',
dept SMALLINT(4) NOT NULL FIELD_FORMAT='B'
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.bin';
SELECT * FROM t2;
fig name birth id salary dept
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
123 OLIVER 1953-08-10 23456 3400.68 2158
3123 FOO 2002-07-23 888 0.00 318
5555 RONALD 1980-02-26 3333 4444.44 555
DROP TABLE t1, t2;
storage/connect/mysql-test/connect/r/mysql_index.result
0 → 100644
View file @
b520febb
#
# Make remote table
#
CREATE TABLE t1 (
id int(11) NOT NULL,
msg char(100) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES(1,'Un'),(3,'Trois'),(5,'Cinq');
INSERT INTO t1 VALUES(2,'Two'),(4,'Four'),(6,'Six');
SELECT * FROM t1;
id msg
1 Un
3 Trois
5 Cinq
2 Two
4 Four
6 Six
#
# Make local MYSQL table with indexed id column
#
CREATE TABLE t2 (
id int(11) NOT NULL,
msg char(100) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=CONNECT DEFAULT CHARSET=latin1 TABLE_TYPE=MYSQL TABNAME=t1;
#
# Testing SELECT, etc.
#
SELECT * FROM t2;
id msg
1 Un
3 Trois
5 Cinq
2 Two
4 Four
6 Six
SELECT * FROM t2 WHERE id = 3;
id msg
3 Trois
SELECT * FROM t2 WHERE id IN (2,4);
id msg
2 Two
4 Four
SELECT * FROM t2 WHERE id IN (2,4) AND msg = 'Two';
id msg
2 Two
SELECT * FROM t2 WHERE id > 3;
id msg
5 Cinq
4 Four
6 Six
SELECT * FROM t2 WHERE id >= 3;
id msg
3 Trois
5 Cinq
4 Four
6 Six
SELECT * FROM t2 WHERE id < 3;
id msg
1 Un
2 Two
SELECT * FROM t2 WHERE id < 3 OR id > 4;
id msg
1 Un
2 Two
5 Cinq
6 Six
SELECT * FROM t2 WHERE id <= 3;
id msg
1 Un
2 Two
3 Trois
SELECT * FROM t2 WHERE id BETWEEN 3 AND 5;
id msg
3 Trois
4 Four
5 Cinq
SELECT * FROM t2 WHERE id > 2 AND id < 6;
id msg
3 Trois
4 Four
5 Cinq
SELECT * FROM t2 ORDER BY id;
id msg
1 Un
2 Two
3 Trois
4 Four
5 Cinq
6 Six
UPDATE t2 SET msg = 'Five' WHERE id = 5;
Warnings:
Note 1105 t1: 1 affected rows
SELECT * FROM t2;
id msg
1 Un
3 Trois
5 Five
2 Two
4 Four
6 Six
DELETE FROM t2 WHERE id = 4;
Warnings:
Note 1105 t1: 1 affected rows
SELECT * FROM t2;
id msg
1 Un
3 Trois
5 Five
2 Two
6 Six
DROP TABLE t2;
DROP TABLE t1;
storage/connect/mysql-test/connect/t/endian.test
0 → 100644
View file @
b520febb
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
--
copy_file
$MTR_SUITE_DIR
/
std_data
/
Testbal
.
dat
$MYSQLD_DATADIR
/
test
/
Testbal
.
dat
SET
time_zone
=
'+00:00'
;
--
echo
#
--
echo
# Testing little endian table
--
echo
#
CREATE
TABLE
t1
(
fig
INT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'C'
,
name
CHAR
(
10
)
NOT
NULL
,
birth
DATE
NOT
NULL
FIELD_FORMAT
=
'L'
,
id
CHAR
(
5
)
NOT
NULL
FIELD_FORMAT
=
'L2'
,
salary
DOUBLE
(
9
,
2
)
NOT
NULL
DEFAULT
0.00
FIELD_FORMAT
=
'LF'
,
dept
INT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'L2'
)
ENGINE
=
CONNECT
TABLE_TYPE
=
BIN
BLOCK_SIZE
=
5
FILE_NAME
=
'Testbal.dat'
;
SELECT
*
FROM
t1
;
INSERT
INTO
t1
VALUES
(
5555
,
'RONALD'
,
'1980-02-26'
,
'3333'
,
4444.44
,
555
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
fig
INT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'C'
,
name
CHAR
(
10
)
NOT
NULL
,
birth
DATE
NOT
NULL
,
id
CHAR
(
5
)
NOT
NULL
FIELD_FORMAT
=
'S'
,
salary
DOUBLE
(
9
,
2
)
NOT
NULL
DEFAULT
0.00
FIELD_FORMAT
=
'F'
,
dept
INT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'S'
)
ENGINE
=
CONNECT
TABLE_TYPE
=
BIN
BLOCK_SIZE
=
5
FILE_NAME
=
'Testbal.dat'
OPTION_LIST
=
'Endian=Little'
;
SELECT
*
FROM
t1
;
--
echo
#
--
echo
# Testing big endian table
--
echo
#
CREATE
TABLE
t2
(
fig
INT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'C'
,
name
CHAR
(
10
)
NOT
NULL
,
birth
DATE
NOT
NULL
FIELD_FORMAT
=
'B'
,
id
CHAR
(
5
)
NOT
NULL
FIELD_FORMAT
=
'BS'
,
salary
DOUBLE
(
9
,
2
)
NOT
NULL
DEFAULT
0.00
FIELD_FORMAT
=
'BF'
,
dept
INT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'B2'
)
ENGINE
=
CONNECT
TABLE_TYPE
=
BIN
BLOCK_SIZE
=
5
FILE_NAME
=
'Testbal.bin'
;
INSERT
INTO
t2
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
DROP
TABLE
t2
;
CREATE
TABLE
t2
(
fig
INT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'C'
,
name
CHAR
(
10
)
NOT
NULL
,
birth
DATE
NOT
NULL
,
id
CHAR
(
5
)
NOT
NULL
FIELD_FORMAT
=
'S'
,
salary
DOUBLE
(
9
,
2
)
NOT
NULL
DEFAULT
0.00
FIELD_FORMAT
=
'F'
,
dept
INT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'2'
)
ENGINE
=
CONNECT
TABLE_TYPE
=
BIN
BLOCK_SIZE
=
5
FILE_NAME
=
'Testbal.bin'
OPTION_LIST
=
'Endian=Big'
;
SELECT
*
FROM
t2
;
DROP
TABLE
t2
;
CREATE
TABLE
t2
(
fig
CHAR
(
4
)
NOT
NULL
,
name
CHAR
(
10
)
NOT
NULL
,
birth
DATE
NOT
NULL
,
id
SMALLINT
(
5
)
NOT
NULL
,
salary
DOUBLE
(
9
,
2
)
NOT
NULL
DEFAULT
0.00
FIELD_FORMAT
=
'F'
,
dept
SMALLINT
(
4
)
NOT
NULL
)
ENGINE
=
CONNECT
TABLE_TYPE
=
BIN
BLOCK_SIZE
=
5
FILE_NAME
=
'Testbal.bin'
OPTION_LIST
=
'Endian=Big'
;
SELECT
*
FROM
t2
;
DROP
TABLE
t2
;
CREATE
TABLE
t2
(
fig
INT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'C'
,
name
CHAR
(
10
)
NOT
NULL
,
birth
DATE
NOT
NULL
FIELD_FORMAT
=
'B'
,
id
CHAR
(
5
)
NOT
NULL
FIELD_FORMAT
=
'BS'
,
salary
DOUBLE
(
9
,
2
)
NOT
NULL
DEFAULT
0.00
FIELD_FORMAT
=
'BF'
,
dept
SMALLINT
(
4
)
NOT
NULL
FIELD_FORMAT
=
'B'
)
ENGINE
=
CONNECT
TABLE_TYPE
=
BIN
BLOCK_SIZE
=
5
FILE_NAME
=
'Testbal.bin'
;
SELECT
*
FROM
t2
;
DROP
TABLE
t1
,
t2
;
#
# Clean up
#
--
remove_file
$MYSQLD_DATADIR
/
test
/
Testbal
.
dat
--
remove_file
$MYSQLD_DATADIR
/
test
/
Testbal
.
bin
storage/connect/mysql-test/connect/t/mysql_index.test
0 → 100644
View file @
b520febb
--
source
include
/
not_embedded
.
inc
#
# TODO: consider a possibility to run this test
# against some remote MySQL server
#
let
$PORT
=
`select @@port`
;
--
disable_query_log
--
replace_result
$PORT
PORT
--
error
0
,
ER_UNKNOWN_ERROR
--
eval
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
CONNECT
TABLE_TYPE
=
MYSQL
TABNAME
=
'tx1'
OPTION_LIST
=
'host=localhost,user=root,port=$PORT'
if
(
!
`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
AND ENGINE='CONNECT'
AND CREATE_OPTIONS LIKE '%`
table_type
`=MySQL%'`
)
{
Skip
Need
MySQL
support
;
}
DROP
TABLE
t1
;
--
enable_query_log
--
echo
#
--
echo
# Make remote table
--
echo
#
CREATE
TABLE
t1
(
id
int
(
11
)
NOT
NULL
,
msg
char
(
100
)
DEFAULT
NULL
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
1
,
'Un'
),(
3
,
'Trois'
),(
5
,
'Cinq'
);
INSERT
INTO
t1
VALUES
(
2
,
'Two'
),(
4
,
'Four'
),(
6
,
'Six'
);
SELECT
*
FROM
t1
;
--
echo
#
--
echo
# Make local MYSQL table with indexed id column
--
echo
#
CREATE
TABLE
t2
(
id
int
(
11
)
NOT
NULL
,
msg
char
(
100
)
DEFAULT
NULL
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
CONNECT
DEFAULT
CHARSET
=
latin1
TABLE_TYPE
=
MYSQL
TABNAME
=
t1
;
--
echo
#
--
echo
# Testing SELECT, etc.
--
echo
#
SELECT
*
FROM
t2
;
SELECT
*
FROM
t2
WHERE
id
=
3
;
SELECT
*
FROM
t2
WHERE
id
IN
(
2
,
4
);
SELECT
*
FROM
t2
WHERE
id
IN
(
2
,
4
)
AND
msg
=
'Two'
;
SELECT
*
FROM
t2
WHERE
id
>
3
;
SELECT
*
FROM
t2
WHERE
id
>=
3
;
SELECT
*
FROM
t2
WHERE
id
<
3
;
SELECT
*
FROM
t2
WHERE
id
<
3
OR
id
>
4
;
SELECT
*
FROM
t2
WHERE
id
<=
3
;
SELECT
*
FROM
t2
WHERE
id
BETWEEN
3
AND
5
;
SELECT
*
FROM
t2
WHERE
id
>
2
AND
id
<
6
;
SELECT
*
FROM
t2
ORDER
BY
id
;
UPDATE
t2
SET
msg
=
'Five'
WHERE
id
=
5
;
SELECT
*
FROM
t2
;
DELETE
FROM
t2
WHERE
id
=
4
;
SELECT
*
FROM
t2
;
DROP
TABLE
t2
;
DROP
TABLE
t1
;
storage/connect/tabmysql.cpp
View file @
b520febb
...
...
@@ -1058,6 +1058,24 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
{
bool
oom
;
int
oldlen
=
Query
->
GetLength
();
PHC
hc
=
To_Def
->
GetHandler
();
if
(
op
==
OP_FIRST
&&
hc
->
end_range
)
{
#ifdef _DEBUG
assert
(
!
key
);
#endif
key_range
*
end_key
=
&
hc
->
save_end_range
;
key
=
end_key
->
key
;
len
=
end_key
->
length
;
switch
(
end_key
->
flag
)
{
case
HA_READ_BEFORE_KEY
:
op
=
OP_LT
;
break
;
case
HA_READ_AFTER_KEY
:
op
=
OP_LE
;
break
;
default:
key
=
NULL
;
}
// endswitch flag
}
// endif OP_FIRST
if
(
!
key
||
op
==
OP_NEXT
||
Mode
==
MODE_UPDATE
||
Mode
==
MODE_DELETE
)
{
...
...
@@ -1069,22 +1087,12 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
}
// endif key
return
false
;
}
else
if
(
op
==
OP_FIRST
)
{
if
(
To_CondFil
)
{
oom
=
Query
->
Append
(
" WHERE "
);
if
((
oom
|=
Query
->
Append
(
To_CondFil
->
Body
)))
{
strcpy
(
g
->
Message
,
"Readkey: Out of memory"
);
return
true
;
}
// endif oom
}
// endif To_Condfil
}
else
{
if
(
Myc
.
m_Res
)
Myc
.
FreeResult
();
To_Def
->
GetHandler
()
->
MakeKeyWhere
(
g
,
Query
,
op
,
'`'
,
key
,
len
);
if
(
hc
->
MakeKeyWhere
(
g
,
Query
,
op
,
'`'
,
key
,
len
))
return
true
;
if
(
To_CondFil
)
{
oom
=
Query
->
Append
(
" AND ("
);
...
...
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