~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/derror.cc

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000-2005 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
 
 
17
/**
 
18
  @file
 
19
 
 
20
  @brief
 
21
  Read language depeneded messagefile
 
22
*/
 
23
 
 
24
#include <drizzled/server_includes.h>
 
25
#include <mysys/mysys_err.h>
 
26
#include <drizzled/drizzled_error_messages.h>
 
27
 
 
28
static void init_myfunc_errs(void);
 
29
 
 
30
 
 
31
 
 
32
/**
 
33
  Read messages from errorfile.
 
34
 
 
35
  This function can be called multiple times to reload the messages.
 
36
  If it fails to load the messages, it will fail softly by initializing
 
37
  the errmesg pointer to an array of empty strings or by keeping the
 
38
  old array if it exists.
 
39
 
 
40
  @retval
 
41
    FALSE       OK
 
42
  @retval
 
43
    TRUE        Error
 
44
*/
 
45
 
 
46
bool init_errmessage(void)
 
47
{
 
48
 
 
49
  /* Register messages for use with my_error(). */
 
50
  if (my_error_register(drizzled_error_messages,
 
51
                        ER_ERROR_FIRST, ER_ERROR_LAST))
 
52
  {
 
53
    return(true);
 
54
  }
 
55
 
 
56
  init_myfunc_errs();                   /* Init myfunc messages */
 
57
  return(false);
 
58
}
 
59
 
 
60
 
 
61
/**
 
62
  Initiates error-messages used by my_func-library.
 
63
*/
 
64
 
 
65
static void init_myfunc_errs()
 
66
{
 
67
  init_glob_errs();                     /* Initiate english errors */
 
68
 
 
69
  {
 
70
    EE(EE_FILENOTFOUND)   = ER(ER_FILE_NOT_FOUND);
 
71
    EE(EE_CANTCREATEFILE) = ER(ER_CANT_CREATE_FILE);
 
72
    EE(EE_READ)           = ER(ER_ERROR_ON_READ);
 
73
    EE(EE_WRITE)          = ER(ER_ERROR_ON_WRITE);
 
74
    EE(EE_BADCLOSE)       = ER(ER_ERROR_ON_CLOSE);
 
75
    EE(EE_OUTOFMEMORY)    = ER(ER_OUTOFMEMORY);
 
76
    EE(EE_DELETE)         = ER(ER_CANT_DELETE_FILE);
 
77
    EE(EE_LINK)           = ER(ER_ERROR_ON_RENAME);
 
78
    EE(EE_EOFERR)         = ER(ER_UNEXPECTED_EOF);
 
79
    EE(EE_CANTLOCK)       = ER(ER_CANT_LOCK);
 
80
    EE(EE_DIR)            = ER(ER_CANT_READ_DIR);
 
81
    EE(EE_STAT)           = ER(ER_CANT_GET_STAT);
 
82
    EE(EE_GETWD)          = ER(ER_CANT_GET_WD);
 
83
    EE(EE_SETWD)          = ER(ER_CANT_SET_WD);
 
84
    EE(EE_DISK_FULL)      = ER(ER_DISK_FULL);
 
85
  }
 
86
}