~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/table.cc

  • Committer: Olaf van der Spek
  • Date: 2011-03-23 23:52:54 UTC
  • mto: This revision was merged to the branch mainline in revision 2251.
  • Revision ID: olafvdspek@gmail.com-20110323235254-g3q0c1feajno7edr
 Remove const_reference and reference from identifier::Table

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
 
213
213
size_t Table::build_table_filename(std::string &in_path, const std::string &in_db, const std::string &in_table_name, bool is_tmp)
214
214
{
215
 
  bool conversion_error= false;
216
 
 
217
 
  conversion_error= util::tablename_to_filename(in_db, in_path);
218
 
  if (conversion_error)
 
215
  if (util::tablename_to_filename(in_db, in_path))
219
216
  {
220
 
    errmsg_printf(error::ERROR,
221
 
                  _("Schema name cannot be encoded and fit within filesystem "
222
 
                    "name length restrictions."));
 
217
    errmsg_printf(error::ERROR, _("Schema name cannot be encoded and fit within filesystem name length restrictions."));
223
218
    return 0;
224
219
  }
225
220
 
229
224
  {
230
225
    in_path.append(in_table_name);
231
226
  }
232
 
  else
 
227
  else if (util::tablename_to_filename(in_table_name, in_path))
233
228
  {
234
 
    conversion_error= util::tablename_to_filename(in_table_name, in_path);
235
 
    if (conversion_error)
236
 
    {
237
 
      errmsg_printf(error::ERROR,
238
 
                    _("Table name cannot be encoded and fit within filesystem "
239
 
                      "name length restrictions."));
240
 
      return 0;
241
 
    }
 
229
    errmsg_printf(error::ERROR, _("Table name cannot be encoded and fit within filesystem name length restrictions."));
 
230
    return 0;
242
231
  }
243
232
   
244
233
  return in_path.length();
293
282
    break;
294
283
  }
295
284
 
296
 
  util::insensitive_hash hasher;
297
 
  hash_value= hasher(path);
 
285
  hash_value= util::insensitive_hash()(path);
298
286
 
299
287
  std::string tb_name(getTableName());
300
288
  std::transform(tb_name.begin(), tb_name.end(), tb_name.begin(), ::tolower);
356
344
  return false;
357
345
}
358
346
 
359
 
 
360
347
void Table::copyToTableMessage(message::Table &message) const
361
348
{
362
349
  message.set_name(table_name);
384
371
  return b.getHashValue();
385
372
}
386
373
 
387
 
 
388
 
std::ostream& operator<<(std::ostream& output, Table::const_reference identifier)
 
374
std::ostream& operator<<(std::ostream& output, const Table& identifier)
389
375
{
390
 
  output << "Table:(";
391
 
  output <<  identifier.getSchemaName();
392
 
  output << ", ";
393
 
  output << identifier.getTableName();
394
 
  output << ", ";
395
 
  output << message::type(identifier.getType());
396
 
  output << ", ";
397
 
  output << identifier.getPath();
398
 
  output << ", ";
399
 
  output << identifier.getHashValue();
400
 
  output << ")";
401
 
 
402
 
  return output;  // for multiple << operators.
 
376
  return output << "Table:(" <<  identifier.getSchemaName() << ", " << identifier.getTableName() << ", " << message::type(identifier.getType()) << ", " << identifier.getPath() << ", " << identifier.getHashValue() << ")";
403
377
}
404
378
 
405
379
} /* namespace identifier */