~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/charset.cc

  • Committer: Brian Aker
  • Date: 2011-03-28 02:46:21 UTC
  • Revision ID: brian@tangent.org-20110328024621-wtkdtlvdplqm0ybf
Shift CHARSET_INFO to charset_info_st

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
    - Initializing charset related structures
41
41
    - Loading dynamic charsets
42
 
    - Searching for a proper CHARSET_INFO
 
42
    - Searching for a proper charset_info_st
43
43
      using charset name, collation name or collation ID
44
44
    - Setting server default character set
45
45
*/
46
46
 
47
 
bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2)
 
47
bool my_charset_same(const charset_info_st *cs1, const charset_info_st *cs2)
48
48
{
49
49
  return ((cs1 == cs2) || !strcmp(cs1->csname,cs2->csname));
50
50
}
53
53
static uint
54
54
get_collation_number_internal(const char *name)
55
55
{
56
 
  for (CHARSET_INFO **cs= all_charsets;
 
56
  for (charset_info_st **cs= all_charsets;
57
57
       cs < all_charsets+array_elements(all_charsets)-1;
58
58
       cs++)
59
59
  {
71
71
  return memory_vector.back();
72
72
}
73
73
 
74
 
static bool init_state_maps(CHARSET_INFO *cs)
 
74
static bool init_state_maps(charset_info_st *cs)
75
75
{
76
76
  if (!(cs->state_map= cs_alloc(256)))
77
77
    return 1;
129
129
 
130
130
static bool charset_initialized= false;
131
131
 
132
 
DRIZZLED_API CHARSET_INFO *all_charsets[256];
133
 
const DRIZZLED_API CHARSET_INFO *default_charset_info = &my_charset_utf8_general_ci;
 
132
DRIZZLED_API charset_info_st *all_charsets[256];
 
133
const DRIZZLED_API charset_info_st *default_charset_info = &my_charset_utf8_general_ci;
134
134
 
135
 
void add_compiled_collation(CHARSET_INFO * cs)
 
135
void add_compiled_collation(charset_info_st * cs)
136
136
{
137
137
  all_charsets[cs->number]= cs;
138
138
  cs->state|= MY_CS_AVAILABLE;
147
147
  */
148
148
  if (charset_initialized == false)
149
149
  {
150
 
    CHARSET_INFO **cs;
 
150
    charset_info_st **cs;
151
151
    memset(&all_charsets, 0, sizeof(all_charsets));
152
152
    init_compiled_charsets(myflags);
153
153
 
193
193
 
194
194
uint32_t get_charset_number(const char *charset_name, uint32_t cs_flags)
195
195
{
196
 
  CHARSET_INFO **cs;
 
196
  charset_info_st **cs;
197
197
  init_available_charsets(MYF(0));
198
198
 
199
199
  for (cs= all_charsets;
211
211
{
212
212
  init_available_charsets(MYF(0));
213
213
 
214
 
  const CHARSET_INFO *cs= all_charsets[charset_number];
 
214
  const charset_info_st *cs= all_charsets[charset_number];
215
215
  if (cs && (cs->number == charset_number) && cs->name )
216
216
    return cs->name;
217
217
 
219
219
}
220
220
 
221
221
 
222
 
static const CHARSET_INFO *get_internal_charset(uint32_t cs_number)
 
222
static const charset_info_st *get_internal_charset(uint32_t cs_number)
223
223
{
224
 
  CHARSET_INFO *cs;
 
224
  charset_info_st *cs;
225
225
  /*
226
226
    To make things thread safe we are not allowing other threads to interfere
227
227
    while we may changing the cs_info_table
247
247
}
248
248
 
249
249
 
250
 
const CHARSET_INFO *get_charset(uint32_t cs_number)
 
250
const charset_info_st *get_charset(uint32_t cs_number)
251
251
{
252
 
  const CHARSET_INFO *cs;
 
252
  const charset_info_st *cs;
253
253
  if (cs_number == default_charset_info->number)
254
254
    return default_charset_info;
255
255
 
263
263
  return cs;
264
264
}
265
265
 
266
 
const CHARSET_INFO *get_charset_by_name(const char *cs_name)
 
266
const charset_info_st *get_charset_by_name(const char *cs_name)
267
267
{
268
268
  uint32_t cs_number;
269
 
  const CHARSET_INFO *cs;
 
269
  const charset_info_st *cs;
270
270
  (void) init_available_charsets(MYF(0));       /* If it isn't initialized */
271
271
 
272
272
  cs_number= get_collation_number(cs_name);
276
276
}
277
277
 
278
278
 
279
 
const CHARSET_INFO *get_charset_by_csname(const char *cs_name, uint32_t cs_flags)
 
279
const charset_info_st *get_charset_by_csname(const char *cs_name, uint32_t cs_flags)
280
280
{
281
281
  uint32_t cs_number;
282
 
  const CHARSET_INFO *cs;
 
282
  const charset_info_st *cs;
283
283
 
284
284
  (void) init_available_charsets(MYF(0));       /* If it isn't initialized */
285
285
 
315
315
    >=0         The length of the escaped string
316
316
*/
317
317
 
318
 
size_t escape_quotes_for_drizzle(const CHARSET_INFO *charset_info,
 
318
size_t escape_quotes_for_drizzle(const charset_info_st *charset_info,
319
319
                                 char *to, size_t to_length,
320
320
                                 const char *from, size_t length)
321
321
{