Commit c1184ee3 authored by Arjen Lentz's avatar Arjen Lentz

Updated oqgraph basic test for v3

parent 219a00b1
drop table if exists graph;
DROP TABLE IF EXISTS graph_base;
Warnings:
Note 1051 Unknown table 'graph_base'
DROP TABLE IF EXISTS graph;
Warnings:
Note 1051 Unknown table 'graph'
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
PRIMARY KEY (from_id,to_id),
INDEX (to_id)
) ENGINE=MyISAM;
CREATE TABLE graph (
latch SMALLINT UNSIGNED NULL,
origid BIGINT UNSIGNED NULL,
......@@ -10,54 +19,48 @@ seq BIGINT UNSIGNED NULL,
linkid BIGINT UNSIGNED NULL,
KEY (latch, origid, destid) USING HASH,
KEY (latch, destid, origid) USING HASH
) ENGINE=OQGRAPH;
delete from graph;
insert into graph(origid, destid) values (1,2), (2,1);
insert into graph(origid, destid) values (1,3), (3,1);
insert into graph(origid, destid) values (3,4), (4,3);
insert into graph(origid, destid) values (3,5), (5,3);
insert into graph(origid, destid) values (5,6), (6,5);
select * from graph where latch = 2 and origid = 1 and weight = 1;
) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id';
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);
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 1;
latch origid destid weight seq linkid
2 1 NULL 1 3 3
2 1 NULL 1 2 2
select * from graph where latch = 2 and origid = 1 and weight = 2;
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 2;
latch origid destid weight seq linkid
2 1 NULL 2 5 5
2 1 NULL 2 4 4
select * from graph
where latch = 2 and origid = 1 and (weight = 1 or weight = 2);
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND (weight = 1 OR weight = 2);
latch origid destid weight seq linkid
2 1 NULL 2 5 5
2 1 NULL 2 4 4
2 1 NULL 1 3 3
2 1 NULL 1 2 2
select * from graph where latch=1 and origid=1 and destid=6;
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6;
latch origid destid weight seq linkid
1 1 6 NULL 0 1
1 1 6 1 1 3
1 1 6 1 2 5
1 1 6 1 3 6
select * from graph where latch=1 and origid=1 and destid=4;
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=4;
latch origid destid weight seq linkid
1 1 4 NULL 0 1
1 1 4 1 1 3
1 1 4 1 2 4
select * from graph where latch=1 and origid=4 and destid=1;
SELECT * FROM graph WHERE latch=1 AND origid=4 AND destid=1;
latch origid destid weight seq linkid
1 4 1 NULL 0 4
1 4 1 1 1 3
1 4 1 1 2 1
insert into graph (origid,destid) values (4,6);
delete from graph where origid=5;
delete from graph where origid=3 and destid=5;
select * from graph where latch=1 and origid=1 and destid=6;
INSERT INTO graph_base (from_id,to_id) VALUES (4,6);
DELETE FROM graph_base WHERE from_id=5;
DELETE FROM graph_base WHERE from_id=3 AND to_id=5;
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6;
latch origid destid weight seq linkid
1 1 6 NULL 0 1
1 1 6 1 1 3
1 1 6 1 2 4
1 1 6 1 3 6
select * from graph where latch=1 and origid=6 and destid=1;
SELECT * FROM graph WHERE latch=1 AND origid=6 AND destid=1;
latch origid destid weight seq linkid
truncate table graph;
drop table graph;
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph;
DROP TABLE graph_base;
drop table if exists graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
PRIMARY KEY (from_id,to_id),
INDEX (to_id)
) ENGINE=MyISAM;
CREATE TABLE graph (
latch SMALLINT UNSIGNED NULL,
......@@ -9,35 +17,34 @@ CREATE TABLE graph (
linkid BIGINT UNSIGNED NULL,
KEY (latch, origid, destid) USING HASH,
KEY (latch, destid, origid) USING HASH
) ENGINE=OQGRAPH;
delete from graph;
) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id';
insert into graph(origid, destid) values (1,2), (2,1);
insert into graph(origid, destid) values (1,3), (3,1);
insert into graph(origid, destid) values (3,4), (4,3);
insert into graph(origid, destid) values (3,5), (5,3);
insert into graph(origid, destid) values (5,6), (6,5);
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);
select * from graph where latch = 2 and origid = 1 and weight = 1;
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 1;
select * from graph where latch = 2 and origid = 1 and weight = 2;
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 2;
select * from graph
where latch = 2 and origid = 1 and (weight = 1 or weight = 2);
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND (weight = 1 OR weight = 2);
select * from graph where latch=1 and origid=1 and destid=6;
select * from graph where latch=1 and origid=1 and destid=4;
select * from graph where latch=1 and origid=4 and destid=1;
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6;
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=4;
SELECT * FROM graph WHERE latch=1 AND origid=4 AND destid=1;
insert into graph (origid,destid) values (4,6);
INSERT INTO graph_base (from_id,to_id) VALUES (4,6);
delete from graph where origid=5;
delete from graph where origid=3 and destid=5;
DELETE FROM graph_base WHERE from_id=5;
DELETE FROM graph_base WHERE from_id=3 AND to_id=5;
select * from graph where latch=1 and origid=1 and destid=6;
select * from graph where latch=1 and origid=6 and destid=1;
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6;
SELECT * FROM graph WHERE latch=1 AND origid=6 AND destid=1;
truncate table graph;
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
drop table graph;
DROP TABLE graph;
DROP TABLE graph_base;
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