~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/charset.cc

Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
281
281
}
282
282
 
283
283
 
284
 
/**
285
 
  Resolve character set by the character set name (utf8, latin1, ...).
286
 
 
287
 
  The function tries to resolve character set by the specified name. If
288
 
  there is character set with the given name, it is assigned to the "cs"
289
 
  parameter and false is returned. If there is no such character set,
290
 
  "default_cs" is assigned to the "cs" and true is returned.
291
 
 
292
 
  @param[in] cs_name    Character set name.
293
 
  @param[in] default_cs Default character set.
294
 
  @param[out] cs        Variable to store character set.
295
 
 
296
 
  @return false if character set was resolved successfully; true if there
297
 
  is no character set with given name.
298
 
*/
299
 
 
300
 
bool resolve_charset(const char *cs_name,
301
 
                     const CHARSET_INFO *default_cs,
302
 
                     const CHARSET_INFO **cs)
303
 
{
304
 
  *cs= get_charset_by_csname(cs_name, MY_CS_PRIMARY);
305
 
 
306
 
  if (*cs == NULL)
307
 
  {
308
 
    *cs= default_cs;
309
 
    return true;
310
 
  }
311
 
 
312
 
  return false;
313
 
}
314
 
 
315
 
 
316
 
/**
317
 
  Resolve collation by the collation name (utf8_general_ci, ...).
318
 
 
319
 
  The function tries to resolve collation by the specified name. If there
320
 
  is collation with the given name, it is assigned to the "cl" parameter
321
 
  and false is returned. If there is no such collation, "default_cl" is
322
 
  assigned to the "cl" and true is returned.
323
 
 
324
 
  @param[out] cl        Variable to store collation.
325
 
  @param[in] cl_name    Collation name.
326
 
  @param[in] default_cl Default collation.
327
 
 
328
 
  @return false if collation was resolved successfully; true if there is no
329
 
  collation with given name.
330
 
*/
331
 
 
332
 
bool resolve_collation(const char *cl_name,
333
 
                       const CHARSET_INFO *default_cl,
334
 
                       const CHARSET_INFO **cl)
335
 
{
336
 
  *cl= get_charset_by_name(cl_name);
337
 
 
338
 
  if (*cl == NULL)
339
 
  {
340
 
    *cl= default_cl;
341
 
    return true;
342
 
  }
343
 
 
344
 
  return false;
345
 
}
346
 
 
347
 
 
348
284
#ifdef BACKSLASH_MBTAIL
349
285
static CHARSET_INFO *fs_cset_cache= NULL;
350
286