Fixed prototype of get_error_message to use String to return error message

WL#1747 and #1746 allow user to decide if ordered index should be created or not
parent 1f1b01e0
This diff is collapsed.
This diff is collapsed.
...@@ -37,8 +37,10 @@ class NdbResultSet; // Forward declaration ...@@ -37,8 +37,10 @@ class NdbResultSet; // Forward declaration
typedef enum ndb_index_type { typedef enum ndb_index_type {
UNDEFINED_INDEX = 0, UNDEFINED_INDEX = 0,
PRIMARY_KEY_INDEX = 1, PRIMARY_KEY_INDEX = 1,
UNIQUE_INDEX = 2, PRIMARY_KEY_ORDERED_INDEX = 2,
ORDERED_INDEX = 3 UNIQUE_INDEX = 3,
UNIQUE_ORDERED_INDEX = 4,
ORDERED_INDEX = 5
} NDB_INDEX_TYPE; } NDB_INDEX_TYPE;
...@@ -78,10 +80,10 @@ class ha_ndbcluster: public handler ...@@ -78,10 +80,10 @@ class ha_ndbcluster: public handler
void position(const byte *record); void position(const byte *record);
int read_range_first(const key_range *start_key, int read_range_first(const key_range *start_key,
const key_range *end_key, const key_range *end_key,
bool sorted); bool eq_range, bool sorted);
int read_range_next(bool eq_range); int read_range_next();
const char* get_error_message(int *error, bool *temporary); bool get_error_message(int error, String *buf);
void info(uint); void info(uint);
int extra(enum ha_extra_function operation); int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size); int extra_opt(enum ha_extra_function operation, ulong cache_size);
...@@ -117,6 +119,8 @@ class ha_ndbcluster: public handler ...@@ -117,6 +119,8 @@ class ha_ndbcluster: public handler
const char* index_type(uint key_number) { const char* index_type(uint key_number) {
switch (get_index_type(key_number)) { switch (get_index_type(key_number)) {
case ORDERED_INDEX: case ORDERED_INDEX:
case UNIQUE_ORDERED_INDEX:
case PRIMARY_KEY_ORDERED_INDEX:
return "BTREE"; return "BTREE";
case UNIQUE_INDEX: case UNIQUE_INDEX:
case PRIMARY_KEY_INDEX: case PRIMARY_KEY_INDEX:
...@@ -141,6 +145,7 @@ class ha_ndbcluster: public handler ...@@ -141,6 +145,7 @@ class ha_ndbcluster: public handler
int create_ordered_index(const char *name, KEY *key_info); int create_ordered_index(const char *name, KEY *key_info);
int create_unique_index(const char *name, KEY *key_info); int create_unique_index(const char *name, KEY *key_info);
int initialize_autoincrement(const void* table); int initialize_autoincrement(const void* table);
int build_index_list();
int get_metadata(const char* path); int get_metadata(const char* path);
void release_metadata(); void release_metadata();
const char* get_index_name(uint idx_no) const; const char* get_index_name(uint idx_no) const;
......
...@@ -1123,14 +1123,15 @@ void handler::print_error(int error, myf errflag) ...@@ -1123,14 +1123,15 @@ void handler::print_error(int error, myf errflag)
/* The error was "unknown" to this function. /* The error was "unknown" to this function.
Ask handler if it has got a message for this error */ Ask handler if it has got a message for this error */
bool temporary= FALSE; bool temporary= FALSE;
const char* msg= get_error_message(&error, &temporary); String str;
if (msg) temporary= get_error_message(error, &str);
if (!str.is_empty())
{ {
const char* engine= ha_get_storage_engine(table->db_type); const char* engine= ha_get_storage_engine(table->db_type);
if (temporary) if (temporary)
my_error(ER_GET_TEMPORARY_ERRMSG,MYF(0),error,msg,engine); my_error(ER_GET_TEMPORARY_ERRMSG,MYF(0),error,str.ptr(),engine);
else else
my_error(ER_GET_ERRMSG,MYF(0),error,msg,engine); my_error(ER_GET_ERRMSG,MYF(0),error,str.ptr(),engine);
} }
else else
my_error(ER_GET_ERRNO,errflag,error); my_error(ER_GET_ERRNO,errflag,error);
...@@ -1146,15 +1147,15 @@ void handler::print_error(int error, myf errflag) ...@@ -1146,15 +1147,15 @@ void handler::print_error(int error, myf errflag)
Return an error message specific to this handler Return an error message specific to this handler
SYNOPSIS SYNOPSIS
error [in/out] error code previously returned by handler error error code previously returned by handler
temporary [out] temporary error, transaction should be retried if true buf Pointer to String where to add error message
The returned pointer to error message should not be freed. Returns true if this is a temporary error
*/ */
const char* handler::get_error_message(int *error, bool *temporary) bool handler::get_error_message(int error, String* buf)
{ {
return NULL; return false;
} }
......
...@@ -288,7 +288,7 @@ public: ...@@ -288,7 +288,7 @@ public:
void update_timestamp(byte *record); void update_timestamp(byte *record);
void update_auto_increment(); void update_auto_increment();
virtual void print_error(int error, myf errflag); virtual void print_error(int error, myf errflag);
virtual const char* get_error_message(int *error, bool *temporary); virtual bool get_error_message(int error, String *buf);
uint get_dup_key(int error); uint get_dup_key(int error);
void change_table_ptr(TABLE *table_arg) { table=table_arg; } void change_table_ptr(TABLE *table_arg) { table=table_arg; }
virtual double scan_time() virtual double scan_time()
......
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