641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
1 |
/*****************************************************************************
|
2 |
||
3 |
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
4 |
Copyright (c) 2009, Sun Microsystems, Inc.
|
5 |
||
6 |
Portions of this file contain modifications contributed and copyrighted by
|
|
7 |
Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
|
|
8 |
are described briefly in the InnoDB documentation. The contributions by
|
|
9 |
Sun Microsystems are incorporated with their permission, and subject to the
|
|
10 |
conditions contained in the file COPYING.Sun_Microsystems.
|
|
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
11 |
|
12 |
This program is free software; you can redistribute it and/or modify it under
|
|
13 |
the terms of the GNU General Public License as published by the Free Software
|
|
14 |
Foundation; version 2 of the License.
|
|
15 |
||
16 |
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
17 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
18 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
19 |
||
20 |
You should have received a copy of the GNU General Public License along with
|
|
21 |
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
22 |
Place, Suite 330, Boston, MA 02111-1307 USA
|
|
23 |
||
24 |
*****************************************************************************/
|
|
25 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
26 |
/******************************************************************//**
|
27 |
@file include/ut0ut.h
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
28 |
Various utilities
|
29 |
||
30 |
Created 1/20/1994 Heikki Tuuri
|
|
31 |
***********************************************************************/
|
|
32 |
||
33 |
#ifndef ut0ut_h
|
|
34 |
#define ut0ut_h
|
|
35 |
||
36 |
#include "univ.i" |
|
37 |
#include <time.h> |
|
38 |
#ifndef MYSQL_SERVER
|
|
39 |
#include <ctype.h> |
|
40 |
#endif
|
|
41 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
42 |
/** Index name prefix in fast index creation */
|
43 |
#define TEMP_INDEX_PREFIX '\377'
|
|
44 |
/** Index name prefix in fast index creation, as a string constant */
|
|
45 |
#define TEMP_INDEX_PREFIX_STR "\377"
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
46 |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
47 |
/** Time stamp */
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
48 |
typedef time_t ib_time_t; |
49 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
50 |
#if defined(IB_HAVE_PAUSE_INSTRUCTION)
|
51 |
# ifdef WIN32
|
|
52 |
/* In the Win32 API, the x86 PAUSE instruction is executed by calling
|
|
53 |
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
|
|
54 |
independent way by using YieldProcessor.*/
|
|
55 |
# define UT_RELAX_CPU() YieldProcessor()
|
|
56 |
# else
|
|
57 |
/* According to the gcc info page, asm volatile means that the
|
|
58 |
instruction has important side-effects and must not be removed.
|
|
59 |
Also asm volatile may trigger a memory barrier (spilling all registers
|
|
60 |
to memory). */
|
|
61 |
# define UT_RELAX_CPU() __asm__ __volatile__ ("pause")
|
|
62 |
# endif
|
|
63 |
#elif defined(HAVE_ATOMIC_BUILTINS)
|
|
64 |
# define UT_RELAX_CPU() do { \
|
|
65 |
volatile lint volatile_var; \
|
|
66 |
os_compare_and_swap_lint(&volatile_var, 0, 1); \
|
|
67 |
} while (0)
|
|
68 |
#else
|
|
69 |
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */ |
|
70 |
#endif
|
|
71 |
||
72 |
/*********************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
73 |
Delays execution for at most max_wait_us microseconds or returns earlier
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
74 |
if cond becomes true.
|
75 |
@param cond in: condition to wait for; evaluated every 2 ms
|
|
76 |
@param max_wait_us in: maximum delay to wait, in microseconds */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
77 |
#define UT_WAIT_FOR(cond, max_wait_us) \
|
78 |
do { \
|
|
79 |
ullint start_us; \
|
|
80 |
start_us = ut_time_us(NULL); \
|
|
81 |
while (!(cond) \
|
|
82 |
&& ut_time_us(NULL) - start_us < (max_wait_us)) {\
|
|
83 |
\
|
|
84 |
os_thread_sleep(2000 /* 2 ms */); \ |
|
85 |
} \
|
|
86 |
} while (0)
|
|
87 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
88 |
/********************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
89 |
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
|
90 |
but since there seem to be compiler bugs in both gcc and Visual C++,
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
91 |
we do this by a special conversion.
|
92 |
@return a >> 32 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
93 |
UNIV_INTERN
|
94 |
ulint
|
|
95 |
ut_get_high32( |
|
96 |
/*==========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
97 |
ulint a); /*!< in: ulint */ |
98 |
/******************************************************//**
|
|
99 |
Calculates the minimum of two ulints.
|
|
100 |
@return minimum */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
101 |
UNIV_INLINE
|
102 |
ulint
|
|
103 |
ut_min( |
|
104 |
/*===*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
105 |
ulint n1, /*!< in: first number */ |
106 |
ulint n2); /*!< in: second number */ |
|
107 |
/******************************************************//**
|
|
108 |
Calculates the maximum of two ulints.
|
|
109 |
@return maximum */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
110 |
UNIV_INLINE
|
111 |
ulint
|
|
112 |
ut_max( |
|
113 |
/*===*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
114 |
ulint n1, /*!< in: first number */ |
115 |
ulint n2); /*!< in: second number */ |
|
116 |
/****************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
117 |
Calculates minimum of two ulint-pairs. */
|
118 |
UNIV_INLINE
|
|
119 |
void
|
|
120 |
ut_pair_min( |
|
121 |
/*========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
122 |
ulint* a, /*!< out: more significant part of minimum */ |
123 |
ulint* b, /*!< out: less significant part of minimum */ |
|
124 |
ulint a1, /*!< in: more significant part of first pair */ |
|
125 |
ulint b1, /*!< in: less significant part of first pair */ |
|
126 |
ulint a2, /*!< in: more significant part of second pair */ |
|
127 |
ulint b2); /*!< in: less significant part of second pair */ |
|
128 |
/******************************************************//**
|
|
129 |
Compares two ulints.
|
|
130 |
@return 1 if a > b, 0 if a == b, -1 if a < b */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
131 |
UNIV_INLINE
|
132 |
int
|
|
133 |
ut_ulint_cmp( |
|
134 |
/*=========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
135 |
ulint a, /*!< in: ulint */ |
136 |
ulint b); /*!< in: ulint */ |
|
137 |
/*******************************************************//**
|
|
138 |
Compares two pairs of ulints.
|
|
139 |
@return -1 if a < b, 0 if a == b, 1 if a > b */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
140 |
UNIV_INLINE
|
141 |
int
|
|
142 |
ut_pair_cmp( |
|
143 |
/*========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
144 |
ulint a1, /*!< in: more significant part of first pair */ |
145 |
ulint a2, /*!< in: less significant part of first pair */ |
|
146 |
ulint b1, /*!< in: more significant part of second pair */ |
|
147 |
ulint b2); /*!< in: less significant part of second pair */ |
|
148 |
/*************************************************************//**
|
|
149 |
Determines if a number is zero or a power of two.
|
|
150 |
@param n in: number
|
|
151 |
@return nonzero if n is zero or a power of two; zero otherwise */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
152 |
#define ut_is_2pow(n) UNIV_LIKELY(!((n) & ((n) - 1)))
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
153 |
/*************************************************************//**
|
154 |
Calculates fast the remainder of n/m when m is a power of two.
|
|
155 |
@param n in: numerator
|
|
156 |
@param m in: denominator, must be a power of two
|
|
157 |
@return the remainder of n/m */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
158 |
#define ut_2pow_remainder(n, m) ((n) & ((m) - 1))
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
159 |
/*************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
160 |
Calculates the biggest multiple of m that is not bigger than n
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
161 |
when m is a power of two. In other words, rounds n down to m * k.
|
162 |
@param n in: number to round down
|
|
163 |
@param m in: alignment, must be a power of two
|
|
164 |
@return n rounded down to the biggest possible integer multiple of m */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
165 |
#define ut_2pow_round(n, m) ((n) & ~((m) - 1))
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
166 |
/** Align a number down to a multiple of a power of two.
|
167 |
@param n in: number to round down
|
|
168 |
@param m in: alignment, must be a power of two
|
|
169 |
@return n rounded down to the biggest possible integer multiple of m */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
170 |
#define ut_calc_align_down(n, m) ut_2pow_round(n, m)
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
171 |
/********************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
172 |
Calculates the smallest multiple of m that is not smaller than n
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
173 |
when m is a power of two. In other words, rounds n up to m * k.
|
174 |
@param n in: number to round up
|
|
175 |
@param m in: alignment, must be a power of two
|
|
176 |
@return n rounded up to the smallest possible integer multiple of m */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
177 |
#define ut_calc_align(n, m) (((n) + ((m) - 1)) & ~((m) - 1))
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
178 |
/*************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
179 |
Calculates fast the 2-logarithm of a number, rounded upward to an
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
180 |
integer.
|
181 |
@return logarithm in the base 2, rounded upward */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
182 |
UNIV_INLINE
|
183 |
ulint
|
|
184 |
ut_2_log( |
|
185 |
/*=====*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
186 |
ulint n); /*!< in: number */ |
187 |
/*************************************************************//**
|
|
188 |
Calculates 2 to power n.
|
|
189 |
@return 2 to power n */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
190 |
UNIV_INLINE
|
191 |
ulint
|
|
192 |
ut_2_exp( |
|
193 |
/*=====*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
194 |
ulint n); /*!< in: number */ |
195 |
/*************************************************************//**
|
|
196 |
Calculates fast the number rounded up to the nearest power of 2.
|
|
197 |
@return first power of 2 which is >= n */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
198 |
UNIV_INTERN
|
199 |
ulint
|
|
200 |
ut_2_power_up( |
|
201 |
/*==========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
202 |
ulint n) /*!< in: number != 0 */ |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
203 |
__attribute__((const)); |
204 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
205 |
/** Determine how many bytes (groups of 8 bits) are needed to
|
206 |
store the given number of bits.
|
|
207 |
@param b in: bits
|
|
208 |
@return number of bytes (octets) needed to represent b */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
209 |
#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
|
210 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
211 |
/**********************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
212 |
Returns system time. We do not specify the format of the time returned:
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
213 |
the only way to manipulate it is to use the function ut_difftime.
|
214 |
@return system time */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
215 |
UNIV_INTERN
|
216 |
ib_time_t
|
|
217 |
ut_time(void); |
|
218 |
/*=========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
219 |
/**********************************************************//**
|
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
220 |
Returns system time.
|
221 |
Upon successful completion, the value 0 is returned; otherwise the
|
|
222 |
value -1 is returned and the global variable errno is set to indicate the
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
223 |
error.
|
224 |
@return 0 on success, -1 otherwise */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
225 |
UNIV_INTERN
|
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
226 |
int
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
227 |
ut_usectime( |
228 |
/*========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
229 |
ulint* sec, /*!< out: seconds since the Epoch */ |
230 |
ulint* ms); /*!< out: microseconds since the Epoch+*sec */ |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
231 |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
232 |
/**********************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
233 |
Returns the number of microseconds since epoch. Similar to
|
234 |
time(3), the return value is also stored in *tloc, provided
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
235 |
that tloc is non-NULL.
|
236 |
@return us since epoch */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
237 |
UNIV_INTERN
|
238 |
ullint
|
|
239 |
ut_time_us( |
|
240 |
/*=======*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
241 |
ullint* tloc); /*!< out: us since epoch, if non-NULL */ |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
242 |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
243 |
/**********************************************************//**
|
244 |
Returns the difference of two times in seconds.
|
|
245 |
@return time2 - time1 expressed in seconds */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
246 |
UNIV_INTERN
|
247 |
double
|
|
248 |
ut_difftime( |
|
249 |
/*========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
250 |
ib_time_t time2, /*!< in: time */ |
251 |
ib_time_t time1); /*!< in: time */ |
|
252 |
/**********************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
253 |
Prints a timestamp to a file. */
|
254 |
UNIV_INTERN
|
|
255 |
void
|
|
256 |
ut_print_timestamp( |
|
257 |
/*===============*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
258 |
FILE* file); /*!< in: file where to print */ |
259 |
/**********************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
260 |
Sprintfs a timestamp to a buffer, 13..14 chars plus terminating NUL. */
|
261 |
UNIV_INTERN
|
|
262 |
void
|
|
263 |
ut_sprintf_timestamp( |
|
264 |
/*=================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
265 |
char* buf); /*!< in: buffer where to sprintf */ |
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
266 |
#ifdef UNIV_HOTBACKUP
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
267 |
/**********************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
268 |
Sprintfs a timestamp to a buffer with no spaces and with ':' characters
|
269 |
replaced by '_'. */
|
|
270 |
UNIV_INTERN
|
|
271 |
void
|
|
272 |
ut_sprintf_timestamp_without_extra_chars( |
|
273 |
/*=====================================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
274 |
char* buf); /*!< in: buffer where to sprintf */ |
275 |
/**********************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
276 |
Returns current year, month, day. */
|
277 |
UNIV_INTERN
|
|
278 |
void
|
|
279 |
ut_get_year_month_day( |
|
280 |
/*==================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
281 |
ulint* year, /*!< out: current year */ |
282 |
ulint* month, /*!< out: month */ |
|
283 |
ulint* day); /*!< out: day */ |
|
284 |
#else /* UNIV_HOTBACKUP */ |
|
285 |
/*************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
286 |
Runs an idle loop on CPU. The argument gives the desired delay
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
287 |
in microseconds on 100 MHz Pentium + Visual C++.
|
288 |
@return dummy value */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
289 |
UNIV_INTERN
|
290 |
ulint
|
|
291 |
ut_delay( |
|
292 |
/*=====*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
293 |
ulint delay); /*!< in: delay in microseconds on 100 MHz Pentium */ |
294 |
#endif /* UNIV_HOTBACKUP */ |
|
295 |
/*************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
296 |
Prints the contents of a memory buffer in hex and ascii. */
|
297 |
UNIV_INTERN
|
|
298 |
void
|
|
299 |
ut_print_buf( |
|
300 |
/*=========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
301 |
FILE* file, /*!< in: file where to print */ |
302 |
const void* buf, /*!< in: memory buffer */ |
|
303 |
ulint len); /*!< in: length of the buffer */ |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
304 |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
305 |
/**********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
306 |
Outputs a NUL-terminated file name, quoted with apostrophes. */
|
307 |
UNIV_INTERN
|
|
308 |
void
|
|
309 |
ut_print_filename( |
|
310 |
/*==============*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
311 |
FILE* f, /*!< in: output stream */ |
312 |
const char* name); /*!< in: name to print */ |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
313 |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
314 |
#ifndef UNIV_HOTBACKUP
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
315 |
/* Forward declaration of transaction handle */
|
316 |
struct trx_struct; |
|
317 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
318 |
/**********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
319 |
Outputs a fixed-length string, quoted as an SQL identifier.
|
320 |
If the string contains a slash '/', the string will be
|
|
321 |
output as two identifiers separated by a period (.),
|
|
322 |
as in SQL database_name.identifier. */
|
|
323 |
UNIV_INTERN
|
|
324 |
void
|
|
325 |
ut_print_name( |
|
326 |
/*==========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
327 |
FILE* f, /*!< in: output stream */ |
328 |
struct trx_struct*trx, /*!< in: transaction */ |
|
329 |
ibool table_id,/*!< in: TRUE=print a table name, |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
330 |
FALSE=print other identifier */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
331 |
const char* name); /*!< in: name to print */ |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
332 |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
333 |
/**********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
334 |
Outputs a fixed-length string, quoted as an SQL identifier.
|
335 |
If the string contains a slash '/', the string will be
|
|
336 |
output as two identifiers separated by a period (.),
|
|
337 |
as in SQL database_name.identifier. */
|
|
338 |
UNIV_INTERN
|
|
339 |
void
|
|
340 |
ut_print_namel( |
|
341 |
/*===========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
342 |
FILE* f, /*!< in: output stream */ |
343 |
struct trx_struct*trx, /*!< in: transaction (NULL=no quotes) */ |
|
344 |
ibool table_id,/*!< in: TRUE=print a table name, |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
345 |
FALSE=print other identifier */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
346 |
const char* name, /*!< in: name to print */ |
347 |
ulint namelen);/*!< in: length of name */ |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
348 |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
349 |
/**********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
350 |
Catenate files. */
|
351 |
UNIV_INTERN
|
|
352 |
void
|
|
353 |
ut_copy_file( |
|
354 |
/*=========*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
355 |
FILE* dest, /*!< in: output file */ |
356 |
FILE* src); /*!< in: input file to be appended to output */ |
|
357 |
#endif /* !UNIV_HOTBACKUP */ |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
358 |
|
359 |
#ifdef __WIN__
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
360 |
/**********************************************************************//**
|
361 |
A substitute for snprintf(3), formatted output conversion into
|
|
362 |
a limited buffer.
|
|
363 |
@return number of characters that would have been printed if the size
|
|
364 |
were unlimited, not including the terminating '\0'. */
|
|
365 |
UNIV_INTERN
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
366 |
int
|
367 |
ut_snprintf( |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
368 |
/*========*/
|
369 |
char* str, /*!< out: string */ |
|
370 |
size_t size, /*!< in: str size */ |
|
371 |
const char* fmt, /*!< in: format */ |
|
372 |
...); /*!< in: format values */ |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
373 |
#else
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
374 |
/**********************************************************************//**
|
375 |
A wrapper for snprintf(3), formatted output conversion into
|
|
376 |
a limited buffer. */
|
|
377 |
# define ut_snprintf snprintf
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
378 |
#endif /* __WIN__ */ |
379 |
||
380 |
#ifndef UNIV_NONINL
|
|
381 |
#include "ut0ut.ic" |
|
382 |
#endif
|
|
383 |
||
384 |
#endif
|
|
385 |