Revision 12c34ebc
Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt
src/schema.cpp | ||
---|---|---|
abstractTypeMap = value;
|
||
}
|
||
|
||
QString Schema::buildColumnSchema(QString type, QString length, bool notNull,
|
||
QString defaultValue,
|
||
bool unique, QString checkConstraint) const {
|
||
return type + this->buildLengthString(length) + this->buildNotNullString(
|
||
notNull) + this->buildUniqueString(unique) + this->buildDefaultString(
|
||
defaultValue) + this->buildCheckString(checkConstraint);
|
||
}
|
||
|
||
QString Schema::buildLengthString(QString length) const {
|
||
return length.isEmpty() ? "" : "(" + length + ")";
|
||
}
|
||
|
||
QString Schema::buildNotNullString(bool notNull) const {
|
||
return notNull ? " NOT NULL" : "";
|
||
}
|
||
|
||
QString Schema::buildUniqueString(bool unique) const {
|
||
return unique ? " UNIQUE" : "";
|
||
}
|
||
|
||
QString Schema::buildDefaultString(QString def) const {
|
||
|
||
}
|
||
|
||
QString Schema::buildCheckString(QString check) const {
|
||
return check.isEmpty() ? "" : (" CHECK (" + check + ")");
|
||
}
|
||
|
||
|
||
QHash<QString, QSharedPointer<TableSchema> > Schema::getTables() const {
|
||
return this->tables;
|
src/schema.h | ||
---|---|---|
void setAbstractTypeMap(const QSharedPointer<QHash<QString, QString> > &value);
|
||
|
||
protected:
|
||
virtual QString buildColumnSchema(QString type, QString length, bool notNull = false, QString defaultValue = "",
|
||
bool unique = false, QString checkConstraint = "") const;
|
||
virtual QString buildLengthString(QString length) const;
|
||
virtual QString buildNotNullString(bool notNull) const;
|
||
virtual QString buildUniqueString(bool unique) const;
|
||
virtual QString buildDefaultString(QString def) const;
|
||
virtual QString buildCheckString(QString check) const;
|
||
|
||
|
||
|
||
virtual QStringList findTableNames(QString schema = "") = 0;
|
||
virtual QHash<QString, QStringList> findUniqueIndexes(const
|
||
QSharedPointer<TableSchema>
|
Auch abrufbar als: Unified diff
wip