Commit b520febb authored by Olivier Bertrand's avatar Olivier Bertrand

Resolving conflict on ha_connect.cc

parents 0e270f73 fdd9af56
...@@ -281,6 +281,10 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result ...@@ -281,6 +281,10 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
*.vcproj.* *.vcproj.*
*.vcproj.*.* *.vcproj.*.*
*.vcproj.*.*.* *.vcproj.*.*.*
*.vcxproj
*.vcxproj.*
*.vcxproj.*.*
*.vcxproj.*.*.*
# Build results # Build results
[Dd]ebug/ [Dd]ebug/
......
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
#define JSONMAX 10 // JSON Default max grp size #define JSONMAX 10 // JSON Default max grp size
extern "C" { extern "C" {
char version[]= "Version 1.03.0007 June 03, 2015"; char version[]= "Version 1.03.0007 July 05, 2015";
#if defined(__WIN__) #if defined(__WIN__)
char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__; char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__;
char slash= '\\'; char slash= '\\';
...@@ -2237,7 +2237,9 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL op, char q, ...@@ -2237,7 +2237,9 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL op, char q,
case OP_EQ: case OP_EQ:
case OP_GT: case OP_GT:
case OP_GE: case OP_GE:
oom|= qry->Append((PSZ)GetValStr(op, false)); case OP_LT:
case OP_LE:
oom |= qry->Append((PSZ)GetValStr(op, false));
break; break;
default: default:
oom|= qry->Append(" ??? "); oom|= qry->Append(" ??? ");
......
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;
#
# 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;
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
-- 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;
...@@ -1058,6 +1058,24 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len) ...@@ -1058,6 +1058,24 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
{ {
bool oom; bool oom;
int oldlen = Query->GetLength(); 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 || if (!key || op == OP_NEXT ||
Mode == MODE_UPDATE || Mode == MODE_DELETE) { Mode == MODE_UPDATE || Mode == MODE_DELETE) {
...@@ -1069,22 +1087,12 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len) ...@@ -1069,22 +1087,12 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
} // endif key } // endif key
return false; 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 { } else {
if (Myc.m_Res) if (Myc.m_Res)
Myc.FreeResult(); Myc.FreeResult();
To_Def->GetHandler()->MakeKeyWhere(g, Query, op, '`', key, len); if (hc->MakeKeyWhere(g, Query, op, '`', key, len))
return true;
if (To_CondFil) { if (To_CondFil) {
oom = Query->Append(" AND ("); oom = Query->Append(" AND (");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment