1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2009 Sun Microsystems, Inc.
4
* Copyright (C) 2009 Sun Microsystems
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
53
52
conversion_error= util::tablename_to_filename(db, path);
54
53
if (conversion_error)
56
errmsg_printf(error::ERROR,
55
errmsg_printf(ERRMSG_LVL_ERROR,
57
56
_("Schema name cannot be encoded and fit within filesystem "
58
57
"name length restrictions."));
79
79
if (not db_arg.empty())
81
build_schema_filename(db_path, db);
81
drizzled::build_schema_filename(db_path, db);
82
82
assert(db_path.length()); // TODO throw exception, this is a possibility
86
void Schema::getSQLPath(std::string &arg) const
86
const std::string &SchemaIdentifier::getSQLPath()
88
return getSchemaName();
91
const std::string &Schema::getPath() const
91
const std::string &SchemaIdentifier::getPath() const
96
bool Schema::compare(const std::string &arg) const
96
bool SchemaIdentifier::compare(const std::string &arg) const
98
98
return boost::iequals(arg, db);
101
bool Schema::compare(Schema::const_reference arg) const
103
return boost::iequals(arg.getSchemaName(), db);
106
bool Schema::isValid() const
118
if (db.size() > NAME_LEN)
124
if (db.at(db.length() -1) == ' ')
137
const CHARSET_INFO * const cs= &my_charset_utf8mb4_general_ci;
139
int well_formed_error;
140
uint32_t res= cs->cset->well_formed_len(cs, db.c_str(), db.c_str() + db.length(),
141
NAME_CHAR_LEN, &well_formed_error);
142
if (well_formed_error or db.length() != res)
152
my_error(ER_WRONG_DB_NAME, *this);
101
bool SchemaIdentifier::isValid() const
106
if (db.size() > NAME_LEN)
109
if (db.at(db.length() -1) == ' ')
112
const CHARSET_INFO * const cs= &my_charset_utf8mb4_general_ci;
114
int well_formed_error;
115
uint32_t res= cs->cset->well_formed_len(cs, db.c_str(), db.c_str() + db.length(),
116
NAME_CHAR_LEN, &well_formed_error);
118
if (well_formed_error)
120
my_error(ER_INVALID_CHARACTER_STRING, MYF(0), "identifier", db.c_str());
124
if (db.length() != res)
160
const std::string &Schema::getCatalogName() const
162
return drizzled::catalog::local_identifier().name();
165
std::ostream& operator<<(std::ostream& output, const Schema&identifier)
167
output << "identifier::Schema:(";
168
output << catalog::local_identifier();
170
output << identifier.getSchemaName().c_str();
172
output << identifier.getPath().c_str();
175
return output; // for multiple << operators.
178
} /* namespace identifier */
179
130
} /* namespace drizzled */