mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
added ndb_init.h to distribution
added missing copyright text moved ndb_init things to separate header file removed ndb_global include documented cluster connection class moved internal constants to NdbImpl.hpp class changed wait_until_ready behaviour somewhat ndb/config/type_ndbapitest.mk.am: corrected -I flag ndb/include/Makefile.am: added ndb_init.h to distribution ndb/include/ndb_global.h.in: added copyright text moved ndb_init things to separate header file ndb/include/ndbapi/NdbBlob.hpp: moved error codes and internal constants to NdbBlobImpl.hpp ndb/include/ndbapi/NdbReceiver.hpp: removed ndb_global include ndb/include/ndbapi/ndb_cluster_connection.hpp: documented cluster connection class changed wait_until_ready behaviour somewhat ndb/src/ndbapi/Ndb.cpp: documented cluster connection class changed wait_until_ready behaviour somewhat ndb/src/ndbapi/NdbBlob.cpp: moved internal constants to NdbImpl.hpp class ndb/src/ndbapi/NdbDictionaryImpl.cpp: moved internal constants to NdbImpl.hpp class ndb/src/ndbapi/NdbOperationInt.cpp: changed includes ndb/src/ndbapi/ndb_cluster_connection.cpp: changed wait_until_ready behaviour somewhat ndb/test/ndbapi/testBlobs.cpp: use impl class to get constants
This commit is contained in:
@ -5,7 +5,7 @@ LDADD += $(top_builddir)/ndb/test/src/libNDBT.a \
|
|||||||
$(top_builddir)/mysys/libmysys.a \
|
$(top_builddir)/mysys/libmysys.a \
|
||||||
$(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
|
$(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
|
||||||
|
|
||||||
INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
|
INCLUDES += -I$(top_srcdir) -I$(top_srcdir)/include \
|
||||||
-I$(top_srcdir)/ndb/include \
|
-I$(top_srcdir)/ndb/include \
|
||||||
-I$(top_srcdir)/ndb/include/ndbapi \
|
-I$(top_srcdir)/ndb/include/ndbapi \
|
||||||
-I$(top_srcdir)/ndb/include/util \
|
-I$(top_srcdir)/ndb/include/util \
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
include $(top_srcdir)/ndb/config/common.mk.am
|
include $(top_srcdir)/ndb/config/common.mk.am
|
||||||
|
|
||||||
ndbinclude_HEADERS = \
|
ndbinclude_HEADERS = \
|
||||||
|
ndb_init.h \
|
||||||
ndb_types.h \
|
ndb_types.h \
|
||||||
ndb_version.h
|
ndb_version.h
|
||||||
|
|
||||||
|
@ -1,3 +1,18 @@
|
|||||||
|
/* 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 NDBGLOBAL_H
|
#ifndef NDBGLOBAL_H
|
||||||
#define NDBGLOBAL_H
|
#define NDBGLOBAL_H
|
||||||
@ -96,15 +111,12 @@ extern "C" {
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
/* call in main() - does not return on error */
|
|
||||||
extern int ndb_init(void);
|
|
||||||
extern void ndb_end(int);
|
|
||||||
#define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "ndb_init.h"
|
||||||
|
|
||||||
#ifdef SCO
|
#ifdef SCO
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
|
32
ndb/include/ndb_init.h
Normal file
32
ndb/include/ndb_init.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* 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 NDB_INIT_H
|
||||||
|
#define NDB_INIT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/* call in main() - does not return on error */
|
||||||
|
extern int ndb_init(void);
|
||||||
|
extern void ndb_end(int);
|
||||||
|
#define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -182,27 +182,12 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Get blob parts table name. Useful only to test programs.
|
* Get blob parts table name. Useful only to test programs.
|
||||||
*/
|
*/
|
||||||
STATIC_CONST( BlobTableNameSize = 40 );
|
|
||||||
static int getBlobTableName(char* btname, Ndb* anNdb, const char* tableName, const char* columnName);
|
static int getBlobTableName(char* btname, Ndb* anNdb, const char* tableName, const char* columnName);
|
||||||
/**
|
/**
|
||||||
* Return error object. The error may be blob specific (below) or may
|
* Return error object. The error may be blob specific (below) or may
|
||||||
* be copied from a failed implicit operation.
|
* be copied from a failed implicit operation.
|
||||||
*/
|
*/
|
||||||
const NdbError& getNdbError() const;
|
const NdbError& getNdbError() const;
|
||||||
// "Invalid blob attributes or invalid blob parts table"
|
|
||||||
STATIC_CONST( ErrTable = 4263 );
|
|
||||||
// "Invalid usage of blob attribute"
|
|
||||||
STATIC_CONST( ErrUsage = 4264 );
|
|
||||||
// "Method is not valid in current blob state"
|
|
||||||
STATIC_CONST( ErrState = 4265 );
|
|
||||||
// "Invalid blob seek position"
|
|
||||||
STATIC_CONST( ErrSeek = 4266 );
|
|
||||||
// "Corrupted blob value"
|
|
||||||
STATIC_CONST( ErrCorrupt = 4267 );
|
|
||||||
// "Error in blob head update forced rollback of transaction"
|
|
||||||
STATIC_CONST( ErrAbort = 4268 );
|
|
||||||
// "Unknown blob error"
|
|
||||||
STATIC_CONST( ErrUnknown = 4269 );
|
|
||||||
/**
|
/**
|
||||||
* Return info about all blobs in this operation.
|
* Return info about all blobs in this operation.
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Not part of public interface
|
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Not part of public interface
|
||||||
|
|
||||||
#include <ndb_types.h>
|
#include <ndb_types.h>
|
||||||
#include <ndb_global.h>
|
|
||||||
|
|
||||||
class Ndb;
|
class Ndb;
|
||||||
class NdbConnection;
|
class NdbConnection;
|
||||||
@ -131,7 +130,9 @@ int
|
|||||||
NdbReceiver::execTCOPCONF(Uint32 len){
|
NdbReceiver::execTCOPCONF(Uint32 len){
|
||||||
Uint32 tmp = m_received_result_length;
|
Uint32 tmp = m_received_result_length;
|
||||||
m_expected_result_length = len;
|
m_expected_result_length = len;
|
||||||
|
#ifdef assert
|
||||||
assert(!(tmp && !len));
|
assert(!(tmp && !len));
|
||||||
|
#endif
|
||||||
return ((bool)len ^ (bool)tmp ? 0 : 1);
|
return ((bool)len ^ (bool)tmp ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,28 +18,72 @@
|
|||||||
#ifndef CLUSTER_CONNECTION_HPP
|
#ifndef CLUSTER_CONNECTION_HPP
|
||||||
#define CLUSTER_CONNECTION_HPP
|
#define CLUSTER_CONNECTION_HPP
|
||||||
|
|
||||||
struct Ndb_cluster_connection_node_iter;
|
/**
|
||||||
|
* @class Ndb_cluster_connection
|
||||||
|
* @brief Represents a connection to a cluster of storage nodes
|
||||||
|
*
|
||||||
|
* Always start your application program by creating a
|
||||||
|
* Ndb_cluster_connection object. Your application should contain
|
||||||
|
* only one Ndb_cluster_connection. Your application connects to
|
||||||
|
* a cluster management server when method connect() is called.
|
||||||
|
* With the method wait_until_ready() it is possible to wait
|
||||||
|
* for the connection to one or several storage nodes.
|
||||||
|
*/
|
||||||
class Ndb_cluster_connection {
|
class Ndb_cluster_connection {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Create a connection to a cluster of storage nodes
|
||||||
|
*
|
||||||
|
* @param specify the connectstring for where to find the
|
||||||
|
* management server
|
||||||
|
*/
|
||||||
Ndb_cluster_connection(const char * connect_string = 0);
|
Ndb_cluster_connection(const char * connect_string = 0);
|
||||||
~Ndb_cluster_connection();
|
~Ndb_cluster_connection();
|
||||||
int connect(int no_retries, int retry_delay_in_seconds, int verbose);
|
|
||||||
int start_connect_thread(int (*connect_callback)(void)= 0);
|
|
||||||
|
|
||||||
// add check coupled to init state of cluster connection
|
/**
|
||||||
// timeout_after_first_alive negative - ok only if all alive
|
* Connect to a cluster management server
|
||||||
// timeout_after_first_alive positive - ok if some alive
|
*
|
||||||
|
* @param no_retries specifies the number of retries to perform
|
||||||
|
* if the connect fails, negative number results in infinite
|
||||||
|
* number of retries
|
||||||
|
* @param retry_delay_in_seconds specifies how often retries should
|
||||||
|
* be performed
|
||||||
|
* @param verbose specifies if the method should print progess
|
||||||
|
*
|
||||||
|
* @return 0 if success,
|
||||||
|
* 1 if retriable error,
|
||||||
|
* -1 if non-retriable error
|
||||||
|
*/
|
||||||
|
int connect(int no_retries=0, int retry_delay_in_seconds=1, int verbose=0);
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
|
||||||
|
int start_connect_thread(int (*connect_callback)(void)= 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait until one or several storage nodes are connected
|
||||||
|
*
|
||||||
|
* @param time_out_for_first_alive number of seconds to wait until
|
||||||
|
* first alive node is detected
|
||||||
|
* @param timeout_after_first_alive number of seconds to wait after
|
||||||
|
* first alive node is detected
|
||||||
|
*
|
||||||
|
* @return 0 all nodes alive,
|
||||||
|
* > 0 at least one node alive,
|
||||||
|
* < 0 error
|
||||||
|
*/
|
||||||
int wait_until_ready(int timeout_for_first_alive,
|
int wait_until_ready(int timeout_for_first_alive,
|
||||||
int timeout_after_first_alive);
|
int timeout_after_first_alive);
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
|
||||||
const char *get_connectstring(char *buf, int buf_sz) const;
|
const char *get_connectstring(char *buf, int buf_sz) const;
|
||||||
int get_connected_port() const;
|
int get_connected_port() const;
|
||||||
const char *get_connected_host() const;
|
const char *get_connected_host() const;
|
||||||
|
|
||||||
void set_optimized_node_selection(int val);
|
void set_optimized_node_selection(int val);
|
||||||
|
|
||||||
Uint32 no_db_nodes();
|
int no_db_nodes();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Ndb;
|
friend class Ndb;
|
||||||
|
@ -282,7 +282,7 @@ Ndb::waitUntilReady(int timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (theImpl->m_ndb_cluster_connection.wait_until_ready
|
if (theImpl->m_ndb_cluster_connection.wait_until_ready
|
||||||
(timeout-secondsCounter,30))
|
(timeout-secondsCounter,30) < 0)
|
||||||
{
|
{
|
||||||
theError.code = 4009;
|
theError.code = 4009;
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <NdbIndexOperation.hpp>
|
#include <NdbIndexOperation.hpp>
|
||||||
#include <NdbRecAttr.hpp>
|
#include <NdbRecAttr.hpp>
|
||||||
#include <NdbBlob.hpp>
|
#include <NdbBlob.hpp>
|
||||||
|
#include "NdbBlobImpl.hpp"
|
||||||
#include <NdbScanOperation.hpp>
|
#include <NdbScanOperation.hpp>
|
||||||
|
|
||||||
#ifdef NDB_BLOB_DEBUG
|
#ifdef NDB_BLOB_DEBUG
|
||||||
@ -85,14 +86,14 @@ void
|
|||||||
NdbBlob::getBlobTableName(char* btname, const NdbTableImpl* t, const NdbColumnImpl* c)
|
NdbBlob::getBlobTableName(char* btname, const NdbTableImpl* t, const NdbColumnImpl* c)
|
||||||
{
|
{
|
||||||
assert(t != 0 && c != 0 && c->getBlobType());
|
assert(t != 0 && c != 0 && c->getBlobType());
|
||||||
memset(btname, 0, BlobTableNameSize);
|
memset(btname, 0, NdbBlobImpl::BlobTableNameSize);
|
||||||
sprintf(btname, "NDB$BLOB_%d_%d", (int)t->m_tableId, (int)c->m_attrId);
|
sprintf(btname, "NDB$BLOB_%d_%d", (int)t->m_tableId, (int)c->m_attrId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NdbBlob::getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c)
|
NdbBlob::getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c)
|
||||||
{
|
{
|
||||||
char btname[BlobTableNameSize];
|
char btname[NdbBlobImpl::BlobTableNameSize];
|
||||||
getBlobTableName(btname, t, c);
|
getBlobTableName(btname, t, c);
|
||||||
bt.setName(btname);
|
bt.setName(btname);
|
||||||
bt.setLogging(t->getLogging());
|
bt.setLogging(t->getLogging());
|
||||||
@ -450,15 +451,15 @@ NdbBlob::getValue(void* data, Uint32 bytes)
|
|||||||
{
|
{
|
||||||
DBG("getValue data=" << hex << data << " bytes=" << dec << bytes);
|
DBG("getValue data=" << hex << data << " bytes=" << dec << bytes);
|
||||||
if (theGetFlag || theState != Prepared) {
|
if (theGetFlag || theState != Prepared) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (! isReadOp() && ! isScanOp()) {
|
if (! isReadOp() && ! isScanOp()) {
|
||||||
setErrorCode(ErrUsage);
|
setErrorCode(NdbBlobImpl::ErrUsage);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (data == NULL && bytes != 0) {
|
if (data == NULL && bytes != 0) {
|
||||||
setErrorCode(ErrUsage);
|
setErrorCode(NdbBlobImpl::ErrUsage);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
theGetFlag = true;
|
theGetFlag = true;
|
||||||
@ -472,15 +473,15 @@ NdbBlob::setValue(const void* data, Uint32 bytes)
|
|||||||
{
|
{
|
||||||
DBG("setValue data=" << hex << data << " bytes=" << dec << bytes);
|
DBG("setValue data=" << hex << data << " bytes=" << dec << bytes);
|
||||||
if (theSetFlag || theState != Prepared) {
|
if (theSetFlag || theState != Prepared) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (! isInsertOp() && ! isUpdateOp() && ! isWriteOp()) {
|
if (! isInsertOp() && ! isUpdateOp() && ! isWriteOp()) {
|
||||||
setErrorCode(ErrUsage);
|
setErrorCode(NdbBlobImpl::ErrUsage);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (data == NULL && bytes != 0) {
|
if (data == NULL && bytes != 0) {
|
||||||
setErrorCode(ErrUsage);
|
setErrorCode(NdbBlobImpl::ErrUsage);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
theSetFlag = true;
|
theSetFlag = true;
|
||||||
@ -512,7 +513,7 @@ NdbBlob::setActiveHook(ActiveHook activeHook, void* arg)
|
|||||||
{
|
{
|
||||||
DBG("setActiveHook hook=" << hex << (void*)activeHook << " arg=" << hex << arg);
|
DBG("setActiveHook hook=" << hex << (void*)activeHook << " arg=" << hex << arg);
|
||||||
if (theState != Prepared) {
|
if (theState != Prepared) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
theActiveHook = activeHook;
|
theActiveHook = activeHook;
|
||||||
@ -531,7 +532,7 @@ NdbBlob::getNull(bool& isNull)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (theNullFlag == -1) {
|
if (theNullFlag == -1) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
isNull = theNullFlag;
|
isNull = theNullFlag;
|
||||||
@ -546,7 +547,7 @@ NdbBlob::setNull()
|
|||||||
if (theState == Prepared) {
|
if (theState == Prepared) {
|
||||||
return setValue(0, 0);
|
return setValue(0, 0);
|
||||||
}
|
}
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (theNullFlag)
|
if (theNullFlag)
|
||||||
@ -568,7 +569,7 @@ NdbBlob::getLength(Uint64& len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (theNullFlag == -1) {
|
if (theNullFlag == -1) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len = theLength;
|
len = theLength;
|
||||||
@ -580,7 +581,7 @@ NdbBlob::truncate(Uint64 length)
|
|||||||
{
|
{
|
||||||
DBG("truncate [in] length=" << length);
|
DBG("truncate [in] length=" << length);
|
||||||
if (theNullFlag == -1) {
|
if (theNullFlag == -1) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (theLength > length) {
|
if (theLength > length) {
|
||||||
@ -608,7 +609,7 @@ NdbBlob::getPos(Uint64& pos)
|
|||||||
{
|
{
|
||||||
DBG("getPos");
|
DBG("getPos");
|
||||||
if (theNullFlag == -1) {
|
if (theNullFlag == -1) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pos = thePos;
|
pos = thePos;
|
||||||
@ -620,11 +621,11 @@ NdbBlob::setPos(Uint64 pos)
|
|||||||
{
|
{
|
||||||
DBG("setPos pos=" << pos);
|
DBG("setPos pos=" << pos);
|
||||||
if (theNullFlag == -1) {
|
if (theNullFlag == -1) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (pos > theLength) {
|
if (pos > theLength) {
|
||||||
setErrorCode(ErrSeek);
|
setErrorCode(NdbBlobImpl::ErrSeek);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
thePos = pos;
|
thePos = pos;
|
||||||
@ -637,7 +638,7 @@ int
|
|||||||
NdbBlob::readData(void* data, Uint32& bytes)
|
NdbBlob::readData(void* data, Uint32& bytes)
|
||||||
{
|
{
|
||||||
if (theState != Active) {
|
if (theState != Active) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
char* buf = static_cast<char*>(data);
|
char* buf = static_cast<char*>(data);
|
||||||
@ -666,7 +667,7 @@ NdbBlob::readDataPrivate(char* buf, Uint32& bytes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (len > 0 && thePartSize == 0) {
|
if (len > 0 && thePartSize == 0) {
|
||||||
setErrorCode(ErrSeek);
|
setErrorCode(NdbBlobImpl::ErrSeek);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
@ -731,7 +732,7 @@ int
|
|||||||
NdbBlob::writeData(const void* data, Uint32 bytes)
|
NdbBlob::writeData(const void* data, Uint32 bytes)
|
||||||
{
|
{
|
||||||
if (theState != Active) {
|
if (theState != Active) {
|
||||||
setErrorCode(ErrState);
|
setErrorCode(NdbBlobImpl::ErrState);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
const char* buf = static_cast<const char*>(data);
|
const char* buf = static_cast<const char*>(data);
|
||||||
@ -764,7 +765,7 @@ NdbBlob::writeDataPrivate(const char* buf, Uint32 bytes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (len > 0 && thePartSize == 0) {
|
if (len > 0 && thePartSize == 0) {
|
||||||
setErrorCode(ErrSeek);
|
setErrorCode(NdbBlobImpl::ErrSeek);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
@ -1081,7 +1082,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
|
|||||||
theFillChar = 0x20;
|
theFillChar = 0x20;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
setErrorCode(ErrUsage);
|
setErrorCode(NdbBlobImpl::ErrUsage);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// sizes
|
// sizes
|
||||||
@ -1099,7 +1100,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
|
|||||||
(bc = bt->getColumn("DATA")) == NULL ||
|
(bc = bt->getColumn("DATA")) == NULL ||
|
||||||
bc->getType() != partType ||
|
bc->getType() != partType ||
|
||||||
bc->getLength() != (int)thePartSize) {
|
bc->getLength() != (int)thePartSize) {
|
||||||
setErrorCode(ErrTable);
|
setErrorCode(NdbBlobImpl::ErrTable);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
theBlobTable = &NdbTableImpl::getImpl(*bt);
|
theBlobTable = &NdbTableImpl::getImpl(*bt);
|
||||||
@ -1120,7 +1121,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
|
|||||||
Uint32* data = (Uint32*)theKeyBuf.data;
|
Uint32* data = (Uint32*)theKeyBuf.data;
|
||||||
unsigned size = theTable->m_sizeOfKeysInWords;
|
unsigned size = theTable->m_sizeOfKeysInWords;
|
||||||
if (theNdbOp->getKeyFromTCREQ(data, size) == -1) {
|
if (theNdbOp->getKeyFromTCREQ(data, size) == -1) {
|
||||||
setErrorCode(ErrUsage);
|
setErrorCode(NdbBlobImpl::ErrUsage);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1129,7 +1130,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
|
|||||||
Uint32* data = (Uint32*)theAccessKeyBuf.data;
|
Uint32* data = (Uint32*)theAccessKeyBuf.data;
|
||||||
unsigned size = theAccessTable->m_sizeOfKeysInWords;
|
unsigned size = theAccessTable->m_sizeOfKeysInWords;
|
||||||
if (theNdbOp->getKeyFromTCREQ(data, size) == -1) {
|
if (theNdbOp->getKeyFromTCREQ(data, size) == -1) {
|
||||||
setErrorCode(ErrUsage);
|
setErrorCode(NdbBlobImpl::ErrUsage);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1158,7 +1159,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
|
|||||||
supportedOp = true;
|
supportedOp = true;
|
||||||
}
|
}
|
||||||
if (! supportedOp) {
|
if (! supportedOp) {
|
||||||
setErrorCode(ErrUsage);
|
setErrorCode(NdbBlobImpl::ErrUsage);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
setState(Prepared);
|
setState(Prepared);
|
||||||
@ -1204,7 +1205,7 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch)
|
|||||||
tOp->updateTuple() == -1 ||
|
tOp->updateTuple() == -1 ||
|
||||||
setTableKeyValue(tOp) == -1 ||
|
setTableKeyValue(tOp) == -1 ||
|
||||||
setHeadInlineValue(tOp) == -1) {
|
setHeadInlineValue(tOp) == -1) {
|
||||||
setErrorCode(ErrAbort);
|
setErrorCode(NdbBlobImpl::ErrAbort);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
DBG("add op to update head+inline");
|
DBG("add op to update head+inline");
|
||||||
@ -1434,7 +1435,7 @@ NdbBlob::postExecute(ExecType anExecType)
|
|||||||
tOp->updateTuple() == -1 ||
|
tOp->updateTuple() == -1 ||
|
||||||
setTableKeyValue(tOp) == -1 ||
|
setTableKeyValue(tOp) == -1 ||
|
||||||
setHeadInlineValue(tOp) == -1) {
|
setHeadInlineValue(tOp) == -1) {
|
||||||
setErrorCode(ErrAbort);
|
setErrorCode(NdbBlobImpl::ErrAbort);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tOp->m_abortOption = AbortOnError;
|
tOp->m_abortOption = AbortOnError;
|
||||||
@ -1464,7 +1465,7 @@ NdbBlob::preCommit()
|
|||||||
tOp->updateTuple() == -1 ||
|
tOp->updateTuple() == -1 ||
|
||||||
setTableKeyValue(tOp) == -1 ||
|
setTableKeyValue(tOp) == -1 ||
|
||||||
setHeadInlineValue(tOp) == -1) {
|
setHeadInlineValue(tOp) == -1) {
|
||||||
setErrorCode(ErrAbort);
|
setErrorCode(NdbBlobImpl::ErrAbort);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tOp->m_abortOption = AbortOnError;
|
tOp->m_abortOption = AbortOnError;
|
||||||
@ -1489,7 +1490,7 @@ NdbBlob::atNextResult()
|
|||||||
{ Uint32* data = (Uint32*)theKeyBuf.data;
|
{ Uint32* data = (Uint32*)theKeyBuf.data;
|
||||||
unsigned size = theTable->m_sizeOfKeysInWords;
|
unsigned size = theTable->m_sizeOfKeysInWords;
|
||||||
if (((NdbScanOperation*)theNdbOp)->getKeyFromKEYINFO20(data, size) == -1) {
|
if (((NdbScanOperation*)theNdbOp)->getKeyFromKEYINFO20(data, size) == -1) {
|
||||||
setErrorCode(ErrUsage);
|
setErrorCode(NdbBlobImpl::ErrUsage);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1545,7 +1546,7 @@ NdbBlob::setErrorCode(NdbOperation* anOp, bool invalidFlag)
|
|||||||
else if ((code = theNdb->theError.code) != 0)
|
else if ((code = theNdb->theError.code) != 0)
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
code = ErrUnknown;
|
code = NdbBlobImpl::ErrUnknown;
|
||||||
setErrorCode(code, invalidFlag);
|
setErrorCode(code, invalidFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1558,7 +1559,7 @@ NdbBlob::setErrorCode(NdbConnection* aCon, bool invalidFlag)
|
|||||||
else if ((code = theNdb->theError.code) != 0)
|
else if ((code = theNdb->theError.code) != 0)
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
code = ErrUnknown;
|
code = NdbBlobImpl::ErrUnknown;
|
||||||
setErrorCode(code, invalidFlag);
|
setErrorCode(code, invalidFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
39
ndb/src/ndbapi/NdbBlobImpl.hpp
Normal file
39
ndb/src/ndbapi/NdbBlobImpl.hpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/* 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 NdbBlobImpl_H
|
||||||
|
#define NdbBlobImpl_H
|
||||||
|
|
||||||
|
class NdbBlobImpl {
|
||||||
|
public:
|
||||||
|
STATIC_CONST( BlobTableNameSize = 40 );
|
||||||
|
// "Invalid blob attributes or invalid blob parts table"
|
||||||
|
STATIC_CONST( ErrTable = 4263 );
|
||||||
|
// "Invalid usage of blob attribute"
|
||||||
|
STATIC_CONST( ErrUsage = 4264 );
|
||||||
|
// "Method is not valid in current blob state"
|
||||||
|
STATIC_CONST( ErrState = 4265 );
|
||||||
|
// "Invalid blob seek position"
|
||||||
|
STATIC_CONST( ErrSeek = 4266 );
|
||||||
|
// "Corrupted blob value"
|
||||||
|
STATIC_CONST( ErrCorrupt = 4267 );
|
||||||
|
// "Error in blob head update forced rollback of transaction"
|
||||||
|
STATIC_CONST( ErrAbort = 4268 );
|
||||||
|
// "Unknown blob error"
|
||||||
|
STATIC_CONST( ErrUnknown = 4269 );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -34,7 +34,8 @@
|
|||||||
#include <AttributeList.hpp>
|
#include <AttributeList.hpp>
|
||||||
#include <NdbEventOperation.hpp>
|
#include <NdbEventOperation.hpp>
|
||||||
#include "NdbEventOperationImpl.hpp"
|
#include "NdbEventOperationImpl.hpp"
|
||||||
#include "NdbBlob.hpp"
|
#include <NdbBlob.hpp>
|
||||||
|
#include "NdbBlobImpl.hpp"
|
||||||
#include <AttributeHeader.hpp>
|
#include <AttributeHeader.hpp>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
|
|
||||||
@ -1385,7 +1386,7 @@ NdbDictionaryImpl::addBlobTables(NdbTableImpl &t)
|
|||||||
if (! c.getBlobType() || c.getPartSize() == 0)
|
if (! c.getBlobType() || c.getPartSize() == 0)
|
||||||
continue;
|
continue;
|
||||||
n--;
|
n--;
|
||||||
char btname[NdbBlob::BlobTableNameSize];
|
char btname[NdbBlobImpl::BlobTableNameSize];
|
||||||
NdbBlob::getBlobTableName(btname, &t, &c);
|
NdbBlob::getBlobTableName(btname, &t, &c);
|
||||||
// Save BLOB table handle
|
// Save BLOB table handle
|
||||||
NdbTableImpl * cachedBlobTable = getTable(btname);
|
NdbTableImpl * cachedBlobTable = getTable(btname);
|
||||||
@ -1793,7 +1794,7 @@ NdbDictionaryImpl::dropBlobTables(NdbTableImpl & t)
|
|||||||
NdbColumnImpl & c = *t.m_columns[i];
|
NdbColumnImpl & c = *t.m_columns[i];
|
||||||
if (! c.getBlobType() || c.getPartSize() == 0)
|
if (! c.getBlobType() || c.getPartSize() == 0)
|
||||||
continue;
|
continue;
|
||||||
char btname[NdbBlob::BlobTableNameSize];
|
char btname[NdbBlobImpl::BlobTableNameSize];
|
||||||
NdbBlob::getBlobTableName(btname, &t, &c);
|
NdbBlob::getBlobTableName(btname, &t, &c);
|
||||||
if (dropTable(btname) != 0) {
|
if (dropTable(btname) != 0) {
|
||||||
if (m_error.code != 709){
|
if (m_error.code != 709){
|
||||||
|
@ -15,21 +15,11 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************************
|
#include <ndb_global.h>
|
||||||
Name: NdbOperationInt.C
|
#include <NdbOperation.hpp>
|
||||||
Include:
|
|
||||||
Link:
|
|
||||||
Author: UABRONM Mikael Ronstr<74>m UAB/M/MT
|
|
||||||
Date: 991029
|
|
||||||
Version: 0.1
|
|
||||||
Description: Interpreted operations in NDB API
|
|
||||||
Documentation:
|
|
||||||
Adjust: 991029 UABRONM First version.
|
|
||||||
************************************************************************************************/
|
|
||||||
#include "NdbOperation.hpp"
|
|
||||||
#include "NdbApiSignal.hpp"
|
#include "NdbApiSignal.hpp"
|
||||||
#include "NdbConnection.hpp"
|
#include <NdbConnection.hpp>
|
||||||
#include "Ndb.hpp"
|
#include <Ndb.hpp>
|
||||||
#include "NdbRecAttr.hpp"
|
#include "NdbRecAttr.hpp"
|
||||||
#include "NdbUtil.hpp"
|
#include "NdbUtil.hpp"
|
||||||
#include "Interpreter.hpp"
|
#include "Interpreter.hpp"
|
||||||
|
@ -174,7 +174,7 @@ Ndb_cluster_connection_impl::get_next_node(Ndb_cluster_connection_node_iter &ite
|
|||||||
return node.id;
|
return node.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint32
|
int
|
||||||
Ndb_cluster_connection::no_db_nodes()
|
Ndb_cluster_connection::no_db_nodes()
|
||||||
{
|
{
|
||||||
return m_impl.m_all_nodes.size();
|
return m_impl.m_all_nodes.size();
|
||||||
@ -219,16 +219,8 @@ Ndb_cluster_connection::wait_until_ready(int timeout,
|
|||||||
else if (foundAliveNode > 0)
|
else if (foundAliveNode > 0)
|
||||||
{
|
{
|
||||||
noChecksSinceFirstAliveFound++;
|
noChecksSinceFirstAliveFound++;
|
||||||
if (timeout_after_first_alive >= 0)
|
if (noChecksSinceFirstAliveFound > timeout_after_first_alive)
|
||||||
{
|
DBUG_RETURN(1);
|
||||||
if (noChecksSinceFirstAliveFound > timeout_after_first_alive)
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
else // timeout_after_first_alive < 0
|
|
||||||
{
|
|
||||||
if (noChecksSinceFirstAliveFound > -timeout_after_first_alive)
|
|
||||||
DBUG_RETURN(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (secondsCounter >= timeout)
|
else if (secondsCounter >= timeout)
|
||||||
{ // no alive nodes and timed out
|
{ // no alive nodes and timed out
|
||||||
|
@ -23,13 +23,14 @@
|
|||||||
#include <NdbOut.hpp>
|
#include <NdbOut.hpp>
|
||||||
#include <NdbTest.hpp>
|
#include <NdbTest.hpp>
|
||||||
#include <NdbTick.h>
|
#include <NdbTick.h>
|
||||||
|
#include <ndb/src/ndbapi/NdbBlobImpl.hpp>
|
||||||
|
|
||||||
struct Bcol {
|
struct Bcol {
|
||||||
bool m_nullable;
|
bool m_nullable;
|
||||||
unsigned m_inline;
|
unsigned m_inline;
|
||||||
unsigned m_partsize;
|
unsigned m_partsize;
|
||||||
unsigned m_stripe;
|
unsigned m_stripe;
|
||||||
char m_btname[NdbBlob::BlobTableNameSize];
|
char m_btname[NdbBlobImpl::BlobTableNameSize];
|
||||||
Bcol(bool a, unsigned b, unsigned c, unsigned d) :
|
Bcol(bool a, unsigned b, unsigned c, unsigned d) :
|
||||||
m_nullable(a),
|
m_nullable(a),
|
||||||
m_inline(b),
|
m_inline(b),
|
||||||
|
Reference in New Issue
Block a user