summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorunknown <tomas@mc05.(none)>2004-05-05 14:19:47 +0200
committerunknown <tomas@mc05.(none)>2004-05-05 14:19:47 +0200
commit5c1069614cfd74ff56ff1393224cbec6d4dc773a (patch)
tree7d9d66339b1e2aeff2d720886c3346ed8f615f9a /extra
parentd90b362f1a0d4db41c5eecf90c3d1a100ab56b5d (diff)
downloadmariadb-git-5c1069614cfd74ff56ff1393224cbec6d4dc773a.tar.gz
extended perror to enable printing of storage engine specific errors for ndb
Diffstat (limited to 'extra')
-rw-r--r--extra/Makefile.am2
-rw-r--r--extra/perror.c24
2 files changed, 24 insertions, 2 deletions
diff --git a/extra/Makefile.am b/extra/Makefile.am
index 0276355ef65..df29a3a6ab7 100644
--- a/extra/Makefile.am
+++ b/extra/Makefile.am
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include @ndbcluster_includes@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
diff --git a/extra/perror.c b/extra/perror.c
index d05fa2492de..743aa09ed2e 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -23,15 +23,27 @@
#include <m_string.h>
#include <errno.h>
#include <my_getopt.h>
+#ifdef HAVE_NDBCLUSTER_DB
+#include "../ndb/src/ndbapi/ndberror.c"
+#endif
static my_bool verbose, print_all_codes;
+#ifdef HAVE_NDBCLUSTER_DB
+static my_bool ndb_code;
+static char ndb_string[1024];
+#endif
+
static struct my_option my_long_options[] =
{
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
+#ifdef HAVE_NDBCLUSTER_DB
+ {"ndb", 0, "Ndbcluster storage engine specific error codes.", (gptr*) &ndb_code,
+ (gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+#endif
#ifdef HAVE_SYS_ERRLIST
{"all", 'a', "Print all the error messages and the number.",
(gptr*) &print_all_codes, (gptr*) &print_all_codes, 0, GET_BOOL, NO_ARG,
@@ -199,7 +211,17 @@ int main(int argc,char *argv[])
{
found=0;
code=atoi(*argv);
- msg = strerror(code);
+#ifdef HAVE_NDBCLUSTER_DB
+ if (ndb_code)
+ {
+ if (ndb_error_string(code, ndb_string, 1024) < 0)
+ msg= 0;
+ else
+ msg= ndb_string;
+ }
+ else
+#endif
+ msg = strerror(code);
if (msg)
{
found=1;