~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/ha_commands.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
 
55
55
/**
56
56
  Register Cursor error messages for use with my_error().
57
 
 
58
 
  @retval
59
 
    0           OK
60
 
  @retval
61
 
    !=0         Error
62
 
*/
63
 
 
64
 
int ha_init_errors(void)
65
 
{
66
 
#define SETMSG(nr, msg) errmsgs[(nr) - HA_ERR_FIRST]= (msg)
67
 
  const char    **errmsgs;
68
 
 
69
 
  /* Allocate a pointer array for the error message strings. */
70
 
  /* Zerofill it to avoid uninitialized gaps. */
71
 
  if (! (errmsgs= (const char**) malloc(HA_ERR_ERRORS * sizeof(char*))))
72
 
    return 1;
73
 
  memset(errmsgs, 0, HA_ERR_ERRORS * sizeof(char *));
74
 
 
75
 
  /* Set the dedicated error messages. */
76
 
  SETMSG(HA_ERR_KEY_NOT_FOUND,          ER(ER_KEY_NOT_FOUND));
77
 
  SETMSG(HA_ERR_FOUND_DUPP_KEY,         ER(ER_DUP_KEY));
78
 
  SETMSG(HA_ERR_RECORD_CHANGED,         "Update wich is recoverable");
79
 
  SETMSG(HA_ERR_WRONG_INDEX,            "Wrong index given to function");
80
 
  SETMSG(HA_ERR_CRASHED,                ER(ER_NOT_KEYFILE));
81
 
  SETMSG(HA_ERR_WRONG_IN_RECORD,        ER(ER_CRASHED_ON_USAGE));
82
 
  SETMSG(HA_ERR_OUT_OF_MEM,             "Table Cursor out of memory");
83
 
  SETMSG(HA_ERR_NOT_A_TABLE,            "Incorrect file format '%.64s'");
84
 
  SETMSG(HA_ERR_WRONG_COMMAND,          "Command not supported");
85
 
  SETMSG(HA_ERR_OLD_FILE,               ER(ER_OLD_KEYFILE));
86
 
  SETMSG(HA_ERR_NO_ACTIVE_RECORD,       "No record read in update");
87
 
  SETMSG(HA_ERR_RECORD_DELETED,         "Intern record deleted");
88
 
  SETMSG(HA_ERR_RECORD_FILE_FULL,       ER(ER_RECORD_FILE_FULL));
89
 
  SETMSG(HA_ERR_INDEX_FILE_FULL,        "No more room in index file '%.64s'");
90
 
  SETMSG(HA_ERR_END_OF_FILE,            "End in next/prev/first/last");
91
 
  SETMSG(HA_ERR_UNSUPPORTED,            ER(ER_ILLEGAL_HA));
92
 
  SETMSG(HA_ERR_TO_BIG_ROW,             "Too big row");
93
 
  SETMSG(HA_WRONG_CREATE_OPTION,        "Wrong create option");
94
 
  SETMSG(HA_ERR_FOUND_DUPP_UNIQUE,      ER(ER_DUP_UNIQUE));
95
 
  SETMSG(HA_ERR_UNKNOWN_CHARSET,        "Can't open charset");
96
 
  SETMSG(HA_ERR_WRONG_MRG_TABLE_DEF,    ER(ER_WRONG_MRG_TABLE));
97
 
  SETMSG(HA_ERR_CRASHED_ON_REPAIR,      ER(ER_CRASHED_ON_REPAIR));
98
 
  SETMSG(HA_ERR_CRASHED_ON_USAGE,       ER(ER_CRASHED_ON_USAGE));
99
 
  SETMSG(HA_ERR_LOCK_WAIT_TIMEOUT,      ER(ER_LOCK_WAIT_TIMEOUT));
100
 
  SETMSG(HA_ERR_LOCK_TABLE_FULL,        ER(ER_LOCK_TABLE_FULL));
101
 
  SETMSG(HA_ERR_READ_ONLY_TRANSACTION,  ER(ER_READ_ONLY_TRANSACTION));
102
 
  SETMSG(HA_ERR_LOCK_DEADLOCK,          ER(ER_LOCK_DEADLOCK));
103
 
  SETMSG(HA_ERR_CANNOT_ADD_FOREIGN,     ER(ER_CANNOT_ADD_FOREIGN));
104
 
  SETMSG(HA_ERR_NO_REFERENCED_ROW,      ER(ER_NO_REFERENCED_ROW_2));
105
 
  SETMSG(HA_ERR_ROW_IS_REFERENCED,      ER(ER_ROW_IS_REFERENCED_2));
106
 
  SETMSG(HA_ERR_NO_SAVEPOINT,           "No savepoint with that name");
107
 
  SETMSG(HA_ERR_NON_UNIQUE_BLOCK_SIZE,  "Non unique key block size");
108
 
  SETMSG(HA_ERR_NO_SUCH_TABLE,          "No such table: '%.64s'");
109
 
  SETMSG(HA_ERR_TABLE_EXIST,            ER(ER_TABLE_EXISTS_ERROR));
110
 
  SETMSG(HA_ERR_NO_CONNECTION,          "Could not connect to storage engine");
111
 
  SETMSG(HA_ERR_TABLE_DEF_CHANGED,      ER(ER_TABLE_DEF_CHANGED));
112
 
  SETMSG(HA_ERR_FOREIGN_DUPLICATE_KEY,  "FK constraint would lead to duplicate key");
113
 
  SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE,    ER(ER_TABLE_NEEDS_UPGRADE));
114
 
  SETMSG(HA_ERR_TABLE_READONLY,         ER(ER_OPEN_AS_READONLY));
115
 
  SETMSG(HA_ERR_AUTOINC_READ_FAILED,    ER(ER_AUTOINC_READ_FAILED));
116
 
  SETMSG(HA_ERR_AUTOINC_ERANGE,         ER(ER_WARN_DATA_OUT_OF_RANGE));
117
 
 
118
 
  /* Register the error messages for use with my_error(). */
119
 
  return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
120
 
}
121
 
 
122
 
 
123
 
/**
124
 
  Unregister Cursor error messages.
125
 
 
126
 
  @retval
127
 
    0           OK
128
 
  @retval
129
 
    !=0         Error
130
 
*/
131
 
static int ha_finish_errors(void)
132
 
{
133
 
  const char    **errmsgs;
134
 
 
135
 
  /* Allocate a pointer array for the error message strings. */
136
 
  if (! (errmsgs= my_error_unregister(HA_ERR_FIRST, HA_ERR_LAST)))
137
 
    return 1;
138
 
  free((unsigned char*) errmsgs);
139
 
  return 0;
140
 
}
141
 
 
142
 
int ha_end()
143
 
{
144
 
  int error= 0;
145
 
 
146
 
  /*
147
 
    This should be eventualy based  on the graceful shutdown flag.
148
 
    So if flag is equal to HA_PANIC_CLOSE, the deallocate
149
 
    the errors.
150
 
  */
151
 
  if (ha_finish_errors())
152
 
    error= 1;
153
 
 
154
 
  return error;
 
57
*/
 
58
 
 
59
void ha_init_errors(void)
 
60
{
 
61
  // Set the dedicated error messages.
 
62
  add_error_message(HA_ERR_KEY_NOT_FOUND,          ER(ER_KEY_NOT_FOUND));
 
63
  add_error_message(HA_ERR_FOUND_DUPP_KEY,         ER(ER_DUP_KEY));
 
64
  add_error_message(HA_ERR_RECORD_CHANGED,         "Update wich is recoverable");
 
65
  add_error_message(HA_ERR_WRONG_INDEX,            "Wrong index given to function");
 
66
  add_error_message(HA_ERR_CRASHED,                ER(ER_NOT_KEYFILE));
 
67
  add_error_message(HA_ERR_WRONG_IN_RECORD,        ER(ER_CRASHED_ON_USAGE));
 
68
  add_error_message(HA_ERR_OUT_OF_MEM,             "Table Cursor out of memory");
 
69
  add_error_message(HA_ERR_NOT_A_TABLE,            "Incorrect file format '%.64s'");
 
70
  add_error_message(HA_ERR_WRONG_COMMAND,          "Command not supported");
 
71
  add_error_message(HA_ERR_OLD_FILE,               ER(ER_OLD_KEYFILE));
 
72
  add_error_message(HA_ERR_NO_ACTIVE_RECORD,       "No record read in update");
 
73
  add_error_message(HA_ERR_RECORD_DELETED,         "Intern record deleted");
 
74
  add_error_message(HA_ERR_RECORD_FILE_FULL,       ER(ER_RECORD_FILE_FULL));
 
75
  add_error_message(HA_ERR_INDEX_FILE_FULL,        "No more room in index file '%.64s'");
 
76
  add_error_message(HA_ERR_END_OF_FILE,            "End in next/prev/first/last");
 
77
  add_error_message(HA_ERR_UNSUPPORTED,            ER(ER_ILLEGAL_HA));
 
78
  add_error_message(HA_ERR_TO_BIG_ROW,             "Too big row");
 
79
  add_error_message(HA_WRONG_CREATE_OPTION,        "Wrong create option");
 
80
  add_error_message(HA_ERR_FOUND_DUPP_UNIQUE,      ER(ER_DUP_UNIQUE));
 
81
  add_error_message(HA_ERR_UNKNOWN_CHARSET,        "Can't open charset");
 
82
  add_error_message(HA_ERR_WRONG_MRG_TABLE_DEF,    ER(ER_WRONG_MRG_TABLE));
 
83
  add_error_message(HA_ERR_CRASHED_ON_REPAIR,      ER(ER_CRASHED_ON_REPAIR));
 
84
  add_error_message(HA_ERR_CRASHED_ON_USAGE,       ER(ER_CRASHED_ON_USAGE));
 
85
  add_error_message(HA_ERR_LOCK_WAIT_TIMEOUT,      ER(ER_LOCK_WAIT_TIMEOUT));
 
86
  add_error_message(HA_ERR_LOCK_TABLE_FULL,        ER(ER_LOCK_TABLE_FULL));
 
87
  add_error_message(HA_ERR_READ_ONLY_TRANSACTION,  ER(ER_READ_ONLY_TRANSACTION));
 
88
  add_error_message(HA_ERR_LOCK_DEADLOCK,          ER(ER_LOCK_DEADLOCK));
 
89
  add_error_message(HA_ERR_CANNOT_ADD_FOREIGN,     ER(ER_CANNOT_ADD_FOREIGN));
 
90
  add_error_message(HA_ERR_NO_REFERENCED_ROW,      ER(ER_NO_REFERENCED_ROW_2));
 
91
  add_error_message(HA_ERR_ROW_IS_REFERENCED,      ER(ER_ROW_IS_REFERENCED_2));
 
92
  add_error_message(HA_ERR_NO_SAVEPOINT,           "No savepoint with that name");
 
93
  add_error_message(HA_ERR_NON_UNIQUE_BLOCK_SIZE,  "Non unique key block size");
 
94
  add_error_message(HA_ERR_NO_SUCH_TABLE,          "No such table: '%.64s'");
 
95
  add_error_message(HA_ERR_TABLE_EXIST,            ER(ER_TABLE_EXISTS_ERROR));
 
96
  add_error_message(HA_ERR_NO_CONNECTION,          "Could not connect to storage engine");
 
97
  add_error_message(HA_ERR_TABLE_DEF_CHANGED,      ER(ER_TABLE_DEF_CHANGED));
 
98
  add_error_message(HA_ERR_FOREIGN_DUPLICATE_KEY,  "FK constraint would lead to duplicate key");
 
99
  add_error_message(HA_ERR_TABLE_NEEDS_UPGRADE,    ER(ER_TABLE_NEEDS_UPGRADE));
 
100
  add_error_message(HA_ERR_TABLE_READONLY,         ER(ER_OPEN_AS_READONLY));
 
101
  add_error_message(HA_ERR_AUTOINC_READ_FAILED,    ER(ER_AUTOINC_READ_FAILED));
 
102
  add_error_message(HA_ERR_AUTOINC_ERANGE,         ER(ER_WARN_DATA_OUT_OF_RANGE));
155
103
}
156
104
 
157
105
} /* namespace drizzled */