1/*****************************************************************************
2
3Copyright (C) 2013, 2017, MariaDB Corporation. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc.,
1551 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/******************************************************************//**
20@file include/dict0pagecompress.ic
21Inline implementation for helper functions for extracting/storing
22page compression and atomic writes information to dictionary.
23
24Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com
25***********************************************************************/
26
27/********************************************************************//**
28Extract the page compression level from dict_table_t::flags.
29These flags are in memory, so assert that they are valid.
30@return page compression level, or 0 if not compressed */
31UNIV_INLINE
32ulint
33dict_tf_get_page_compression_level(
34/*===============================*/
35 ulint flags) /*!< in: flags */
36{
37 ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(flags);
38
39 ut_ad(page_compression_level <= 9);
40
41 return(page_compression_level);
42}
43
44/********************************************************************//**
45Check whether the table uses the page compression page format.
46@return page compression level, or 0 if not compressed */
47UNIV_INLINE
48ulint
49dict_table_page_compression_level(
50/*==============================*/
51 const dict_table_t* table) /*!< in: table */
52{
53 ut_ad(table);
54 ut_ad(dict_tf_get_page_compression(table->flags));
55
56 return(dict_tf_get_page_compression_level(table->flags));
57}
58
59/********************************************************************//**
60Check whether the table uses the page compression page format.
61@return true if page compressed, false if not */
62UNIV_INLINE
63ibool
64dict_tf_get_page_compression(
65/*=========================*/
66 ulint flags) /*!< in: flags */
67{
68 return(DICT_TF_GET_PAGE_COMPRESSION(flags));
69}
70
71/********************************************************************//**
72Check whether the table uses the page compression page format.
73@return true if page compressed, false if not */
74UNIV_INLINE
75ibool
76dict_table_is_page_compressed(
77/*==========================*/
78 const dict_table_t* table) /*!< in: table */
79{
80 return (dict_tf_get_page_compression(table->flags));
81}
82