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
98e62e63
Commit
98e62e63
authored
Nov 13, 2018
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better declaration of the buffer size
parent
1f51d6c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
sql/sql_view.cc
sql/sql_view.cc
+7
-7
sql/table.h
sql/table.h
+6
-1
No files found.
sql/sql_view.cc
View file @
98e62e63
...
...
@@ -843,13 +843,13 @@ int mariadb_fix_view(THD *thd, TABLE_LIST *view, bool wrong_checksum,
swap_alg
=
0
;
if
(
wrong_checksum
)
{
if
(
view
->
md5
.
length
!=
32
)
if
(
view
->
md5
.
length
!=
VIEW_MD5_LEN
)
{
if
((
view
->
md5
.
str
=
(
char
*
)
thd
->
alloc
(
32
+
1
))
==
NULL
)
if
((
view
->
md5
.
str
=
(
char
*
)
thd
->
alloc
(
VIEW_MD5_LEN
+
1
))
==
NULL
)
DBUG_RETURN
(
HA_ADMIN_FAILED
);
}
view
->
calc_md5
(
const_cast
<
char
*>
(
view
->
md5
.
str
));
view
->
md5
.
length
=
32
;
view
->
md5
.
length
=
VIEW_MD5_LEN
;
}
view
->
mariadb_version
=
MYSQL_VERSION_ID
;
...
...
@@ -972,13 +972,13 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view
->
file_version
=
2
;
view
->
mariadb_version
=
MYSQL_VERSION_ID
;
view
->
calc_md5
(
md5
);
if
(
!
(
view
->
md5
.
str
=
(
char
*
)
thd
->
memdup
(
md5
,
32
)))
if
(
!
(
view
->
md5
.
str
=
(
char
*
)
thd
->
memdup
(
md5
,
VIEW_MD5_LEN
)))
{
my_error
(
ER_OUT_OF_RESOURCES
,
MYF
(
0
));
error
=
-
1
;
goto
err
;
}
view
->
md5
.
length
=
32
;
view
->
md5
.
length
=
VIEW_MD5_LEN
;
can_be_merged
=
lex
->
can_be_merged
();
if
(
lex
->
create_view
->
algorithm
==
VIEW_ALGORITHM_MERGE
&&
!
lex
->
can_be_merged
())
...
...
@@ -2093,10 +2093,10 @@ bool insert_view_fields(THD *thd, List<Item> *list, TABLE_LIST *view)
int
view_checksum
(
THD
*
thd
,
TABLE_LIST
*
view
)
{
char
md5
[
MD5_BUFF_LENGTH
];
if
(
!
view
->
view
||
view
->
md5
.
length
!=
32
)
if
(
!
view
->
view
||
view
->
md5
.
length
!=
VIEW_MD5_LEN
)
return
HA_ADMIN_NOT_IMPLEMENTED
;
view
->
calc_md5
(
md5
);
return
(
strncmp
(
md5
,
view
->
md5
.
str
,
32
)
?
return
(
strncmp
(
md5
,
view
->
md5
.
str
,
VIEW_MD5_LEN
)
?
HA_ADMIN_WRONG_CHECKSUM
:
HA_ADMIN_OK
);
}
...
...
sql/table.h
View file @
98e62e63
...
...
@@ -32,6 +32,9 @@
#include "filesort_utils.h"
#include "parse_file.h"
/* buffer for timestamp (19+1) */
#define VIEW_TIME_STAMP_BUFFER_SIZE (PARSE_FILE_TIMESTAMPLENGTH + 1)
/* Structs that defines the TABLE */
class
Item
;
/* Needed by ORDER */
...
...
@@ -64,6 +67,8 @@ struct Name_resolution_context;
*/
typedef
ulonglong
nested_join_map
;
#define VIEW_MD5_LEN 32
#define tmp_file_prefix "#sql"
/**< Prefix for tmp tables */
#define tmp_file_prefix_length 4
...
...
@@ -2460,7 +2465,7 @@ struct TABLE_LIST
/* TABLE_TYPE_UNKNOWN if any type is acceptable */
Table_type
required_type
;
handlerton
*
db_type
;
/* table_type for handler */
char
timestamp_buffer
[
MAX_DATETIME_WIDTH
+
1
];
char
timestamp_buffer
[
VIEW_TIME_STAMP_BUFFER_SIZE
];
/*
This TABLE_LIST object is just placeholder for prelocking, it will be
used for implicit LOCK TABLES only and won't be used in real statement.
...
...
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