mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
d73b5b8e83
Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header Added GPL copyright text my_vle.h, rpl_utility.h, my_vle.c, base64-t.c, rpl_utility.cc: Changed copyright header formatting some plugin_example.c, daemon_example.c: Added "Copyright (C) 2006 MySQL AB" to GPL header CMakeLists.txt: Added GPL copyright text client/CMakeLists.txt: Added GPL copyright text dbug/CMakeLists.txt: Added GPL copyright text extra/CMakeLists.txt: Added GPL copyright text extra/yassl/CMakeLists.txt: Added GPL copyright text extra/yassl/taocrypt/CMakeLists.txt: Added GPL copyright text libmysql/CMakeLists.txt: Added GPL copyright text libmysqld/CMakeLists.txt: Added GPL copyright text libmysqld/examples/CMakeLists.txt: Added GPL copyright text mysys/CMakeLists.txt: Added GPL copyright text regex/CMakeLists.txt: Added GPL copyright text server-tools/instance-manager/CMakeLists.txt: Added GPL copyright text sql/CMakeLists.txt: Added GPL copyright text storage/archive/CMakeLists.txt: Added GPL copyright text storage/blackhole/CMakeLists.txt: Added GPL copyright text storage/csv/CMakeLists.txt: Added GPL copyright text storage/example/CMakeLists.txt: Added GPL copyright text storage/federated/CMakeLists.txt: Added GPL copyright text storage/heap/CMakeLists.txt: Added GPL copyright text storage/innobase/CMakeLists.txt: Added GPL copyright text storage/myisam/CMakeLists.txt: Added GPL copyright text storage/myisammrg/CMakeLists.txt: Added GPL copyright text strings/CMakeLists.txt: Added GPL copyright text tests/CMakeLists.txt: Added GPL copyright text vio/CMakeLists.txt: Added GPL copyright text zlib/CMakeLists.txt: Added GPL copyright text include/my_vle.h: Changed copyright header formatting some mysys/my_vle.c: Changed copyright header formatting some plugin/daemon_example/daemon_example.c: Added "Copyright (C) 2006 MySQL AB" to GPL header plugin/fulltext/plugin_example.c: Added "Copyright (C) 2006 MySQL AB" to GPL header plugin/Makefile.am: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/authors.h: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/contributors.h: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/item_xmlfunc.cc: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/partition_element.h: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/partition_info.h: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/rpl_injector.cc: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/rpl_injector.h: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/sql_binlog.cc: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/sql_servers.h: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header storage/Makefile.am: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header storage/archive/Makefile.am: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header storage/blackhole/Makefile.am: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header storage/csv/Makefile.am: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header storage/example/Makefile.am: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header storage/federated/Makefile.am: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header win/Makefile.am: Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header Adjusted year(s) in copyright header sql/rpl_utility.cc: Changed copyright header formatting some sql/rpl_utility.h: Changed copyright header formatting some unittest/mysys/base64-t.c: Changed copyright header formatting some include/my_uctype.h: Added GPL copyright text plugin/daemon_example/Makefile.am: Added GPL copyright text plugin/fulltext/Makefile.am: Added GPL copyright text scripts/make_win_bin_dist: Added GPL copyright text server-tools/instance-manager/user_management_commands.cc: Added GPL copyright text sql/sql_builtin.cc.in: Added GPL copyright text sql/sql_show.h: Added GPL copyright text storage/archive/archive_test.c: Added GPL copyright text storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: Added GPL copyright text storage/ndb/src/kernel/blocks/diskpage.cpp: Added GPL copyright text storage/ndb/src/kernel/vm/Rope.cpp: Added GPL copyright text storage/ndb/src/mgmsrv/ParamInfo.hpp: Added GPL copyright text strings/uctypedump.c: Added GPL copyright text unittest/Makefile.am: Added GPL copyright text unittest/examples/Makefile.am: Added GPL copyright text unittest/examples/core-t.c: Added GPL copyright text unittest/examples/no_plan-t.c: Added GPL copyright text unittest/examples/simple-t.c: Added GPL copyright text unittest/examples/skip-t.c: Added GPL copyright text unittest/examples/skip_all-t.c: Added GPL copyright text unittest/examples/todo-t.c: Added GPL copyright text unittest/mysys/Makefile.am: Added GPL copyright text unittest/mytap/Makefile.am: Added GPL copyright text unittest/mytap/t/Makefile.am: Added GPL copyright text unittest/mytap/t/basic-t.c: Added GPL copyright text unittest/unit.pl: Added GPL copyright text win/build-vs71.bat: Added GPL copyright text win/build-vs8.bat: Added GPL copyright text win/configure.js: Added GPL copyright text
153 lines
4 KiB
C++
153 lines
4 KiB
C++
/* Copyright (C) 2006 MySQL AB
|
|
|
|
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 Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
|
|
|
#include "rpl_utility.h"
|
|
|
|
uint32
|
|
field_length_from_packed(enum_field_types const field_type,
|
|
byte const *const data)
|
|
{
|
|
uint32 length;
|
|
|
|
switch (field_type) {
|
|
case MYSQL_TYPE_DECIMAL:
|
|
case MYSQL_TYPE_NEWDECIMAL:
|
|
length= ~(uint32) 0;
|
|
break;
|
|
case MYSQL_TYPE_YEAR:
|
|
case MYSQL_TYPE_TINY:
|
|
length= 1;
|
|
break;
|
|
case MYSQL_TYPE_SHORT:
|
|
length= 2;
|
|
break;
|
|
case MYSQL_TYPE_INT24:
|
|
length= 3;
|
|
break;
|
|
case MYSQL_TYPE_LONG:
|
|
length= 4;
|
|
break;
|
|
#ifdef HAVE_LONG_LONG
|
|
case MYSQL_TYPE_LONGLONG:
|
|
length= 8;
|
|
break;
|
|
#endif
|
|
case MYSQL_TYPE_FLOAT:
|
|
length= sizeof(float);
|
|
break;
|
|
case MYSQL_TYPE_DOUBLE:
|
|
length= sizeof(double);
|
|
break;
|
|
case MYSQL_TYPE_NULL:
|
|
length= 0;
|
|
break;
|
|
case MYSQL_TYPE_NEWDATE:
|
|
length= 3;
|
|
break;
|
|
case MYSQL_TYPE_DATE:
|
|
length= 4;
|
|
break;
|
|
case MYSQL_TYPE_TIME:
|
|
length= 3;
|
|
break;
|
|
case MYSQL_TYPE_TIMESTAMP:
|
|
length= 4;
|
|
break;
|
|
case MYSQL_TYPE_DATETIME:
|
|
length= 8;
|
|
break;
|
|
break;
|
|
case MYSQL_TYPE_BIT:
|
|
length= ~(uint32) 0;
|
|
break;
|
|
default:
|
|
/* This case should never be chosen */
|
|
DBUG_ASSERT(0);
|
|
/* If something goes awfully wrong, it's better to get a string than die */
|
|
case MYSQL_TYPE_STRING:
|
|
length= uint2korr(data);
|
|
break;
|
|
|
|
case MYSQL_TYPE_ENUM:
|
|
case MYSQL_TYPE_SET:
|
|
case MYSQL_TYPE_VAR_STRING:
|
|
case MYSQL_TYPE_VARCHAR:
|
|
length= ~(uint32) 0; // NYI
|
|
break;
|
|
|
|
case MYSQL_TYPE_TINY_BLOB:
|
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
|
case MYSQL_TYPE_LONG_BLOB:
|
|
case MYSQL_TYPE_BLOB:
|
|
case MYSQL_TYPE_GEOMETRY:
|
|
length= ~(uint32) 0; // NYI
|
|
break;
|
|
}
|
|
|
|
return length;
|
|
}
|
|
|
|
/*********************************************************************
|
|
* table_def member definitions *
|
|
*********************************************************************/
|
|
|
|
/*
|
|
Is the definition compatible with a table?
|
|
|
|
*/
|
|
int
|
|
table_def::compatible_with(RELAY_LOG_INFO *rli, TABLE *table)
|
|
const
|
|
{
|
|
/*
|
|
We only check the initial columns for the tables.
|
|
*/
|
|
uint const cols_to_check= min(table->s->fields, size());
|
|
int error= 0;
|
|
|
|
TABLE_SHARE const *const tsh= table->s;
|
|
|
|
/*
|
|
To get proper error reporting for all columns of the table, we
|
|
both check the width and iterate over all columns.
|
|
*/
|
|
if (tsh->fields < size())
|
|
{
|
|
DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
|
|
error= 1;
|
|
slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
|
|
"Table width mismatch - "
|
|
"received %u columns, %s.%s has %u columns",
|
|
(uint) size(), tsh->db.str, tsh->table_name.str,
|
|
tsh->fields);
|
|
}
|
|
|
|
for (uint col= 0 ; col < cols_to_check ; ++col)
|
|
{
|
|
if (table->field[col]->type() != type(col))
|
|
{
|
|
DBUG_ASSERT(col < size() && col < tsh->fields);
|
|
DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
|
|
error= 1;
|
|
slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
|
|
"Column %d type mismatch - "
|
|
"received type %d, %s.%s has type %d",
|
|
col, type(col), tsh->db.str, tsh->table_name.str,
|
|
table->field[col]->type());
|
|
}
|
|
}
|
|
|
|
return error;
|
|
}
|