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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1db0278c
Commit
1db0278c
authored
May 28, 2013
by
Andrew McDonnell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated basic test for varchar latch only
parent
746330fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
130 additions
and
130 deletions
+130
-130
mysql-test/suite/oqgraph/basic.result
mysql-test/suite/oqgraph/basic.result
+69
-18
mysql-test/suite/oqgraph/basic.test
mysql-test/suite/oqgraph/basic.test
+61
-112
No files found.
mysql-test/suite/oqgraph/basic.result
View file @
1db0278c
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
DROP TABLE IF EXISTS graph;
DROP TABLE IF EXISTS graph2;
CREATE TABLE graph2 (
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='graph_base' ORIGID='from_id', DESTID='to_id';
SELECT * FROM graph2 WHERE latch='dijkstras' AND origid=1 AND destid=6;
ERROR 42S02: Table 'test.graph_base' doesn't exist
DROP TABLE graph2;
CREATE TABLE graph_base (
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
...
@@ -7,7 +21,7 @@ PRIMARY KEY (from_id,to_id),
...
@@ -7,7 +21,7 @@ PRIMARY KEY (from_id,to_id),
INDEX (to_id)
INDEX (to_id)
) ENGINE=MyISAM;
) ENGINE=MyISAM;
CREATE TABLE graph (
CREATE TABLE graph (
latch
SMALLINT UNSIGNED
NULL,
latch
VARCHAR(32)
NULL,
origid BIGINT UNSIGNED NULL,
origid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
weight DOUBLE NULL,
weight DOUBLE NULL,
...
@@ -20,42 +34,79 @@ INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1);
...
@@ -20,42 +34,79 @@ 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 (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 (3,4), (4,3);
INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5);
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 = 'breadth_first' AND origid = 1 AND weight = 1;
latch origid destid weight seq linkid
breadth_first 1 NULL 1 3 3
breadth_first 1 NULL 1 2 2
SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1;
latch origid destid weight seq linkid
latch origid destid weight seq linkid
2 1 NULL 1 3 3
2 1 NULL 1 3 3
2 1 NULL 1 2 2
2 1 NULL 1 2 2
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 2;
# Expect no result, because of autocast and deprecated syntax
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 1;
latch origid destid weight seq linkid
latch origid destid weight seq linkid
2 1 NULL 2 4 4
# Expect no result between 1,6 because no connection exists
SELECT * FROM graph WHERE latch
= 2 AND origid = 1 AND (weight = 1 OR weight = 2)
;
SELECT * FROM graph WHERE latch
='dijkstras' AND origid=1 AND destid=6
;
latch origid destid weight seq linkid
latch origid destid weight seq linkid
2 1 NULL 2 4 4
SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=6;
2 1 NULL 1 3 3
2 1 NULL 1 2 2
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6;
latch origid destid weight seq linkid
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=4;
# Expect result between 4,1 because connection exists via 3
SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=4;
latch origid destid weight seq linkid
dijkstras 1 4 NULL 0 1
dijkstras 1 4 1 1 3
dijkstras 1 4 1 2 4
SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=4;
latch origid destid weight seq linkid
latch origid destid weight seq linkid
1 1 4 NULL 0 1
1 1 4 NULL 0 1
1 1 4 1 1 3
1 1 4 1 1 3
1 1 4 1 2 4
1 1 4 1 2 4
SELECT * FROM graph WHERE latch=1 AND origid=4 AND destid=1;
# and the reverse direction
SELECT * FROM graph WHERE latch='dijkstras' AND origid=4 AND destid=1;
latch origid destid weight seq linkid
dijkstras 4 1 NULL 0 4
dijkstras 4 1 1 1 3
dijkstras 4 1 1 2 1
SELECT * FROM graph WHERE latch='1' AND origid=4 AND destid=1;
latch origid destid weight seq linkid
latch origid destid weight seq linkid
1 4 1 NULL 0 4
1 4 1 NULL 0 4
1 4 1 1 1 3
1 4 1 1 1 3
1 4 1 1 2 1
1 4 1 1 2 1
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
# Expect no result, because of autocast and deprecated syntax
SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1;
latch origid destid weight seq linkid
# Expect no result, because of NULL latch
SELECT * FROM graph WHERE latch=NULL and destid=2 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND (weight = 1 OR weight = 2);
latch origid destid weight seq linkid
breadth_first 1 NULL 2 4 4
breadth_first 1 NULL 1 3 3
breadth_first 1 NULL 1 2 2
# Now we add a connection from 4->6
INSERT INTO graph_base (from_id,to_id) VALUES (4,6);
INSERT INTO graph_base (from_id,to_id) VALUES (4,6);
# And delete all references to node 5
DELETE FROM graph_base WHERE from_id=5;
DELETE FROM graph_base WHERE from_id=5;
DELETE FROM graph_base WHERE from_id=3 AND to_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;
# which means there is a path in one direction only 1>3>4>6
SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6;
latch origid destid weight seq linkid
latch origid destid weight seq linkid
1 1 6 NULL 0 1
dijkstras 1 6 NULL 0 1
1 1 6 1 1 3
dijkstras 1 6 1 1 3
1 1 6 1 2 4
dijkstras 1 6 1 2 4
1 1 6 1 3 6
dijkstras 1 6 1 3 6
SELECT * FROM graph WHERE latch=1 AND origid=6 AND destid=1;
# but not 6>4>3>1
SELECT * FROM graph WHERE latch='dijkstras' AND origid=6 AND destid=1;
latch origid destid weight seq linkid
latch origid destid weight seq linkid
DELETE FROM graph_base;
DELETE FROM graph_base;
FLUSH TABLES;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
TRUNCATE TABLE graph_base;
DROP TABLE graph, graph_base;
DROP TABLE graph_base;
SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6;
ERROR 42S02: Table 'test.graph_base' doesn't exist
DROP TABLE graph;
mysql-test/suite/oqgraph/basic.test
View file @
1db0278c
...
@@ -4,7 +4,6 @@ DROP TABLE IF EXISTS graph;
...
@@ -4,7 +4,6 @@ DROP TABLE IF EXISTS graph;
DROP
TABLE
IF
EXISTS
graph2
;
DROP
TABLE
IF
EXISTS
graph2
;
--
enable_warnings
--
enable_warnings
CREATE
TABLE
graph2
(
CREATE
TABLE
graph2
(
latch
VARCHAR
(
32
)
NULL
,
latch
VARCHAR
(
32
)
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
...
@@ -15,12 +14,12 @@ CREATE TABLE graph2 (
...
@@ -15,12 +14,12 @@ CREATE TABLE graph2 (
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
DATA_TABLE
=
'graph_base'
ORIGID
=
'from_id'
,
DESTID
=
'to_id'
;
)
ENGINE
=
OQGRAPH
DATA_TABLE
=
'graph_base'
ORIGID
=
'from_id'
,
DESTID
=
'to_id'
;
# Because the backing store graph_base doesnt exist yet, the select should fail
--
error
S42S02
SELECT
*
FROM
graph2
WHERE
latch
=
'dijkstras'
AND
origid
=
1
AND
destid
=
6
;
SELECT
*
FROM
graph2
WHERE
latch
=
'dijkstras'
AND
origid
=
1
AND
destid
=
6
;
--
expect
fail
as
follows
:
--
ERROR
1146
(
42
S02
)
:
Table
'test.graph_base'
doesn
't exist
-- because base graph is a necessary precondition at this point
DROP
TABLE
graph2
;
DROP
TABLE
graph2
;
# Create the backing store
CREATE
TABLE
graph_base
(
CREATE
TABLE
graph_base
(
from_id
INT
UNSIGNED
NOT
NULL
,
from_id
INT
UNSIGNED
NOT
NULL
,
to_id
INT
UNSIGNED
NOT
NULL
,
to_id
INT
UNSIGNED
NOT
NULL
,
...
@@ -28,45 +27,8 @@ CREATE TABLE graph_base (
...
@@ -28,45 +27,8 @@ CREATE TABLE graph_base (
INDEX
(
to_id
)
INDEX
(
to_id
)
)
ENGINE
=
MyISAM
;
)
ENGINE
=
MyISAM
;
-- Backwards compat test - should provide a deprecation warning if we do show warnings
SET GLOBAL oqgraph_allow_create_integer_latch=false;
-- We need to expect the following to fail
CREATE TABLE graph (
latch SMALLINT UNSIGNED 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='
graph_base
' ORIGID='
from_id
', DESTID='
to_id
';
-- expected:
--| Warning | 140 | Integer latch is not supported for new tables. |
--| Error | 1005 | Can'
t
create
table
'test.graph'
(
errno
:
140
"Wrong create options"
)
|
--
Backwards
compat
testng
-
should
provide
a
deprecation
warning
if
we
do
--
show
warnings
-
and
let
us
create
a
integer
latch
so
that
we
can
check
--
upgrade
behaviour
SET
GLOBAL
oqgraph_allow_create_integer_latch
=
true
;
CREATE
TABLE
graph
(
CREATE
TABLE
graph
(
latch
SMALLINT
UNSIGNED
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
=
'graph_base'
ORIGID
=
'from_id'
,
DESTID
=
'to_id'
;
--
Expected
:
--
|
Warning
|
1287
|
'latch SMALLINT UNSIGNED NULL'
is
deprecated
and
will
be
removed
in
a
future
release
.
Please
use
'latch VARCHAR(32) NULL'
instead
|
SET
GLOBAL
oqgraph_allow_create_integer_latch
=
false
;
CREATE
TABLE
graph2
(
latch
VARCHAR
(
32
)
NULL
,
latch
VARCHAR
(
32
)
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
...
@@ -83,87 +45,74 @@ INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
...
@@ -83,87 +45,74 @@ 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
(
3
,
4
),
(
4
,
3
);
INSERT
INTO
graph_base
(
from_id
,
to_id
)
VALUES
(
5
,
6
),
(
6
,
5
);
INSERT
INTO
graph_base
(
from_id
,
to_id
)
VALUES
(
5
,
6
),
(
6
,
5
);
SELECT
*
FROM
graph
WHERE
latch
=
'breadth_first'
AND
origid
=
1
AND
weight
=
1
;
# The next works, we allow stringized latch integer to ease migration
SELECT
*
FROM
graph
WHERE
latch
=
'2'
AND
origid
=
1
AND
weight
=
1
;
# Expect the next to return no results, due to autocast and use of deprecated syntax...
--
echo
# Expect no result, because of autocast and deprecated syntax
SELECT
*
FROM
graph
WHERE
latch
=
2
AND
origid
=
1
AND
weight
=
1
;
SELECT
*
FROM
graph
WHERE
latch
=
2
AND
origid
=
1
AND
weight
=
1
;
--
echo
# Expect no result between 1,6 because no connection exists
--
expected
:
SELECT
*
FROM
graph
WHERE
latch
=
'dijkstras'
AND
origid
=
1
AND
destid
=
6
;
--
+-------+--------+--------+--------+------+--------+
SELECT
*
FROM
graph
WHERE
latch
=
'1'
AND
origid
=
1
AND
destid
=
6
;
--
|
latch
|
origid
|
destid
|
weight
|
seq
|
linkid
|
--
echo
# Expect result between 4,1 because connection exists via 3
--
+-------+--------+--------+--------+------+--------+
SELECT
*
FROM
graph
WHERE
latch
=
'dijkstras'
AND
origid
=
1
AND
destid
=
4
;
--
|
2
|
1
|
NULL
|
1
|
3
|
3
|
SELECT
*
FROM
graph
WHERE
latch
=
'1'
AND
origid
=
1
AND
destid
=
4
;
--
|
2
|
1
|
NULL
|
1
|
2
|
2
|
--
echo
# and the reverse direction
--
+-------+--------+--------+--------+------+--------+
SELECT
*
FROM
graph
WHERE
latch
=
'dijkstras'
AND
origid
=
4
AND
destid
=
1
;
--
reset
query
cache
;
flush
query
cache
;
SELECT
*
FROM
graph
WHERE
latch
=
'1'
AND
origid
=
4
AND
destid
=
1
;
SELECT
*
FROM
graph2
WHERE
latch
=
'breadth_first'
AND
origid
=
1
AND
weight
=
1
;
--
works
SELECT
*
FROM
graph
WHERE
latch
=
'no_search'
and
destid
=
2
and
origid
=
1
;
SELECT
*
FROM
graph2
WHERE
latch
=
'2'
AND
origid
=
1
AND
weight
=
1
;
--
as
above
--
above
works
,
we
allow
stringized
latch
integer
to
ease
migration
--
echo
# Expect no result, because of autocast and deprecated syntax
SELECT
*
FROM
graph2
WHERE
latch
=
2
AND
origid
=
1
AND
weight
=
1
;
SELECT
*
FROM
graph
WHERE
latch
=
0
and
destid
=
2
and
origid
=
1
;
--
Expect
the
above
to
fail
due
to
autocast
and
use
of
deprecated syntax...
#-- FIXME SELECT * FROM graph2 WHERE latch='0' and destid=2 and origid=1; -- causes assertion (at least in debug build, havent tested normal)
SELECT * FROM graph2 WHERE latch='dijkstras' AND origid=1 AND destid=6
;
#-- sql/mysqld(my_print_stacktrace+0x35)[0xdbbc02]
SELECT
*
FROM
graph2
WHERE
latch
=
'1'
AND
origid
=
1
AND
destid
=
6
;
#-- sql/mysqld(handle_fatal_signal+0x355)[0x7dfd05]
SELECT
*
FROM
graph2
WHERE
latch
=
'dijkstras'
AND
origid
=
1
AND
destid
=
4
;
#-- /lib/libpthread.so.0(+0xeff0)[0x7f4810addff0]
SELECT
*
FROM
graph2
WHERE
latch
=
'1'
AND
origid
=
1
AND
destid
=
4
;
#-- /lib/libc.so.6(gsignal+0x35)[0x7f480feda1b5]
SELECT
*
FROM
graph2
WHERE
latch
=
'dijkstras'
AND
origid
=
4
AND
destid
=
1
;
#-- /lib/libc.so.6(abort+0x180)[0x7f480fedcfc0]
SELECT
*
FROM
graph2
WHERE
latch
=
'1'
AND
origid
=
4
AND
destid
=
1
;
#-- /lib/libc.so.6(__assert_fail+0xf1)[0x7f480fed3301]
#-- sql/mysqld(_ZN7handler8ha_resetEv+0x8b)[0x7eb6a9]
SELECT
*
FROM
graph2
WHERE
latch
=
'no_search'
and
destid
=
2
and
origid
=
1
;
--
works
#-- sql/mysqld(_Z18close_thread_tableP3THDPP5TABLE+0x297)[0x5b1207]
#-- sql/mysqld[0x5b09c4]
SELECT
*
FROM
graph2
WHERE
latch
=
0
and
destid
=
2
and
origid
=
1
;
#-- sql/mysqld(_Z19close_thread_tablesP3THD+0x33f)[0x5b0f5d]
--
Expect
the
above
to
fail
due
to
autocast
...
#-- sql/mysqld(_Z21mysql_execute_commandP3THD+0x7fe9)[0x61cc6b]
#-- sql/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x268)[0x61f9ec]
--
FIXME
SELECT
*
FROM
graph2
WHERE
latch
=
'0'
and
destid
=
2
and
origid
=
1
;
--
causes
assertion
(
at
least
in
debug
build
,
havent
tested
normal
)
#-- sql/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xc3e)[0x6129ba]
--
sql
/
mysqld
(
my_print_stacktrace
+
0x35
)[
0xdbbc02
]
#-- sql/mysqld(_Z10do_commandP3THD+0x33f)[0x611b35]
--
sql
/
mysqld
(
handle_fatal_signal
+
0x355
)[
0x7dfd05
]
#-- sql/mysqld(_Z24do_handle_one_connectionP3THD+0x1f6)[0x721ba9]
--
/
lib
/
libpthread
.
so
.
0
(
+
0xeff0
)[
0x7f4810addff0
]
#-- sql/mysqld(handle_one_connection+0x33)[0x721651]
--
/
lib
/
libc
.
so
.
6
(
gsignal
+
0x35
)[
0x7f480feda1b5
]
#-- /lib/libpthread.so.0(+0x68ca)[0x7f4810ad58ca]
--
/
lib
/
libc
.
so
.
6
(
abort
+
0x180
)[
0x7f480fedcfc0
]
#-- /lib/libc.so.6(clone+0x6d)[0x7f480ff7792d]
--
/
lib
/
libc
.
so
.
6
(
__assert_fail
+
0xf1
)[
0x7f480fed3301
]
--
sql
/
mysqld
(
_ZN7handler8ha_resetEv
+
0x8b
)[
0x7eb6a9
]
--
echo
# Expect no result, because of NULL latch
--
sql
/
mysqld
(
_Z18close_thread_tableP3THDPP5TABLE
+
0x297
)[
0x5b1207
]
SELECT
*
FROM
graph
WHERE
latch
=
NULL
and
destid
=
2
and
origid
=
1
;
--
sql
/
mysqld
[
0x5b09c4
]
--
sql
/
mysqld
(
_Z19close_thread_tablesP3THD
+
0x33f
)[
0x5b0f5d
]
SELECT
*
FROM
graph
WHERE
latch
=
'breadth_first'
AND
origid
=
1
AND
(
weight
=
1
OR
weight
=
2
);
--
sql
/
mysqld
(
_Z21mysql_execute_commandP3THD
+
0x7fe9
)[
0x61cc6b
]
--
sql
/
mysqld
(
_Z11mysql_parseP3THDPcjP12Parser_state
+
0x268
)[
0x61f9ec
]
--
echo
# Now we add a connection from 4->6
--
sql
/
mysqld
(
_Z16dispatch_command19enum_server_commandP3THDPcj
+
0xc3e
)[
0x6129ba
]
--
sql
/
mysqld
(
_Z10do_commandP3THD
+
0x33f
)[
0x611b35
]
--
sql
/
mysqld
(
_Z24do_handle_one_connectionP3THD
+
0x1f6
)[
0x721ba9
]
--
sql
/
mysqld
(
handle_one_connection
+
0x33
)[
0x721651
]
--
/
lib
/
libpthread
.
so
.
0
(
+
0x68ca
)[
0x7f4810ad58ca
]
--
/
lib
/
libc
.
so
.
6
(
clone
+
0x6d
)[
0x7f480ff7792d
]
SELECT
*
FROM
graph2
WHERE
latch
=
NULL
and
destid
=
2
and
origid
=
1
;
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
graph2
WHERE
latch
=
'breadth_first'
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
;
INSERT
INTO
graph_base
(
from_id
,
to_id
)
VALUES
(
4
,
6
);
INSERT
INTO
graph_base
(
from_id
,
to_id
)
VALUES
(
4
,
6
);
--
echo
# And delete all references to node 5
DELETE
FROM
graph_base
WHERE
from_id
=
5
;
DELETE
FROM
graph_base
WHERE
from_id
=
5
;
DELETE
FROM
graph_base
WHERE
from_id
=
3
AND
to_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
;
--
echo
# which means there is a path in one direction only 1>3>4>6
SELECT
*
FROM
graph
WHERE
latch
=
1
AND
origid
=
6
AND
destid
=
1
;
SELECT
*
FROM
graph
WHERE
latch
=
'dijkstras'
AND
origid
=
1
AND
destid
=
6
;
--
echo
# but not 6>4>3>1
SELECT
*
FROM
graph2
WHERE
latch
=
'dijkstras'
AND
origid
=
1
AND
destid
=
6
;
SELECT
*
FROM
graph
WHERE
latch
=
'dijkstras'
AND
origid
=
6
AND
destid
=
1
;
SELECT
*
FROM
graph2
WHERE
latch
=
'dijkstras'
AND
origid
=
6
AND
destid
=
1
;
DELETE
FROM
graph_base
;
DELETE
FROM
graph_base
;
FLUSH
TABLES
;
FLUSH
TABLES
;
TRUNCATE
TABLE
graph_base
;
TRUNCATE
TABLE
graph_base
;
DROP
TABLE
graph
,
graph_base
;
DROP
TABLE
graph_base
;
# Expect error if we pull the table out from under
--
error
S42S02
SELECT
*
FROM
graph
WHERE
latch
=
'dijkstras'
AND
origid
=
1
AND
destid
=
6
;
DROP
TABLE
graph
;
SELECT
*
FROM
graph2
WHERE
latch
=
'dijkstras'
AND
origid
=
1
AND
destid
=
6
;
--
expect
fail
as
follows
:
--
ERROR
1146
(
42
S02
)
:
Table
'test.graph_base'
doesn
'
t
exist
--
because
base
graph
is
a
necessary
precondition
at
this
point
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