Commit 77d957af authored by Sergey Vojtovich's avatar Sergey Vojtovich

Merge 5.1-ibmdb2isee to 5.1-bugteam.

parents 4a0c1c7a 5d1f153e
...@@ -302,7 +302,9 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[ ...@@ -302,7 +302,9 @@ AC_DEFUN([MYSQL_CONFIGURE_PLUGINS],[
_MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_CONFIGURE_PLUGINS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
_MYSQL_EMIT_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,])) _MYSQL_EMIT_PLUGIN_ACTIONS(m4_bpatsubst(__mysql_plugin_list__, :, [,]))
AC_SUBST([mysql_se_dirs]) AC_SUBST([mysql_se_dirs])
AC_SUBST([mysql_se_distdirs])
AC_SUBST([mysql_pg_dirs]) AC_SUBST([mysql_pg_dirs])
AC_SUBST([mysql_pg_distdirs])
AC_SUBST([mysql_se_unittest_dirs]) AC_SUBST([mysql_se_unittest_dirs])
AC_SUBST([mysql_pg_unittest_dirs]) AC_SUBST([mysql_pg_unittest_dirs])
AC_SUBST([condition_dependent_plugin_modules]) AC_SUBST([condition_dependent_plugin_modules])
...@@ -354,6 +356,24 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[ ...@@ -354,6 +356,24 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[
fi fi
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
],[ ],[
# Plugin is not disabled, determine if it should be built,
# or only distributed
m4_ifdef([$6], [
if test ! -d "$srcdir/$6"; then
# Plugin directory was removed after autoconf was run; treat
# this as a disabled plugin
if test "X[$with_plugin_]$2" = Xyes; then
AC_MSG_RESULT([error])
AC_MSG_ERROR([disabled])
fi
# The result message will be printed below
[with_plugin_]$2=no
fi
])
m4_ifdef([$9],[ m4_ifdef([$9],[
if test "X[$with_plugin_]$2" = Xno; then if test "X[$with_plugin_]$2" = Xno; then
AC_MSG_RESULT([error]) AC_MSG_RESULT([error])
...@@ -372,6 +392,8 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[ ...@@ -372,6 +392,8 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[
;; ;;
esac esac
]) ])
if test "X[$with_plugin_]$2" = Xno; then if test "X[$with_plugin_]$2" = Xno; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
else else
...@@ -448,28 +470,36 @@ dnl Although this is "pretty", it breaks libmysqld build ...@@ -448,28 +470,36 @@ dnl Although this is "pretty", it breaks libmysqld build
condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp($11, [^.+[/$]], [\&])" condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp($11, [^.+[/$]], [\&])"
]) ])
fi fi
m4_ifdef([$6],[
if test -n "$mysql_use_plugin_dir" ; then
mysql_plugin_dirs="$mysql_plugin_dirs $6"
m4_syscmd(test -f "$6/configure")
ifelse(m4_sysval, 0,
[AC_CONFIG_SUBDIRS($6)],
[AC_CONFIG_FILES($6/Makefile)]
)
ifelse(m4_substr($6, 0, 8), [storage/],
[
[mysql_se_dirs="$mysql_se_dirs ]m4_substr($6, 8)"
mysql_se_unittest_dirs="$mysql_se_unittest_dirs ../$6"
],
m4_substr($6, 0, 7), [plugin/],
[
[mysql_pg_dirs="$mysql_pg_dirs ]m4_substr($6, 7)"
mysql_pg_unittest_dirs="$mysql_pg_unittest_dirs ../$6"
],
[AC_FATAL([don't know how to handle plugin dir ]$6)])
fi
])
fi fi
m4_ifdef([$6], [
if test -d "$srcdir/$6"; then
# Even if we don't build a plugin, we bundle its source into the dist
# file. So its Makefile (and Makefiles for any subdirs) must be
# generated for 'make dist' to work.
m4_syscmd(test -f "$6/configure")
ifelse(m4_sysval, 0,
[AC_CONFIG_SUBDIRS($6)],
[AC_CONFIG_FILES($6/Makefile)]
)
ifelse(
m4_substr($6, 0, 8), [storage/], [
mysql_se_distdirs="$mysql_se_distdirs m4_substr($6, 8)"
if test -n "$mysql_use_plugin_dir" ; then
mysql_se_dirs="$mysql_se_dirs m4_substr($6, 8)"
mysql_se_unittest_dirs="$mysql_se_unittest_dirs ../$6"
fi],
m4_substr($6, 0, 7), [plugin/], [
mysql_pg_distdirs="$mysql_pg_distdirs m4_substr($6, 7)"
if test -n "$mysql_use_plugin_dir" ; then
mysql_pg_dirs="$mysql_pg_dirs m4_substr($6, 7)"
mysql_pg_unittest_dirs="$mysql_pg_unittest_dirs ../$6"
fi],
[AC_FATAL([don't know how to handle plugin dir ]$6)])
fi
])
]) ])
]) ])
......
...@@ -22,7 +22,7 @@ AUTOMAKE_OPTIONS = foreign ...@@ -22,7 +22,7 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = fulltext/configure.in EXTRA_DIST = fulltext/configure.in
SUBDIRS = @mysql_pg_dirs@ SUBDIRS = @mysql_pg_dirs@
DIST_SUBDIRS = daemon_example fulltext DIST_SUBDIRS = @mysql_pg_distdirs@
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%
...@@ -20,6 +20,7 @@ AUTOMAKE_OPTIONS = foreign ...@@ -20,6 +20,7 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory # These are built from source in the Docs directory
EXTRA_DIST = EXTRA_DIST =
SUBDIRS = @mysql_se_dirs@ SUBDIRS = @mysql_se_dirs@
DIST_SUBDIRS = @mysql_se_distdirs@
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%
# 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
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include)
ADD_LIBRARY(ibmdb2i ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc
db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc
db2i_collationSupport.cc db2i_errors.cc db2i_constraints.cc
db2i_rir.cc db2i_sqlStatementStream.cc db2i_ioBuffers.cc db2i_myconv.cc)
#
# Copyright (c) 2007, 2008, IBM Corporation.
# All rights reserved.
#
#
#called from the top level Makefile
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
MYSQLLIBdir= $(pkglibdir)
pkgplugindir = $(pkglibdir)/plugin
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/sql \
-I$(srcdir) \
-I$ /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0f.xpf/cur/cmvc/base.pgm/my.xpf/apis \
-I$ /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/lg.xpf \
-I$ /afs/rchland.ibm.com/lande/shadow/dev2000/osxpf/v5r4m0.xpf/bld/cmvc/base.pgm/tq.xpf
WRAPLIBS=
LDADD =
DEFS = @DEFS@
noinst_HEADERS = ha_ibmdb2i.h db2i_collationSupport.h db2i_file.h \
db2i_ioBuffers.h db2i_blobCollection.h \
db2i_global.h db2i_misc.h db2i_charsetSupport.h db2i_errors.h \
db2i_ileBridge.h db2i_validatedPointer.h
EXTRA_LTLIBRARIES = ha_ibmdb2i.la
pkgplugin_LTLIBRARIES = @plugin_ibmdb2i_shared_target@
ha_ibmdb2i_la_LIBADD = -liconv
ha_ibmdb2i_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
ha_ibmdb2i_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_ibmdb2i_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \
db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc \
db2i_collationSupport.cc db2i_errors.cc db2i_constraints.cc \
db2i_rir.cc db2i_sqlStatementStream.cc db2i_ioBuffers.cc \
db2i_myconv.cc
EXTRA_LIBRARIES = libibmdb2i.a
noinst_LIBRARIES = @plugin_ibmdb2i_static_target@
libibmdb2i_a_CXXFLAGS = $(AM_CFLAGS)
libibmdb2i_a_CFLAGS = $(AM_CFLAGS)
libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES)
EXTRA_DIST = CMakeLists.txt plug.in
# Don't update the files from bitkeeper
%::SCCS/s.%
/*
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
(a) Redistributions of source code must retain this list of conditions, the
copyright notice in section {d} below, and the disclaimer following this
list of conditions.
(b) Redistributions in binary form must reproduce this list of conditions, the
copyright notice in section (d) below, and the disclaimer following this
list of conditions, in the documentation and/or other materials provided
with the distribution.
(c) The name of IBM may not be used to endorse or promote products derived from
this software without specific prior written permission.
(d) The text of the required copyright notice is:
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#include "db2i_blobCollection.h"
/**
Return the size to use when allocating space for blob reads.
@param fieldIndex The field to allocate for
@param[out] shouldProtect Indicates whether storage protection should be
applied to the space, because the size returned is
smaller than the maximum possible size.
*/
uint32
BlobCollection::getSizeToAllocate(int fieldIndex, bool& shouldProtect)
{
Field* field = table->getMySQLTable()->field[fieldIndex];
uint fieldLength = field->max_display_length();
if (fieldLength <= MAX_FULL_ALLOCATE_BLOB_LENGTH)
{
shouldProtect = false;
return fieldLength;
}
shouldProtect = true;
uint curMaxSize = table->getBlobFieldActualSize(fieldIndex);
uint defaultAllocSize = min(defaultAllocation, fieldLength);
return max(defaultAllocSize, curMaxSize);
}
void
BlobCollection::generateBuffer(int fieldIndex)
{
DBUG_ASSERT(table->db2Field(fieldIndex).isBlob());
bool protect;
buffers[table->getBlobIdFromField(fieldIndex)].Malloc(getSizeToAllocate(fieldIndex, protect), protect);
return;
}
/**
Realloc the read buffer associated with a blob field.
This is used when the previous allocation for a blob field is found to be
too small (this is discovered when QMY_READ trips over the protected boundary
page).
@param fieldIndex The field to be reallocated
@param size The size of buffer to allocate for this field.
*/
ValidatedPointer<char>&
BlobCollection::reallocBuffer(int fieldIndex, size_t size)
{
ProtectedBuffer& buf = buffers[table->getBlobIdFromField(fieldIndex)];
if (size <= buf.allocLen())
return buf.ptr();
table->updateBlobFieldActualSize(fieldIndex, size);
DBUG_PRINT("BlobCollection::reallocBuffer",("PERF: reallocing %d to %d: ", fieldIndex, size));
bool protect;
buf.Free();
buf.Malloc(getSizeToAllocate(fieldIndex, protect), protect);
return buf.ptr();
}
/*
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
(a) Redistributions of source code must retain this list of conditions, the
copyright notice in section {d} below, and the disclaimer following this
list of conditions.
(b) Redistributions in binary form must reproduce this list of conditions, the
copyright notice in section (d) below, and the disclaimer following this
list of conditions, in the documentation and/or other materials provided
with the distribution.
(c) The name of IBM may not be used to endorse or promote products derived from
this software without specific prior written permission.
(d) The text of the required copyright notice is:
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef DB2I_BLOBCOLLECTION_H
#define DB2I_BLOBCOLLECTION_H
#include "db2i_global.h"
#include "db2i_file.h"
/**
@class ProtectedBuffer
@brief Implements memory management for (optionally) protected buffers.
Buffers created with the protection option will have a guard page set on the
page following requested allocation size. The side effect is that the actual
allocation is up to 2*4096-1 bytes larger than the size requested by the
using code.
*/
class ProtectedBuffer
{
public:
ProtectedBuffer() : protectBuf(false)
{;}
void Malloc(size_t size, bool protect = false)
{
protectBuf = protect;
bufptr.alloc(size + (protectBuf ? 0x1fff : 0x0));
if ((void*)bufptr != NULL)
{
len = size;
if (protectBuf)
mprotect(protectedPage(), 0x1000, PROT_NONE);
#ifndef DBUG_OFF
// Prevents a problem with DBUG_PRINT over-reading in recent versions of
// MySQL
*((char*)protectedPage()-1) = 0;
#endif
}
}
void Free()
{
if ((void*)bufptr != NULL)
{
if (protectBuf)
mprotect(protectedPage(), 0x1000, PROT_READ | PROT_WRITE);
bufptr.dealloc();
}
}
~ProtectedBuffer()
{
Free();
}
ValidatedPointer<char>& ptr() {return bufptr;}
bool isProtected() const {return protectBuf;}
size_t allocLen() const {return len;}
private:
void* protectedPage()
{
return (void*)(((address64_t)(void*)bufptr + len + 0x1000) & ~0xfff);
}
ValidatedPointer<char> bufptr;
size_t len;
bool protectBuf;
};
/**
@class BlobCollection
@brief Manages memory allocation for reading blobs associated with a table.
Allocations are done on-demand and are protected with a guard page if less
than the max possible size is allocated.
*/
class BlobCollection
{
public:
BlobCollection(db2i_table* db2Table, uint32 defaultAllocSize) :
defaultAllocation(defaultAllocSize), table(db2Table)
{
buffers = new ProtectedBuffer[table->getBlobCount()];
}
~BlobCollection()
{
delete[] buffers;
}
ValidatedPointer<char>& getBufferPtr(int fieldIndex)
{
int blobIndex = table->getBlobIdFromField(fieldIndex);
if ((char*)buffers[blobIndex].ptr() == NULL)
generateBuffer(fieldIndex);
return buffers[blobIndex].ptr();
}
ValidatedPointer<char>& reallocBuffer(int fieldIndex, size_t size);
private:
uint32 getSizeToAllocate(int fieldIndex, bool& shouldProtect);
void generateBuffer(int fieldIndex);
db2i_table* table; // The table being read
ProtectedBuffer* buffers; // The buffers
uint32 defaultAllocation;
/* The default size to use when first allocating a buffer */
};
#endif
This diff is collapsed.
/*
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
(a) Redistributions of source code must retain this list of conditions, the
copyright notice in section {d} below, and the disclaimer following this
list of conditions.
(b) Redistributions in binary form must reproduce this list of conditions, the
copyright notice in section (d) below, and the disclaimer following this
list of conditions, in the documentation and/or other materials provided
with the distribution.
(c) The name of IBM may not be used to endorse or promote products derived from
this software without specific prior written permission.
(d) The text of the required copyright notice is:
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef DB2I_CHARSETSUPPORT_H
#define DB2I_CHARSETSUPPORT_H
#include "db2i_global.h"
#include "mysql_priv.h"
#include <mysql/plugin.h>
#include "db2i_iconv.h"
/**
@enum enum_conversionDirection
Conversion directions for getConversion()
*/
enum enum_conversionDirection
{
toMySQL,
toDB2
};
int initCharsetSupport();
void doneCharsetSupport();
int32 convertIANAToDb2Ccsid(const char* parmIANADesc, uint16* db2Ccsid);
int32 getEncodingScheme(const uint16 inCcsid, int32& outEncodingScheme);
int32 getAssociatedCCSID(const uint16 inCcsid, const int inEncodingScheme, uint16* outCcsid);
int convToEbcdic(const char* input, char* output, size_t ilen);
int convFromEbcdic(const char* input, char* output, size_t ilen);
int32 getConversion(enum_conversionDirection direction, const CHARSET_INFO* cs, uint16 db2CCSID, iconv_t& conversion);
#endif
This diff is collapsed.
/*
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
(a) Redistributions of source code must retain this list of conditions, the
copyright notice in section {d} below, and the disclaimer following this
list of conditions.
(b) Redistributions in binary form must reproduce this list of conditions, the
copyright notice in section (d) below, and the disclaimer following this
list of conditions, in the documentation and/or other materials provided
with the distribution.
(c) The name of IBM may not be used to endorse or promote products derived from
this software without specific prior written permission.
(d) The text of the required copyright notice is:
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef DB2I_COLLATIONSUPPORT_H
#define DB2I_COLLATIONSUPPORT_H
#include "db2i_global.h"
#include "mysql_priv.h"
int32 updateAssociatedSortSequence(const CHARSET_INFO* charset,
char* fileSortSequenceType,
char* fileSortSequence,
char* fileSortSequenceLibrary);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
(a) Redistributions of source code must retain this list of conditions, the
copyright notice in section {d} below, and the disclaimer following this
list of conditions.
(b) Redistributions in binary form must reproduce this list of conditions, the
copyright notice in section (d) below, and the disclaimer following this
list of conditions, in the documentation and/or other materials provided
with the distribution.
(c) The name of IBM may not be used to endorse or promote products derived from
this software without specific prior written permission.
(d) The text of the required copyright notice is:
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef DB2I_ERRORS_H
#define DB2I_ERRORS_H
#include "qmyse.h"
class THD;
/**
@enum DB2I_errors
@brief These are the errors that can be returned by the storage engine proper
and that are specific to the engine. Refer to db2i_errors.cc for text
descriptions of the errors.
*/
enum DB2I_errors
{
DB2I_FIRST_ERR = 2500,
DB2I_ERR_ICONV_OPEN,
DB2I_ERR_INVALID_NAME,
DB2I_ERR_RENAME_MOVE,
DB2I_ERR_RENAME_QTEMP,
DB2I_ERR_PART_AUTOINC,
DB2I_ERR_UNKNOWN_ENCODING,
DB2I_ERR_RESERVED,
DB2I_ERR_TABLE_NOT_FOUND,
DB2I_ERR_RESOLVE_OBJ,
DB2I_ERR_PGMCALL,
DB2I_ERR_ILECALL,
DB2I_ERR_ICONV,
DB2I_ERR_QTQGESP,
DB2I_ERR_QTQGRDC,
DB2I_ERR_INVALID_COL_VALUE,
DB2I_ERR_TOO_LONG_SCHEMA,
DB2I_ERR_MIXED_COLLATIONS,
DB2I_ERR_SRTSEQ,
DB2I_ERR_SUB_CHARS,
DB2I_ERR_PRECISION,
DB2I_ERR_INVALID_DATA,
DB2I_ERR_RESERVED2,
DB2I_ERR_ILL_CHAR,
DB2I_ERR_BAD_RDB_NAME,
DB2I_ERR_UNKNOWN_IDX,
DB2I_ERR_DISCOVERY_MISMATCH,
DB2I_ERR_WARN_CREATE_DISCOVER,
DB2I_ERR_WARN_COL_ATTRS,
DB2I_LAST_ERR = DB2I_ERR_WARN_COL_ATTRS
};
void getErrTxt(int errcode, ...);
void reportSystemAPIError(int errCode, const Qmy_Error_output *errInfo);
void warning(THD *thd, int errCode, ...);
const char* DB2I_SQL0350 = "\xE2\xD8\xD3\xF0\xF3\xF5\xF0"; // SQL0350 in EBCDIC
const char* DB2I_CPF503A = "\xC3\xD7\xC6\xF5\xF0\xF3\xC1"; // CPF503A in EBCDIC
const char* DB2I_SQL0538 = "\xE2\xD8\xD3\xF0\xF5\xF3\xF8"; // SQL0538 in EBCDIC
#endif
This diff is collapsed.
This diff is collapsed.
/*
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
(a) Redistributions of source code must retain this list of conditions, the
copyright notice in section {d} below, and the disclaimer following this
list of conditions.
(b) Redistributions in binary form must reproduce this list of conditions, the
copyright notice in section (d) below, and the disclaimer following this
list of conditions, in the documentation and/or other materials provided
with the distribution.
(c) The name of IBM may not be used to endorse or promote products derived from
this software without specific prior written permission.
(d) The text of the required copyright notice is:
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef DB2I_GLOBAL_H
#define DB2I_GLOBAL_H
#define MYSQL_SERVER 1
#include "my_global.h"
#include "my_sys.h"
const uint MAX_DB2_KEY_PARTS=120;
const int MAX_DB2_V5R4_LIBNAME_LENGTH = 10;
const int MAX_DB2_V6R1_LIBNAME_LENGTH = 30;
const int MAX_DB2_SCHEMANAME_LENGTH=258;
const int MAX_DB2_FILENAME_LENGTH=258;
const int MAX_DB2_COLNAME_LENGTH=128;
const int MAX_DB2_SAVEPOINTNAME_LENGTH=128;
const int MAX_DB2_QUALIFIEDNAME_LENGTH=MAX_DB2_V6R1_LIBNAME_LENGTH + 1 + MAX_DB2_FILENAME_LENGTH;
const uint32 MAX_CHAR_LENGTH = 32765;
const uint32 MAX_VARCHAR_LENGTH = 32739;
const uint32 MAX_DEC_PRECISION = 63;
const uint32 MAX_BLOB_LENGTH = 2147483646;
const uint32 MAX_BINARY_LENGTH = MAX_CHAR_LENGTH;
const uint32 MAX_VARBINARY_LENGTH = MAX_VARCHAR_LENGTH;
const uint32 MAX_FULL_ALLOCATE_BLOB_LENGTH = 65536;
const uint32 MAX_FOREIGN_LEN = 64000;
const char* DB2I_TEMP_TABLE_SCHEMA = "QTEMP";
const char DB2I_ADDL_INDEX_NAME_DELIMITER[5] = {'_','_','_','_','_'};
const char DB2I_DEFAULT_INDEX_NAME_DELIMITER[3] = {'_','_','_'};
const int DB2I_INDEX_NAME_LENGTH_TO_PRESERVE = 110;
enum enum_DB2I_INDEX_TYPE
{
typeNone = 0,
typeDefault = 'D',
typeHex = 'H',
typeAscii = 'A'
};
void* roundToQuadWordBdy(void* ptr)
{
return (void*)(((uint64)(ptr)+0xf) & ~0xf);
}
typedef uint64_t ILEMemHandle;
struct OSVersion
{
uint8 v;
uint8 r;
};
extern OSVersion osVersion;
/**
Allocate 16-byte aligned space using the MySQL heap allocator
@details Many of the spaces used by the QMY_* APIS are required to be
aligned on 16 byte boundaries. The standard system malloc will do this
alignment by default. However, in order to use the heap debug and tracking
features of the mysql allocator, we chose to implement an aligning wrapper
around my_malloc. Essentially, we overallocate the storage space, find the
first aligned address in the space, store a pointer to the true malloc
allocation in the bytes immediately preceding the aligned address, and return
the aligned address to the caller.
@parm size The size of heap storage needed
@return A 16-byte aligned pointer to the storage requested.
*/
void* malloc_aligned(size_t size)
{
char* p;
char* base;
base = (char*)my_malloc(size + sizeof(void*) + 15, MYF(MY_WME));
if (likely(base))
{
p = (char*)roundToQuadWordBdy(base + sizeof(void*));
char** p2 = (char**)(p - sizeof(void*));
*p2 = base;
}
else
p = NULL;
return p;
}
/**
Free a 16-byte aligned space alloced by malloc_aligned
@details We know that a pointer to the true malloced storage immediately
precedes the aligned address, so we pull that out and call my_free().
@parm p A 16-byte aligned pointer generated by malloc_aligned
*/
void free_aligned(void* p)
{
if (likely(p))
{
my_free(*(char**)((char*)p-sizeof(void*)), MYF(0));
}
}
#endif
/*
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
(a) Redistributions of source code must retain this list of conditions, the
copyright notice in section {d} below, and the disclaimer following this
list of conditions.
(b) Redistributions in binary form must reproduce this list of conditions, the
copyright notice in section (d) below, and the disclaimer following this
list of conditions, in the documentation and/or other materials provided
with the distribution.
(c) The name of IBM may not be used to endorse or promote products derived from
this software without specific prior written permission.
(d) The text of the required copyright notice is:
Licensed Materials - Property of IBM
DB2 Storage Engine Enablement
Copyright IBM Corporation 2007,2008
All rights reserved
THIS SOFTWARE IS PROVIDED BY IBM CORPORATION "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL IBM CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
/**
@file
@brief Used to redefine iconv symbols to the optimized "myconv" ones
*/
#ifndef DB2I_ICONV_H
#define DB2I_ICONV_H
#include "db2i_myconv.h"
#define iconv_open(A, B) myconv_open(A, B, CONVERTER_DMAP)
#define iconv_close myconv_close
#define iconv myconv_dmap
#define iconv_t myconv_t
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment