2018-01-06 21:22:22 +01:00
|
|
|
|
#ifndef SQLFORMATTINGUTILS_H
|
|
|
|
|
|
#define SQLFORMATTINGUTILS_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
2018-01-09 20:39:43 +01:00
|
|
|
|
class PgClass;
|
2018-01-06 21:22:22 +01:00
|
|
|
|
class PgConstraint;
|
|
|
|
|
|
class PgDatabaseCatalog;
|
2018-04-08 09:04:38 +02:00
|
|
|
|
class PgIndex;
|
2018-01-06 21:22:22 +01:00
|
|
|
|
|
2018-11-18 19:30:45 +01:00
|
|
|
|
QString escapeIdent(const QString &input);
|
|
|
|
|
|
QString escapeLiteral(const QString &input);
|
|
|
|
|
|
|
2018-01-06 21:22:22 +01:00
|
|
|
|
bool identNeedsQuotes(QString ident);
|
2018-02-05 21:42:54 +01:00
|
|
|
|
QString quoteIdent(QString ident);
|
2018-11-25 09:06:01 +01:00
|
|
|
|
/// Puts a string in dollar quote for passing in a query
|
|
|
|
|
|
/// the standard quotes are $BODY$ if the tag already exists in the string it will start numbering
|
|
|
|
|
|
QString dollarQuoteString(const QString &value);
|
|
|
|
|
|
|
2018-01-06 21:22:22 +01:00
|
|
|
|
|
2018-01-09 20:39:43 +01:00
|
|
|
|
QString genFQTableName(const PgDatabaseCatalog &catalog, const PgClass &cls);
|
2018-01-06 21:22:22 +01:00
|
|
|
|
QString getDropConstraintDefinition(const PgDatabaseCatalog &catalog, const PgConstraint &constraint);
|
|
|
|
|
|
QString getConstraintDefinition(const PgDatabaseCatalog &catalog, const PgConstraint &constraint);
|
2018-04-08 09:04:38 +02:00
|
|
|
|
QString getIndexDefinition(const PgDatabaseCatalog &catalog, const PgIndex &index);
|
2018-08-05 11:27:05 +02:00
|
|
|
|
QString getDropIndexDefinition(const PgDatabaseCatalog &catalog, const PgIndex &index);
|
2018-11-10 13:36:36 +01:00
|
|
|
|
/// Returns the foreignKey specific part of the constraint definition
|
2018-01-06 21:22:22 +01:00
|
|
|
|
QString getForeignKeyConstraintDefinition(const PgDatabaseCatalog &catalog, const PgConstraint &constraint);
|
2018-11-10 13:36:36 +01:00
|
|
|
|
/// Returns the REFERENCES construct as used directly after a column in the create table statement
|
|
|
|
|
|
QString getForeignKeyConstraintReferences(const PgDatabaseCatalog &catalog, const PgConstraint &constraint);
|
|
|
|
|
|
/// Same as above but shortened as much as possible by leaving out defaults
|
|
|
|
|
|
QString getForeignKeyConstraintReferencesShort(const PgDatabaseCatalog &catalog, const PgConstraint &constraint);
|
2018-01-06 21:22:22 +01:00
|
|
|
|
|
|
|
|
|
|
#endif // SQLFORMATTINGUTILS_H
|