~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/table.cc

  • Committer: Brian Aker
  • Date: 2010-08-05 20:24:49 UTC
  • mto: (1688.1.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 1689.
  • Revision ID: brian@gaz-20100805202449-am05zi2zmjhklt8g
This fixes the lower casing of names from Schema even when we should not.

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
  for (; *from  && length < to_length; length++, from++)
278
278
  {
279
279
    if ((*from >= '0' && *from <= '9') ||
280
 
        (*from >= 'A' && *from <= 'Z') ||
281
280
        (*from >= 'a' && *from <= 'z') ||
282
281
/* OSX defines an extra set of high-bit and multi-byte characters
283
282
   that cannot be used on the filesystem. Instead of trying to sort
293
292
      to[length]= tolower(*from);
294
293
      continue;
295
294
    }
 
295
 
 
296
    if ((*from >= 'A' && *from <= 'Z'))
 
297
    {
 
298
      to[length]= tolower(*from);
 
299
      continue;
 
300
    }
296
301
   
297
302
    if (length + 3 >= to_length)
298
303
      return true;
325
330
 
326
331
void TableIdentifier::init()
327
332
{
328
 
  std::string lower_table_name(table_name);
329
 
  std::transform(lower_table_name.begin(), lower_table_name.end(),
330
 
                 lower_table_name.begin(), ::tolower);
331
 
 
332
333
  switch (type) {
333
334
  case message::Table::FUNCTION:
334
335
  case message::Table::STANDARD:
335
336
    assert(path.size() == 0);
336
 
    build_table_filename(path, getLower().c_str(), lower_table_name.c_str(), false);
 
337
    build_table_filename(path, getSchemaName().c_str(), table_name.c_str(), false);
337
338
    break;
338
339
  case message::Table::INTERNAL:
339
340
    assert(path.size() == 0);
340
 
    build_table_filename(path, getLower().c_str(), lower_table_name.c_str(), true);
 
341
    build_table_filename(path, getSchemaName().c_str(), table_name.c_str(), true);
341
342
    break;
342
343
  case message::Table::TEMPORARY:
343
344
    if (path.empty())
362
363
  return path;
363
364
}
364
365
 
365
 
const std::string &TableIdentifier::getSQLPath()
 
366
const std::string &TableIdentifier::getSQLPath()  // @todo this is just used for errors, we should find a way to optimize it
366
367
{
367
368
  if (sql_path.empty())
368
369
  {
369
370
    switch (type) {
370
371
    case message::Table::FUNCTION:
371
372
    case message::Table::STANDARD:
372
 
      sql_path.append(getLower());
 
373
      sql_path.append(getSchemaName());
373
374
      sql_path.append(".");
374
375
      sql_path.append(table_name);
375
376
      break;
378
379
      sql_path.append(table_name);
379
380
      break;
380
381
    case message::Table::TEMPORARY:
381
 
      sql_path.append(getLower());
 
382
      sql_path.append(getSchemaName());
382
383
      sql_path.append(".#");
383
384
      sql_path.append(table_name);
384
385
      break;