13 const std::string DBType::_labels[
LAST_VALUE] =
14 {
"NoDB",
"SQLite3",
"PG",
"MySQL/MariaDB" };
17 const char DBType::_typeLabels[
LAST_VALUE] = {
'N',
'S',
'P',
'M' };
26 : _type (iDBType._type) {
38 case 'N': oType =
NODB;
break;
39 case 'S': oType =
SQLITE3;
break;
40 case 'P': oType =
PG;
break;
41 case 'M': oType =
MYSQL;
break;
47 std::ostringstream oMessage;
48 oMessage <<
"The database type '" << iTypeChar
49 <<
"' is not known. Known database types: " << lLabels;
63 if (iTypeStr ==
"sqlite3") {
65 }
else if (iTypeStr ==
"sqlite" || iTypeStr ==
"sqlite3") {
67 }
else if (iTypeStr ==
"pg" || iTypeStr ==
"postgres"
68 || iTypeStr ==
"postgresql") {
70 }
else if (iTypeStr ==
"mysql" || iTypeStr ==
"mariadb") {
72 }
else if (iTypeStr ==
"nodb") {
80 std::ostringstream oMessage;
81 oMessage <<
"The database type '" << iTypeStr
82 <<
"' is not known. Known database types: " << lLabels;
89 return _labels[iType];
94 return _typeLabels[iType];
99 std::ostringstream oStr;
100 oStr << _typeLabels[iType];
106 std::ostringstream ostr;
107 for (
unsigned short idx = 0; idx !=
LAST_VALUE; ++idx) {
111 ostr << _labels[idx];
123 const char oTypeChar = _typeLabels[_type];
129 std::ostringstream oStr;
130 oStr << _typeLabels[_type];
136 std::ostringstream ostr;
137 ostr << _labels[_type];
143 return (_type == iType);
148 return (_type == iDBType._type);
static std::string describeLabels()
DBType(const EN_DBType &)
const std::string describe() const
static std::string getTypeLabelAsString(const EN_DBType &)
EN_DBType getType() const
bool operator==(const EN_DBType &) const
std::string getTypeAsString() const
static char getTypeLabel(const EN_DBType &)
static EN_DBType getType(const char)
static const std::string & getLabel(const EN_DBType &)
char getTypeAsChar() const