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
69d700ac
Commit
69d700ac
authored
Nov 26, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-5871 support assisted discovery in oqgraph v3
parent
2ef0312c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
40 deletions
+41
-40
storage/oqgraph/ha_oqgraph.cc
storage/oqgraph/ha_oqgraph.cc
+37
-0
storage/oqgraph/mysql-test/oqgraph/general-Aria.result
storage/oqgraph/mysql-test/oqgraph/general-Aria.result
+1
-10
storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result
storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result
+1
-10
storage/oqgraph/mysql-test/oqgraph/general-innodb.result
storage/oqgraph/mysql-test/oqgraph/general-innodb.result
+1
-10
storage/oqgraph/mysql-test/oqgraph/general.inc
storage/oqgraph/mysql-test/oqgraph/general.inc
+1
-10
No files found.
storage/oqgraph/ha_oqgraph.cc
View file @
69d700ac
...
...
@@ -195,6 +195,41 @@ static handler* oqgraph_create_handler(handlerton *hton, TABLE_SHARE *table,
return
new
(
mem_root
)
ha_oqgraph
(
hton
,
table
);
}
#define OQGRAPH_CREATE_TABLE \
" CREATE TABLE oq_graph ( "\
" 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 "\
" ) "
#define append_opt(NAME,VAL) \
if (share->option_struct->VAL) \
{ \
sql.append(STRING_WITH_LEN(" " NAME "='")); \
sql.append_for_single_quote(share->option_struct->VAL); \
sql.append('\''); \
}
int
oqgraph_discover_table_structure
(
handlerton
*
hton
,
THD
*
thd
,
TABLE_SHARE
*
share
,
HA_CREATE_INFO
*
info
)
{
StringBuffer
<
1024
>
sql
(
system_charset_info
);
sql
.
copy
(
STRING_WITH_LEN
(
OQGRAPH_CREATE_TABLE
),
system_charset_info
);
append_opt
(
"data_table"
,
table_name
);
append_opt
(
"origid"
,
origid
);
append_opt
(
"destid"
,
destid
);
append_opt
(
"weight"
,
weight
);
return
share
->
init_from_sql_statement_string
(
thd
,
true
,
sql
.
ptr
(),
sql
.
length
());
}
#if MYSQL_VERSION_ID >= 50100
static
int
oqgraph_init
(
handlerton
*
hton
)
{
...
...
@@ -219,6 +254,8 @@ static bool oqgraph_init()
// HTON_NO_FLAGS;
hton
->
table_options
=
(
ha_create_table_option
*
)
oqgraph_table_option_list
;
hton
->
discover_table_structure
=
oqgraph_discover_table_structure
;
oqgraph_init_done
=
TRUE
;
return
0
;
}
...
...
storage/oqgraph/mysql-test/oqgraph/general-Aria.result
View file @
69d700ac
...
...
@@ -8,16 +8,7 @@ to_id INT UNSIGNED NOT NULL,
PRIMARY KEY (from_id,to_id),
INDEX (to_id)
) ENGINE= Aria ;
CREATE TABLE graph (
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';
CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id';
select * from graph;
latch origid destid weight seq linkid
INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1);
...
...
storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result
View file @
69d700ac
...
...
@@ -8,16 +8,7 @@ to_id INT UNSIGNED NOT NULL,
PRIMARY KEY (from_id,to_id),
INDEX (to_id)
) ENGINE= MyISAM ;
CREATE TABLE graph (
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';
CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id';
select * from graph;
latch origid destid weight seq linkid
INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1);
...
...
storage/oqgraph/mysql-test/oqgraph/general-innodb.result
View file @
69d700ac
...
...
@@ -8,16 +8,7 @@ to_id INT UNSIGNED NOT NULL,
PRIMARY KEY (from_id,to_id),
INDEX (to_id)
) ENGINE= innodb ;
CREATE TABLE graph (
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';
CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id';
select * from graph;
latch origid destid weight seq linkid
INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1);
...
...
storage/oqgraph/mysql-test/oqgraph/general.inc
View file @
69d700ac
...
...
@@ -15,16 +15,7 @@ eval CREATE TABLE graph_base (
)
ENGINE
=
$oqgraph_use_table_type
;
CREATE
TABLE
graph
(
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'
;
CREATE
TABLE
graph
ENGINE
=
OQGRAPH
DATA_TABLE
=
'graph_base'
ORIGID
=
'from_id'
,
DESTID
=
'to_id'
;
# Regression for MDEV-5891
select
*
from
graph
;
...
...
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