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
60c7736f
Commit
60c7736f
authored
Feb 27, 2013
by
Andrew McDonnell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sanity check that expected attributes exist when opening the table.
parent
86ed2765
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
storage/oqgraph/ha_oqgraph.cc
storage/oqgraph/ha_oqgraph.cc
+30
-1
No files found.
storage/oqgraph/ha_oqgraph.cc
View file @
60c7736f
...
...
@@ -43,11 +43,12 @@
#include "unireg.h"
#include "sql_class.h"
#include "my_dbug.h"
#define OQGRAPH_STATS_UPDATE_THRESHOLD 10
using
namespace
open_query
;
struct
oqgraph_table_option_struct
{
char
*
table_name
;
...
...
@@ -114,6 +115,7 @@ static bool oqgraph_init_done= 0;
static
handler
*
oqgraph_create_handler
(
handlerton
*
hton
,
TABLE_SHARE
*
table
,
MEM_ROOT
*
mem_root
)
{
DBUG_PRINT
(
"oq-debug"
,
(
"oqgraph_create_handler"
));
return
new
(
mem_root
)
ha_oqgraph
(
hton
,
table
);
}
...
...
@@ -127,6 +129,9 @@ static bool oqgraph_init()
return
1
;
#endif
DBUG_PRINT
(
"oq-debug"
,
(
"oqgraph_init"
));
#if MYSQL_VERSION_ID >= 50100
hton
->
state
=
SHOW_OPTION_YES
;
hton
->
db_type
=
DB_TYPE_AUTOASSIGN
;
...
...
@@ -139,6 +144,7 @@ static bool oqgraph_init()
static
int
oqgraph_fini
(
void
*
)
{
DBUG_PRINT
(
"oq-debug"
,
(
"oqgraph_fini"
));
oqgraph_init_done
=
FALSE
;
#endif
return
0
;
...
...
@@ -317,10 +323,33 @@ void ha_oqgraph::fprint_error(const char* fmt, ...)
int
ha_oqgraph
::
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
)
{
DBUG_PRINT
(
"oq-debug"
,
(
"open(name=%s,mode=%d)"
,
name
,
mode
));
THD
*
thd
=
current_thd
;
oqgraph_table_option_struct
*
options
=
reinterpret_cast
<
oqgraph_table_option_struct
*>
(
table
->
s
->
option_struct
);
// Catch cases where table was not constructed properly
if
(
!
options
)
{
fprint_error
(
"Invalid oqgraph backing store (null attributes)"
);
return
-
1
;
}
if
(
!
options
->
table_name
)
{
fprint_error
(
"Invalid oqgraph backing store (unspecified data_table attribute)"
);
// if table_name if present but doesnt actually exist, we will fail out below
// when we call open_table_def(). same probably applies for the id fields
return
-
1
;
}
if
(
!
options
->
origid
)
{
fprint_error
(
"Invalid oqgraph backing store (unspecified origid attribute)"
);
return
-
1
;
}
if
(
!
options
->
destid
)
{
fprint_error
(
"Invalid oqgraph backing store (unspecified destid attribute)"
);
return
-
1
;
}
// weight is optional
error_message
.
length
(
0
);
const
char
*
p
=
strend
(
name
)
-
1
;
...
...
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