1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-28 17:36:30 +03:00

5.6.24-72.2

This commit is contained in:
Sergei Golubchik
2015-06-16 11:04:40 +02:00
parent a4416abdde
commit 90849456d7
26 changed files with 463 additions and 542 deletions

View File

@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 2008, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -318,35 +318,6 @@ ib_wake_master_thread(void)
}
}
/*********************************************************************//**
Calculate the max row size of the columns in a cluster index.
@return max row length */
UNIV_INLINE
ulint
ib_get_max_row_len(
/*===============*/
dict_index_t* cluster) /*!< in: cluster index */
{
ulint i;
ulint max_len = 0;
ulint n_fields = cluster->n_fields;
/* Add the size of the ordering columns in the
clustered index. */
for (i = 0; i < n_fields; ++i) {
const dict_col_t* col;
col = dict_index_get_nth_col(cluster, i);
/* Use the maximum output size of
mach_write_compressed(), although the encoded
length should always fit in 2 bytes. */
max_len += dict_col_get_max_size(col);
}
return(max_len);
}
/*****************************************************************//**
Read the columns from a rec into a tuple. */
static
@@ -710,120 +681,6 @@ ib_trx_rollback(
return(err);
}
/*****************************************************************//**
Find an index definition from the index vector using index name.
@return index def. if found else NULL */
UNIV_INLINE
const ib_index_def_t*
ib_table_find_index(
/*================*/
ib_vector_t* indexes, /*!< in: vector of indexes */
const char* name) /*!< in: index name */
{
ulint i;
for (i = 0; i < ib_vector_size(indexes); ++i) {
const ib_index_def_t* index_def;
index_def = (ib_index_def_t*) ib_vector_get(indexes, i);
if (innobase_strcasecmp(name, index_def->name) == 0) {
return(index_def);
}
}
return(NULL);
}
/*****************************************************************//**
Get the InnoDB internal precise type from the schema column definition.
@return precise type in api format */
UNIV_INLINE
ulint
ib_col_get_prtype(
/*==============*/
const ib_col_t* ib_col) /*!< in: column definition */
{
ulint prtype = 0;
if (ib_col->ib_col_attr & IB_COL_UNSIGNED) {
prtype |= DATA_UNSIGNED;
ut_a(ib_col->ib_col_type == IB_INT);
}
if (ib_col->ib_col_attr & IB_COL_NOT_NULL) {
prtype |= DATA_NOT_NULL;
}
return(prtype);
}
/*****************************************************************//**
Get the InnoDB internal main type from the schema column definition.
@return column main type */
UNIV_INLINE
ulint
ib_col_get_mtype(
/*==============*/
const ib_col_t* ib_col) /*!< in: column definition */
{
/* Note: The api0api.h types should map directly to
the internal numeric codes. */
return(ib_col->ib_col_type);
}
/*****************************************************************//**
Find a column in the the column vector with the same name.
@return col. def. if found else NULL */
UNIV_INLINE
const ib_col_t*
ib_table_find_col(
/*==============*/
const ib_vector_t* cols, /*!< in: column list head */
const char* name) /*!< in: column name to find */
{
ulint i;
for (i = 0; i < ib_vector_size(cols); ++i) {
const ib_col_t* ib_col;
ib_col = static_cast<const ib_col_t*>(
ib_vector_get((ib_vector_t*) cols, i));
if (innobase_strcasecmp(ib_col->name, name) == 0) {
return(ib_col);
}
}
return(NULL);
}
/*****************************************************************//**
Find a column in the the column list with the same name.
@return col. def. if found else NULL */
UNIV_INLINE
const ib_key_col_t*
ib_index_find_col(
/*==============*/
ib_vector_t* cols, /*!< in: column list head */
const char* name) /*!< in: column name to find */
{
ulint i;
for (i = 0; i < ib_vector_size(cols); ++i) {
const ib_key_col_t* ib_col;
ib_col = static_cast<ib_key_col_t*>(ib_vector_get(cols, i));
if (innobase_strcasecmp(ib_col->name, name) == 0) {
return(ib_col);
}
}
return(NULL);
}
#ifdef __WIN__
/*****************************************************************//**
Convert a string to lower case. */
@@ -946,34 +803,6 @@ ib_table_name_check(
/*****************************************************************//**
Get an index definition that is tagged as a clustered index.
@return cluster index schema */
UNIV_INLINE
ib_index_def_t*
ib_find_clustered_index(
/*====================*/
ib_vector_t* indexes) /*!< in: index defs. to search */
{
ulint i;
ulint n_indexes;
n_indexes = ib_vector_size(indexes);
for (i = 0; i < n_indexes; ++i) {
ib_index_def_t* ib_index_def;
ib_index_def = static_cast<ib_index_def_t*>(
ib_vector_get(indexes, i));
if (ib_index_def->clustered) {
return(ib_index_def);
}
}
return(NULL);
}
/*****************************************************************//**
Get a table id. The caller must have acquired the dictionary mutex.
@return DB_SUCCESS if found */
@@ -3552,41 +3381,6 @@ ib_cursor_set_cluster_access(
prebuilt->need_to_access_clustered = TRUE;
}
/*************************************************************//**
Convert and write an INT column value to an InnoDB tuple.
@return DB_SUCCESS or error */
UNIV_INLINE
ib_err_t
ib_tuple_write_int(
/*===============*/
ib_tpl_t ib_tpl, /*!< in/out: tuple to write to */
ulint col_no, /*!< in: column number */
const void* value, /*!< in: integer value */
ulint value_len) /*!< in: sizeof value type */
{
const dfield_t* dfield;
ulint data_len;
ulint type_len;
ib_tuple_t* tuple = (ib_tuple_t*) ib_tpl;
ut_a(col_no < ib_tuple_get_n_cols(ib_tpl));
dfield = ib_col_get_dfield(tuple, col_no);
data_len = dfield_get_len(dfield);
type_len = dtype_get_len(dfield_get_type(dfield));
if (dtype_get_mtype(dfield_get_type(dfield)) != DATA_INT
|| value_len != data_len) {
return(DB_DATA_MISMATCH);
}
return(ib_col_set_value(
ib_tpl, static_cast<ib_ulint_t>(col_no),
value, static_cast<ib_ulint_t>(type_len), true));
}
/*****************************************************************//**
Write an integer value to a column. Integers are stored in big-endian
format and will need to be converted from the host format.