mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 07:14:17 +01:00
dfa8ee365f
BitKeeper/deleted/.del-BinDist.sh~8ea6fee0be3de36: Delete: ndb/old_files/BinDist.sh BitKeeper/deleted/.del-Defs.mk~fab44ad996ed5499: Delete: ndb/old_files/Defs.mk BitKeeper/deleted/.del-Makefile~726e96331d4343ce: Delete: ndb/old_files/Makefile BitKeeper/deleted/.del-SrcDist.sh~ad4f1cd7aae4265b: Delete: ndb/old_files/SrcDist.sh BitKeeper/deleted/.del-configure~501239931f8bb1: Delete: ndb/old_files/configure BitKeeper/deleted/.del-Epilogue.mk~60f7edf886726154: Delete: ndb/old_files/Epilogue.mk BitKeeper/deleted/.del-README~b619a580720ec3d8: Delete: ndb/old_files/README BitKeeper/deleted/.del-env.sh~91075f1664ce8292: Delete: ndb/old_files/env.sh BitKeeper/deleted/.del-mysqlclusterenv.sh~f0d8a63e844255f5: Delete: ndb/old_files/mysqlclusterenv.sh BitKeeper/deleted/.del-Defs.DEBUG.mk~8ed7bb195181c74a: Delete: ndb/config/old_files/Defs.DEBUG.mk BitKeeper/deleted/.del-acinclude.m4~b1472f9faac0c71: Delete: ndb/config/old_files/acinclude.m4 BitKeeper/deleted/.del-Defs.HPUX.HPPA.GCC.mk~b50ab324c3ce07ce: Delete: ndb/config/old_files/Defs.HPUX.HPPA.GCC.mk BitKeeper/deleted/.del-Defs.IBMAIX.POWERPC.GCC.mk~76bea6928ca7b8f0: Delete: ndb/config/old_files/Defs.IBMAIX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.GCC.mk~15f3c82665d141a0: Delete: ndb/config/old_files/Defs.LINUX.x86.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.ICC.mk~e51a6e19daeb353: Delete: ndb/config/old_files/Defs.LINUX.x86.ICC.mk BitKeeper/deleted/.del-Defs.LINUX.x86_64.GCC.mk~9e853e7e1142b2d7: Delete: ndb/config/old_files/Defs.LINUX.x86_64.GCC.mk BitKeeper/deleted/.del-Defs.MACOSX.POWERPC.GCC.mk~d661574b758ac911: Delete: ndb/config/old_files/Defs.MACOSX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.OSE.PPC750.DIAB.mk~d5d7116c512290bc: Delete: ndb/config/old_files/Defs.OSE.PPC750.DIAB.mk BitKeeper/deleted/.del-Defs.RELEASE.mk~6c195617d8e1c8ec: Delete: ndb/config/old_files/Defs.RELEASE.mk BitKeeper/deleted/.del-Defs.RELEASE_TRACE.mk~e367d147bd3ad0bf: Delete: ndb/config/old_files/Defs.RELEASE_TRACE.mk BitKeeper/deleted/.del-Defs.SIMCELLO.SOFTOSE.GCC.mk~5acee8046e3dfd21: Delete: ndb/config/old_files/Defs.SIMCELLO.SOFTOSE.GCC.mk BitKeeper/deleted/.del-Defs.WIN32.x86.VC7.mk~582038c28dd89391: Delete: ndb/config/old_files/Defs.WIN32.x86.VC7.mk BitKeeper/deleted/.del-Defs.SOFTOSE.SPARC.GCC.mk~ebd0c4aab56c1202: Delete: ndb/config/old_files/Defs.SOFTOSE.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.FORTE6.mk~4367e18b8246761e: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.FORTE6.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.GCC.mk~d781a20b8235525c: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC_64.GCC.mk~76626f56dcd0e8e9: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC_64.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS6.SPARC.GCC.mk~2b05903f79ce771: Delete: ndb/config/old_files/Defs.SOLARIS6.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.TRU64X.ALPHA.GCC.mk~6ba3fc0cfaa37cb2: Delete: ndb/config/old_files/Defs.TRU64X.ALPHA.GCC.mk BitKeeper/deleted/.del-GuessConfig.sh~ebdb504ed6b7ab68: Delete: ndb/config/old_files/GuessConfig.sh BitKeeper/deleted/.del-Makefile.am~c28d15539f926269: Delete: ndb/config/old_files/Makefile.am BitKeeper/deleted/.del-configure.in~3e0ef32c155b79bc: Delete: ndb/config/old_files/configure.in BitKeeper/deleted/.del-config.h.in~b9209994763e30f8: Delete: ndb/config/old_files/config.h.in BitKeeper/deleted/.del-Makefile~71ad5c694da8711: Delete: ndb/src/old_files/Makefile BitKeeper/deleted/.del-Makefile~261cfb7897aa2259: Delete: ndb/test/newtonapi/Makefile BitKeeper/deleted/.del-Makefile~d46bb4a49ae611f9: Delete: ndb/test/odbc/Makefile BitKeeper/deleted/.del-Makefile_old~5ce89facf68772b: Delete: ndb/test/Makefile_old ndb/test/include/NdbSchemaCon.hpp: Rename: ndb/include/ndbapi/NdbSchemaCon.hpp -> ndb/test/include/NdbSchemaCon.hpp ndb/test/include/NdbSchemaOp.hpp: Rename: ndb/include/ndbapi/NdbSchemaOp.hpp -> ndb/test/include/NdbSchemaOp.hpp ndb/include/Makefile.am: removed NdbSchema from ndbapi ndb/include/ndbapi/NdbDictionary.hpp: added Column::getSize() and print function for Column::Type ndb/include/ndbapi/NdbRecAttr.hpp: made an operator<< friend to NdbRecAttr ndb/src/kernel/blocks/backup/restore/Restore.cpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/Restore.hpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/main.cpp: Rewritten restore to remove NdbSchema ndb/src/ndbapi/Makefile.am: removed NdbSchema from ndbapi ndb/src/ndbapi/NdbDictionary.cpp: added operator << for Column::Type ndb/src/ndbapi/NdbRecAttr.cpp: updated operator<< for NdbRecAttr ndb/src/ndbapi/Ndberr.cpp: removed NdbSchema from ndbapi ndb/test/src/Makefile.am: moved NdbSchema to test ndb/test/src/NDBT_ResultRow.cpp: use common print method for NDBT_ResultRow ndb/test/src/NdbBackup.cpp: fixed bug in testBackup ndb/test/src/NdbSchemaCon.cpp: moved NdbError NdbSchema ndb/test/src/NdbSchemaOp.cpp: updated include file list
147 lines
4 KiB
C++
147 lines
4 KiB
C++
/* Copyright (C) 2003 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; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
#ifndef NdbSchemaCon_H
|
|
#define NdbSchemaCon_H
|
|
|
|
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
|
|
|
|
#include <ndb_types.h>
|
|
#include "NdbError.hpp"
|
|
#include <NdbSchemaOp.hpp>
|
|
|
|
class NdbSchemaOp;
|
|
class Ndb;
|
|
class NdbApiSignal;
|
|
|
|
/**
|
|
* @class NdbSchemaCon
|
|
* @brief Represents a schema transaction.
|
|
*
|
|
* When creating a new table,
|
|
* the first step is to get a NdbSchemaCon object to represent
|
|
* the schema transaction.
|
|
* This is done by calling Ndb::startSchemaTransaction.
|
|
*
|
|
* The next step is to get a NdbSchemaOp object by calling
|
|
* NdbSchemaCon::getNdbSchemaOp.
|
|
* The NdbSchemaOp object then has methods to define the table and
|
|
* its attributes.
|
|
*
|
|
* Finally, the NdbSchemaCon::execute method inserts the table
|
|
* into the database.
|
|
*
|
|
* @note Currently only one table can be added per transaction.
|
|
* @note Depricated, use NdbDictionary
|
|
*/
|
|
class NdbSchemaCon
|
|
{
|
|
friend class Ndb;
|
|
friend class NdbSchemaOp;
|
|
|
|
public:
|
|
|
|
static
|
|
NdbSchemaCon* startSchemaTrans(Ndb* pNdb){
|
|
return new NdbSchemaCon(pNdb);
|
|
}
|
|
|
|
static
|
|
void closeSchemaTrans(NdbSchemaCon* pSchCon){
|
|
delete pSchCon;
|
|
}
|
|
|
|
|
|
/**
|
|
* Execute a schema transaction.
|
|
*
|
|
* @return 0 if successful otherwise -1.
|
|
*/
|
|
int execute();
|
|
|
|
/**
|
|
* Get a schemaoperation.
|
|
*
|
|
* @note Currently, only one operation per transaction is allowed.
|
|
*
|
|
* @return Pointer to a NdbSchemaOp or NULL if unsuccessful.
|
|
*/
|
|
NdbSchemaOp* getNdbSchemaOp();
|
|
|
|
/**
|
|
* Get the latest error
|
|
*
|
|
* @return Error object.
|
|
*/
|
|
const NdbError & getNdbError() const;
|
|
|
|
private:
|
|
|
|
/******************************************************************************
|
|
* These are the create and delete methods of this class.
|
|
*****************************************************************************/
|
|
|
|
NdbSchemaCon(Ndb* aNdb);
|
|
~NdbSchemaCon();
|
|
|
|
/******************************************************************************
|
|
* These are the private methods of this class.
|
|
*****************************************************************************/
|
|
|
|
void release(); // Release all schemaop in schemaCon
|
|
|
|
/***************************************************************************
|
|
* These methods are service methods to other classes in the NDBAPI.
|
|
***************************************************************************/
|
|
|
|
int checkMagicNumber(); // Verify correct object
|
|
int receiveDICTTABCONF(NdbApiSignal* aSignal);
|
|
int receiveDICTTABREF(NdbApiSignal* aSignal);
|
|
|
|
|
|
int receiveCREATE_INDX_CONF(NdbApiSignal*);
|
|
int receiveCREATE_INDX_REF(NdbApiSignal*);
|
|
int receiveDROP_INDX_CONF(NdbApiSignal*);
|
|
int receiveDROP_INDX_REF(NdbApiSignal*);
|
|
|
|
|
|
/*****************************************************************************
|
|
* These are the private variables of this class.
|
|
*****************************************************************************/
|
|
|
|
|
|
NdbError theError; // Errorcode
|
|
Ndb* theNdb; // Pointer to Ndb object
|
|
|
|
NdbSchemaOp* theFirstSchemaOpInList; // First operation in operation list.
|
|
int theMagicNumber; // Magic number
|
|
};
|
|
|
|
inline
|
|
int
|
|
NdbSchemaCon::checkMagicNumber()
|
|
{
|
|
if (theMagicNumber != 0x75318642)
|
|
return -1;
|
|
return 0;
|
|
}//NdbSchemaCon::checkMagicNumber()
|
|
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|