Commit bec9de67 authored by unknown's avatar unknown
Browse files

added classification "schema object already exists"


ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  added classification "schema object already exists"
  retrieved error from sub_stop_ref correctly
ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  added classification "schema object already exists"
  + added error code for failed prepare drop subscribe event
parent 5ebc648e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@
 */

#include <NdbApi.hpp>
#include <ndberror.h>

// Used for cout
#include <stdio.h>
@@ -251,7 +250,8 @@ int myCreateEvent(Ndb* myNdb,
  // Add event to database
  if (myDict->createEvent(myEvent) == 0)
    myEvent.print();
  else if (myDict->getNdbError().code == NDBERR_EVENT_NAME_ALEADY_EXISTS) {
  else if (myDict->getNdbError().classification ==
	   NdbError::SchemaObjectExists) {
    printf("Event creation failed, event exists\n");
    printf("dropping Event...\n");
    if (myDict->dropEvent(eventName)) APIERROR(myDict->getNdbError());
+1 −1
Original line number Diff line number Diff line
@@ -366,7 +366,7 @@ struct CreateEvntRef {
    SeizeError = 703,
    TooManyEvents = 4707,
    EventNameTooLong = 4708,
    EventNameExists = NDBERR_EVENT_NAME_ALEADY_EXISTS,
    EventNameExists = 746,
    EventNotFound = 4731,
    AttributeNotStored = 4245,
    AttributeNullable = 4246,
+6 −1
Original line number Diff line number Diff line
@@ -168,7 +168,12 @@ struct NdbError {
    /**
     * Node shutdown
     */
    NodeShutdown = ndberror_cl_node_shutdown
    NodeShutdown = ndberror_cl_node_shutdown,

    /**
     * Schema object already exists
     */
    SchemaObjectExists = ndberror_cl_schema_object_already_exists
  };
  
  /**
+2 −3
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@
#ifndef NDBERROR_H
#define NDBERROR_H

#define NDBERR_EVENT_NAME_ALEADY_EXISTS 746

#ifdef __cplusplus
extern "C" {
#endif
@@ -49,7 +47,8 @@ typedef enum
  ndberror_cl_function_not_implemented = 13,
  ndberror_cl_unknown_error_code = 14,
  ndberror_cl_node_shutdown = 15,
  ndberror_cl_configuration = 16  
  ndberror_cl_configuration = 16,
  ndberror_cl_schema_object_already_exists = 17 
} ndberror_classification_enum;


+7 −2
Original line number Diff line number Diff line
@@ -2602,6 +2602,7 @@ void
NdbDictInterface::execSUB_STOP_CONF(NdbApiSignal * signal,
				      LinearSectionPtr ptr[3])
{
  DBUG_ENTER("NdbDictInterface::execSUB_STOP_REF");
#ifdef EVENT_DEBUG
  ndbout << "Got GSN_SUB_STOP_CONF" << endl;
#endif
@@ -2618,17 +2619,21 @@ void
NdbDictInterface::execSUB_STOP_REF(NdbApiSignal * signal,
				     LinearSectionPtr ptr[3])
{
  DBUG_ENTER("NdbDictInterface::execSUB_STOP_REF");
#ifdef EVENT_DEBUG
  ndbout << "Got GSN_SUB_STOP_REF" << endl;
#endif
  //  SubRemoveConf * const sumaRemoveRef = CAST_CONSTPTR(SubRemoveRef, signal->getDataPtr());
  const SubRemoveRef * const sumaRemoveRef=
    CAST_CONSTPTR(SubRemoveRef, signal->getDataPtr());

  //  Uint32 subscriptionId = sumaRemoveRef->subscriptionId;
  //  Uint32 subscriptionKey = sumaRemoveRef->subscriptionKey;
  //  Uint32 senderData = sumaRemoveRef->senderData;

  m_error.code = 1;
  m_error.code= sumaRemoveRef->errorCode;
  m_waiter.signal(NO_WAIT);

  DBUG_VOID_RETURN;
}

void
Loading