Commit dd7e37d5 authored by Andrew McDonnell's avatar Andrew McDonnell

Renamed no_search to '' and finished making all tests self-consistent and...

Renamed no_search to '' and finished making all tests self-consistent and match somewhat to http://openquery.com/graph/doc and added bug references to tests
parent 254cf762
This diff is collapsed.
This diff is collapsed.
......@@ -34,51 +34,19 @@ INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1);
INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3);
INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5);
# No Search/0 - result should return same rows as inserted for origid,destid,weight
# FIXME - THIS CODE IS CURRENTLY BROKEN - see https://bugs.launchpad.net/oqgraph/+bug/1195778
SELECT * FROM graph WHERE latch='no_search';
latch origid destid weight seq linkid
no_search NULL NULL NULL NULL 1
no_search NULL NULL NULL NULL 2
no_search NULL NULL NULL NULL 3
no_search NULL NULL NULL NULL 4
no_search NULL NULL NULL NULL 5
no_search NULL NULL NULL NULL 6
SELECT * FROM graph WHERE latch='no_search' and destid=2 and origid=1;
latch origid destid weight seq linkid
no_search 1 2 1 3 1
no_search 1 2 1 2 3
no_search 1 2 1 1 2
SELECT * FROM graph WHERE latch='no_search' and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='no_search' and destid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='no_search' and origid=666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='no_search' and origid=NULL;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='0' ;
# Expect no result, because of autocast
SELECT * FROM graph WHERE latch=0 ;
latch origid destid weight seq linkid
0 NULL NULL NULL NULL 1
0 NULL NULL NULL NULL 2
0 NULL NULL NULL NULL 3
0 NULL NULL NULL NULL 4
0 NULL NULL NULL NULL 5
0 NULL NULL NULL NULL 6
SELECT * FROM graph WHERE latch='0' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1;
latch origid destid weight seq linkid
0 1 2 1 3 1
0 1 2 1 2 3
0 1 2 1 1 2
SELECT * FROM graph WHERE latch='0' and origid=1;
SELECT * FROM graph WHERE latch=0 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='0' and destid=1;
SELECT * FROM graph WHERE latch=0 and destid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='0' and origid=666;
SELECT * FROM graph WHERE latch=0 and origid=666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='0' and origid=NULL;
SELECT * FROM graph WHERE latch=0 and origid=NULL;
latch origid destid weight seq linkid
# Expect no result, because of autocast
SELECT * FROM graph WHERE latch=1 ;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=1 and destid=2 and origid=1;
......@@ -188,59 +156,6 @@ Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=NULL;
latch origid destid weight seq linkid
# Expect no result, because of autocast and deprecated syntax
# Allows 0 and NULL to have same effect
SELECT * FROM graph WHERE latch=0;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and destid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and origid=666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and origid=NULL;
latch origid destid weight seq linkid
# Expect no result, because of NULL latch
SELECT * FROM graph WHERE latch=NULL;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=NULL and destid=2 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=NULL and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=NULL and destid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=NULL and origid=666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=NULL and origid=NULL;
latch origid destid weight seq linkid
# With no latch, original data in origid and destid columns
SELECT * FROM graph;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
NULL 2 1 1 NULL NULL
NULL 1 3 1 NULL NULL
NULL 3 1 1 NULL NULL
NULL 3 4 1 NULL NULL
NULL 4 3 1 NULL NULL
NULL 5 6 1 NULL NULL
NULL 6 5 1 NULL NULL
SELECT * FROM graph WHERE destid=2 and origid=1;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
SELECT * FROM graph WHERE origid=1;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
NULL 1 3 1 NULL NULL
SELECT * FROM graph WHERE destid=1;
latch origid destid weight seq linkid
NULL 2 1 1 NULL NULL
NULL 3 1 1 NULL NULL
SELECT * FROM graph WHERE origid=666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE origid=NULL;
latch origid destid weight seq linkid
INSERT INTO graph_base(from_id, to_id) VALUES (1,2);
ERROR 23000: Duplicate entry '1-2' for key 'PRIMARY'
DELETE FROM graph_base;
......
......@@ -45,22 +45,13 @@ INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3);
INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5);
--echo # No Search/0 - result should return same rows as inserted for origid,destid,weight
--echo # FIXME - THIS CODE IS CURRENTLY BROKEN - see https://bugs.launchpad.net/oqgraph/+bug/1195778
SELECT * FROM graph WHERE latch='no_search';
SELECT * FROM graph WHERE latch='no_search' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='no_search' and origid=1;
SELECT * FROM graph WHERE latch='no_search' and destid=1;
SELECT * FROM graph WHERE latch='no_search' and origid=666;
SELECT * FROM graph WHERE latch='no_search' and origid=NULL;
SELECT * FROM graph WHERE latch='0' ;
SELECT * FROM graph WHERE latch='0' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='0' and origid=1;
SELECT * FROM graph WHERE latch='0' and destid=1;
SELECT * FROM graph WHERE latch='0' and origid=666;
SELECT * FROM graph WHERE latch='0' and origid=NULL;
--echo # Expect no result, because of autocast
SELECT * FROM graph WHERE latch=0 ;
SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1;
SELECT * FROM graph WHERE latch=0 and origid=1;
SELECT * FROM graph WHERE latch=0 and destid=1;
SELECT * FROM graph WHERE latch=0 and origid=666;
SELECT * FROM graph WHERE latch=0 and origid=NULL;
SELECT * FROM graph WHERE latch=1 ;
SELECT * FROM graph WHERE latch=1 and destid=2 and origid=1;
SELECT * FROM graph WHERE latch=1 and origid=1;
......@@ -108,35 +99,18 @@ SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=666;
#-- Note the next line couter-intuitively produces no warning
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=NULL;
--echo # Expect no result, because of autocast and deprecated syntax
--echo # Allows 0 and NULL to have same effect
#-- Note the next line couter-intuitively produces no warning
SELECT * FROM graph WHERE latch=0;
SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1;
SELECT * FROM graph WHERE latch=0 and origid=1;
SELECT * FROM graph WHERE latch=0 and destid=1;
SELECT * FROM graph WHERE latch=0 and origid=666;
#-- Note the next line couter-intuitively produces no warning
SELECT * FROM graph WHERE latch=0 and origid=NULL;
--echo # Expect no result, because of NULL latch
SELECT * FROM graph WHERE latch=NULL;
SELECT * FROM graph WHERE latch=NULL and destid=2 and origid=1;
SELECT * FROM graph WHERE latch=NULL and origid=1;
SELECT * FROM graph WHERE latch=NULL and destid=1;
SELECT * FROM graph WHERE latch=NULL and origid=666;
SELECT * FROM graph WHERE latch=NULL and origid=NULL;
--echo # With no latch, original data in origid and destid columns
#-- Note, weight==1 in this case
SELECT * FROM graph;
SELECT * FROM graph WHERE destid=2 and origid=1;
SELECT * FROM graph WHERE origid=1;
SELECT * FROM graph WHERE destid=1;
SELECT * FROM graph WHERE origid=666;
SELECT * FROM graph WHERE origid=NULL;
#-- what happens if we have two links the same?
#--echo # Expect no result, because of NULL latch
#-- FIXME - in v2 according to http://openquery.com/graph/doc NULL latch should
#-- FIXME - return same as select * from graph;
#--https://bugs.launchpad.net/oqgraph/+bug/1196021
#SELECT * FROM graph WHERE latch=NULL;
#SELECT * FROM graph WHERE latch=NULL and destid=2 and origid=1;
#SELECT * FROM graph WHERE latch=NULL and origid=1;
#SELECT * FROM graph WHERE latch=NULL and destid=1;
#SELECT * FROM graph WHERE latch=NULL and origid=666;
#SELECT * FROM graph WHERE latch=NULL and origid=NULL;
#-- what happens if we have two links the same? primay key violation...
--error 1062
INSERT INTO graph_base(from_id, to_id) VALUES (1,2);
......
......@@ -48,6 +48,11 @@ CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, dest
DESCRIBE oqtable;
ERROR 42S02: Table 'test.bogus' doesn't exist
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing';
# Expect 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)'
DESCRIBE oqtable;
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing', DESTID='id2';
# Expect 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)'
DESCRIBE oqtable;
......
......@@ -78,15 +78,14 @@ CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, dest
--error 1146
DESCRIBE oqtable;
# FIXME - I dont know what this test was for
# FIXME - Are we checking that the backing tbale has a primary key etc., or doesn't it matter?
# invalid table reference
#--disable_warnings
#DROP TABLE IF EXISTS oqtable;
#--enable_warnings
#CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY #(latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing';
#--error 1296
#DESCRIBE oqtable;
# Table exists but no orig or dest specified
--disable_warnings
DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing';
--echo # Expect 'Invalid OQGRAPH backing store (unspecified or empty origid attribute)'
--error 1296
DESCRIBE oqtable;
# missing origid
--disable_warnings
......
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