Revision 01fe6db3
Von Christian Ehringfeld vor fast 10 Jahren hinzugefügt
| src/schema.cpp | ||
|---|---|---|
|
|
||
|
QString Schema::decimal(int precision, int scale, bool notNull,
|
||
|
QString defaultValue, bool unique, QString checkConstraint) const {
|
||
|
|
||
|
return this->buildColumnSchema(TYPE_DECIMAL,
|
||
|
this->combineScaleAndPrecision(precision, scale), notNull, defaultValue,
|
||
|
unique, checkConstraint);
|
||
| ... | ... | |
|
return name.indexOf("`") != -1 || name == "*" ? name : ("`" + name + "`");
|
||
|
}
|
||
|
|
||
|
QHash<QString, QSharedPointer<TableSchema> > Schema::getTableSchemas(
|
||
|
QString schema, bool refresh) {
|
||
|
QHash<QString, QSharedPointer<TableSchema>> Schema::getTableSchemas(
|
||
|
QString schema, bool refresh) {
|
||
|
QStringList names = this->getTableNames();
|
||
|
for (int i = 0; i < names.size(); ++i) {
|
||
|
QString name = names.at(i);
|
||
| ... | ... | |
|
return this->database->getDatabase().tables().contains(tblname);
|
||
|
}
|
||
|
|
||
|
bool Schema::containsColumn(QString tblName, QString colName) {
|
||
|
bool r = false;
|
||
|
if(this->containsTable(tblName)) {
|
||
|
r = this->tables.value(tblName)->containsColumn(colName);
|
||
|
}
|
||
|
return r;
|
||
|
}
|
||
|
|
||
|
QSharedPointer<TableSchema> Schema::getTableSchema(QString name, bool refresh) {
|
||
|
if (this->tables.contains(name) && !refresh) {
|
||
|
return this->tables.value(name);
|
||
| ... | ... | |
|
return queryBuilder;
|
||
|
}
|
||
|
|
||
|
QSharedPointer<QHash<QString, QString> > Schema::getAbstractTypeMap() const {
|
||
|
QSharedPointer<QHash<QString, QString>> Schema::getAbstractTypeMap() const {
|
||
|
return abstractTypeMap;
|
||
|
}
|
||
|
|
||
|
void Schema::setAbstractTypeMap(const QSharedPointer<QHash<QString, QString> >
|
||
|
void Schema::setAbstractTypeMap(const QSharedPointer<QHash<QString, QString>>
|
||
|
&value) {
|
||
|
abstractTypeMap = value;
|
||
|
}
|
||
| ... | ... | |
|
}
|
||
|
|
||
|
|
||
|
QHash<QString, QSharedPointer<TableSchema> > Schema::getTables() {
|
||
|
QHash<QString, QSharedPointer<TableSchema>> Schema::getTables() {
|
||
|
if (this->tables.size() != this->getTableNames().size()) {
|
||
|
this->setTables(this->getTableSchemas());
|
||
|
}
|
||
|
return this->tables;
|
||
|
}
|
||
|
|
||
|
void Schema::setTables(const QHash<QString, QSharedPointer<TableSchema> >
|
||
|
void Schema::setTables(const QHash<QString, QSharedPointer<TableSchema>>
|
||
|
&value) {
|
||
|
tables = value;
|
||
|
}
|
||
Auch abrufbar als: Unified diff
included license texts, completed for new query builder test