~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/drizzle_local.h

  • Committer: Brian Aker
  • Date: 2010-05-26 21:49:18 UTC
  • mto: This revision was merged to the branch mainline in revision 1568.
  • Revision ID: brian@gaz-20100526214918-8kdibq48e9lnyr6t
This fixes bug 586009, increases the size of the log files so that the UNION
test doesn't hit Innodb's default limit. Increases the size of the initial
Innodb data file, and fixes one case where an empty string on error was
causing a crash on OSX.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Drizzle Client & Protocol Library
3
 
 *
4
 
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
5
 
 * All rights reserved.
6
 
 *
7
 
 * Redistribution and use in source and binary forms, with or without
8
 
 * modification, are permitted provided that the following conditions are
9
 
 * met:
10
 
 *
11
 
 *     * Redistributions of source code must retain the above copyright
12
 
 * notice, this list of conditions and the following disclaimer.
13
 
 *
14
 
 *     * Redistributions in binary form must reproduce the above
15
 
 * copyright notice, this list of conditions and the following disclaimer
16
 
 * in the documentation and/or other materials provided with the
17
 
 * distribution.
18
 
 *
19
 
 *     * The names of its contributors may not be used to endorse or
20
 
 * promote products derived from this software without specific prior
21
 
 * written permission.
22
 
 *
23
 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
 
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26
 
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27
 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
 
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30
 
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
 
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
 
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
 
 *
35
 
 */
36
 
 
37
 
/**
38
 
 * @file
39
 
 * @brief Local Drizzle Declarations
40
 
 */
41
 
 
42
 
#ifndef __DRIZZLE_LOCAL_H
43
 
#define __DRIZZLE_LOCAL_H
44
 
 
45
 
#ifdef __cplusplus
46
 
extern "C" {
47
 
#endif
48
 
 
49
 
/**
50
 
 * @addtogroup drizzle_local Local Drizzle Declarations
51
 
 * @ingroup drizzle
52
 
 * @{
53
 
 */
54
 
 
55
 
/**
56
 
 * Set the error string.
57
 
 *
58
 
 * @param[in] drizzle Drizzle structure previously initialized with
59
 
 *  drizzle_create() or drizzle_clone().
60
 
 * @param[in] function Name of function the error happened in. 
61
 
 * @param[in] format Format and variable argument list of message.
62
 
 */
63
 
DRIZZLE_LOCAL
64
 
void drizzle_set_error(drizzle_st *drizzle, const char *function,
65
 
                       const char *format, ...);
66
 
 
67
 
/**
68
 
 * Log a message.
69
 
 *
70
 
 * @param[in] drizzle Drizzle structure previously initialized with
71
 
 *  drizzle_create() or drizzle_clone().
72
 
 * @param[in] verbose Logging level of the message.
73
 
 * @param[in] format Format and variable argument list of message.
74
 
 * @param[in] args Variable argument list that has been initialized.
75
 
 */
76
 
DRIZZLE_LOCAL
77
 
void drizzle_log(drizzle_st *drizzle, drizzle_verbose_t verbose,
78
 
                 const char *format, va_list args);
79
 
 
80
 
/**
81
 
 * Log a fatal message, see drizzle_log() for argument details.
82
 
 */
83
 
static inline void drizzle_log_fatal(drizzle_st *drizzle, const char *format,
84
 
                                     ...)
85
 
{
86
 
  va_list args;
87
 
 
88
 
  if (drizzle->verbose >= DRIZZLE_VERBOSE_FATAL)
89
 
  {
90
 
    va_start(args, format);
91
 
    drizzle_log(drizzle, DRIZZLE_VERBOSE_FATAL, format, args);
92
 
    va_end(args);
93
 
  }
94
 
}
95
 
 
96
 
/**
97
 
 * Log an error message, see drizzle_log() for argument details.
98
 
 */
99
 
static inline void drizzle_log_error(drizzle_st *drizzle, const char *format,
100
 
                                     ...)
101
 
{
102
 
  va_list args;
103
 
 
104
 
  if (drizzle->verbose >= DRIZZLE_VERBOSE_ERROR)
105
 
  {
106
 
    va_start(args, format);
107
 
    drizzle_log(drizzle, DRIZZLE_VERBOSE_ERROR, format, args);
108
 
    va_end(args);
109
 
  }
110
 
}
111
 
 
112
 
/**
113
 
 * Log an info message, see drizzle_log() for argument details.
114
 
 */
115
 
static inline void drizzle_log_info(drizzle_st *drizzle, const char *format,
116
 
                                    ...)
117
 
{
118
 
  va_list args;
119
 
 
120
 
  if (drizzle->verbose >= DRIZZLE_VERBOSE_INFO)
121
 
  {
122
 
    va_start(args, format);
123
 
    drizzle_log(drizzle, DRIZZLE_VERBOSE_INFO, format, args);
124
 
    va_end(args);
125
 
  }
126
 
}
127
 
 
128
 
/**
129
 
 * Log a debug message, see drizzle_log() for argument details.
130
 
 */
131
 
static inline void drizzle_log_debug(drizzle_st *drizzle, const char *format,
132
 
                                     ...)
133
 
{
134
 
  va_list args;
135
 
 
136
 
  if (drizzle->verbose >= DRIZZLE_VERBOSE_DEBUG)
137
 
  {
138
 
    va_start(args, format);
139
 
    drizzle_log(drizzle, DRIZZLE_VERBOSE_DEBUG, format, args);
140
 
    va_end(args);
141
 
  }
142
 
}
143
 
 
144
 
/**
145
 
 * Log a crazy message, see drizzle_log() for argument details.
146
 
 */
147
 
static inline void drizzle_log_crazy(drizzle_st *drizzle, const char *format,
148
 
                                     ...)
149
 
{
150
 
  va_list args;
151
 
 
152
 
  if (drizzle->verbose >= DRIZZLE_VERBOSE_CRAZY)
153
 
  {
154
 
    va_start(args, format);
155
 
    drizzle_log(drizzle, DRIZZLE_VERBOSE_CRAZY, format, args);
156
 
    va_end(args);
157
 
  }
158
 
}
159
 
 
160
 
/** @} */
161
 
 
162
 
#ifdef __cplusplus
163
 
}
164
 
#endif
165
 
 
166
 
#endif /* __DRIZZLE_LOCAL_H */