~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/schema.cc

  • Committer: Mark Atwood
  • Date: 2011-08-01 05:22:14 UTC
  • mfrom: (1919.3.53 drizzle_pbms)
  • Revision ID: me@mark.atwood.name-20110801052214-3wdsx3xgld6b5v4f
mergeĀ lp:~barry-leslie/drizzle/drizzle_pbms

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
namespace drizzled {
42
42
namespace identifier {
43
43
 
 
44
extern string drizzle_tmpdir;
 
45
 
 
46
static size_t build_schema_filename(string &path, const string &db)
 
47
{
 
48
  path.append("");
 
49
  bool conversion_error= false;
 
50
 
 
51
  conversion_error= util::tablename_to_filename(db, path);
 
52
  if (conversion_error)
 
53
  {
 
54
    errmsg_printf(error::ERROR,
 
55
                  _("Schema name cannot be encoded and fit within filesystem "
 
56
                    "name length restrictions."));
 
57
    return 0;
 
58
  }
 
59
 
 
60
  return path.length();
 
61
}
 
62
 
44
63
Schema::Schema(const std::string &db_arg) :
45
64
  db(db_arg)
46
65
56
75
 
57
76
  if (not db_arg.empty())
58
77
  {
59
 
    db_path += util::tablename_to_filename(db);
 
78
    build_schema_filename(db_path, db);
60
79
    assert(db_path.length()); // TODO throw exception, this is a possibility
61
80
  }
62
81
}