diff options
| author | 2017-02-09 04:36:04 -0500 | |
|---|---|---|
| committer | 2017-02-09 04:36:04 -0500 | |
| commit | d9aa870e5d509cc7309ab82dd102a937ab58613a (patch) | |
| tree | d92d03d76b5c390b335f1cfd761f1a0b59ec8496 /Plugins/SqlEnterpriseFormatter | |
| parent | 68ee4cbcbe424b95969c70346283a9f217f63825 (diff) | |
Imported Upstream version 3.1.1+dfsg1upstream/3.1.1+dfsg1
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter')
18 files changed, 73 insertions, 43 deletions
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter.pro b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter.pro index 5af5bfa..2d5b88c 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter.pro +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter.pro @@ -100,10 +100,10 @@ RESOURCES += \ sqlenterpriseformatter.qrc -TRANSLATIONS += SqlEnterpriseFormatter_it.ts \ +TRANSLATIONS += SqlEnterpriseFormatter_de.ts \ + SqlEnterpriseFormatter_it.ts \ SqlEnterpriseFormatter_zh_CN.ts \ SqlEnterpriseFormatter_sk.ts \ - SqlEnterpriseFormatter_de.ts \ SqlEnterpriseFormatter_ru.ts \ SqlEnterpriseFormatter_pt_BR.ts \ SqlEnterpriseFormatter_fr.ts \ @@ -122,3 +122,5 @@ TRANSLATIONS += SqlEnterpriseFormatter_it.ts \ + + diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_de.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_de.ts index b391360..10e3b39 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_de.ts +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_de.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0" language="de_DE"> +<TS version="2.1" language="de_DE"> <context> <name>QObject</name> <message> diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_es.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_es.ts index 4910c3f..cd19bf1 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_es.ts +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_es.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0" language="es_ES"> +<TS version="2.1" language="es_ES"> <context> <name>QObject</name> <message> diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.qm b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.qm Binary files differindex 6e8f481..40423d9 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.qm +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.qm diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.ts index 6e90f84..5468163 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.ts +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.ts @@ -21,17 +21,17 @@ <message> <location filename="sqlenterpriseformatter.ui" line="58"/> <source>Line up keywords in multi-line queries</source> - <translation>Ligne de most clé en majuscule dans une requête multiligne</translation> + <translation>Ligne de mots-clefs en majuscule dans une requête multiligne</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="68"/> <source>Indent contents of parenthesis block</source> - <translation>Indenté le contenu du block entre parenthèses</translation> + <translation>Indenter le contenu du bloc entre parenthèses</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="91"/> <source>Tab size:</source> - <translation>Dimension Tab:</translation> + <translation>taille d’indentation :</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="106"/> @@ -41,12 +41,12 @@ <message> <location filename="sqlenterpriseformatter.ui" line="160"/> <source>Before opening parenthesis in column definitions</source> - <translation>Avant l’ouverture des parenthèses dans la définition de la colonne</translation> + <translation>Avant l’ouverture des parenthèses dans la définition de la colonne</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="170"/> <source>After opening parenthesis in column definitions</source> - <translation>Après l’ouverture des parenthèses dans la définition de la colonne</translation> + <translation>Après l’ouverture des parenthèses dans la définition de la colonne</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="180"/> @@ -61,27 +61,27 @@ <message> <location filename="sqlenterpriseformatter.ui" line="200"/> <source>Before opening parenthesis in expressions</source> - <translation>Avant l’ouverture des parenthèses dans l’expression</translation> + <translation>Avant l’ouverture des parenthèses dans l’expression</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="210"/> <source>After opening parenthesis in expressions</source> - <translation>Après l’ouverture des parenthèses dans l’expression</translation> + <translation>Après l’ouverture des parenthèses dans l’expression</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="220"/> <source>Before closing parenthesis in expressions</source> - <translation>Avant la fermeture des parenthèses dans l’expression</translation> + <translation>Avant la fermeture des parenthèses dans l’expression</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="230"/> <source>After closing parenthesis in expressions</source> - <translation>Après la fermeture des parenthèses dans l’expression</translation> + <translation>Après la fermeture des parenthèses dans l’expression</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="240"/> <source>After JOIN keywords in FROM clause</source> - <translation>Après le mot clé JOIN dans la clause FROM</translation> + <translation>Après le mot-clef JOIN dans la clause FROM</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="250"/> @@ -96,7 +96,7 @@ <message> <location filename="sqlenterpriseformatter.ui" line="270"/> <source>After comma in expressions</source> - <translation>Après la virgule dans l’exoression</translation> + <translation>Après la virgule dans l’exoression</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="280"/> @@ -127,12 +127,12 @@ <message> <location filename="sqlenterpriseformatter.ui" line="412"/> <source>Before opening parenthesis</source> - <translation>Avant l’ouverture des parenthèses</translation> + <translation>Avant l’ouverture des parenthèses</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="422"/> <source>After opening parenthesis</source> - <translation>Après l’ouverture des parenthèses</translation> + <translation>Après l’ouverture des parenthèses</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="432"/> @@ -147,7 +147,7 @@ <message> <location filename="sqlenterpriseformatter.ui" line="452"/> <source>No space between SQL function name and opening parenthesis</source> - <translation>aucun espance entre le nom de la fonction SQL et l’ouverture des paranthèses</translation> + <translation>aucun espance entre le nom de la fonction SQL et l’ouverture des paranthèses</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="462"/> @@ -182,12 +182,12 @@ <message> <location filename="sqlenterpriseformatter.ui" line="583"/> <source>Preferred name wrapper</source> - <translation>Preferred name wrapper</translation> + <translation>Échappement préféré</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="600"/> <source>Always use name wrapping</source> - <translation>Always use name wrapping</translation> + <translation>Toujours échapper les identifiants</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="610"/> @@ -197,12 +197,12 @@ <message> <location filename="sqlenterpriseformatter.ui" line="620"/> <source>Uppercase keywords</source> - <translation>Mots clé en majuscule</translation> + <translation>Mots-clefs en majuscule</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="631"/> <source>Comments</source> - <translation type="unfinished"></translation> + <translation>Commentaires</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="637"/> @@ -210,19 +210,14 @@ <translation type="unfinished"></translation> </message> <message> - <location filename="sqlenterpriseformatter.ui" line="647"/> - <source>SqlEnterpriseFormatter.CommentMarkers</source> - <translation type="unfinished"></translation> - </message> - <message> <location filename="sqlenterpriseformatter.ui" line="654"/> <source>Move all comments to the line end</source> - <translation type="unfinished"></translation> + <translation>Déplacer tous les commentaires en fin de ligne</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="664"/> <source>Line up comments at the line end</source> - <translation type="unfinished"></translation> + <translation>Alignez les commentaires en fin de ligne</translation> </message> <message> <location filename="sqlenterpriseformatter.ui" line="695"/> diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_it.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_it.ts index 93a7ba6..d37b3a0 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_it.ts +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_it.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0" language="it_IT"> +<TS version="2.1" language="it_IT"> <context> <name>QObject</name> <message> diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.qm b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.qm Binary files differindex ea184fe..7c215a2 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.qm +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.qm diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.ts index f85f8f0..0acec1b 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.ts +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0" language="pl_PL"> +<TS version="2.1" language="pl_PL"> <context> <name>QObject</name> <message> diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pt_BR.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pt_BR.ts index 920e9cc..5dcd199 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pt_BR.ts +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pt_BR.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0" language="pt_BR"> +<TS version="2.1" language="pt_BR"> <context> <name>QObject</name> <message> diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_ru.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_ru.ts index 9436651..8e942c9 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_ru.ts +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_ru.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0" language="ru_RU"> +<TS version="2.1" language="ru_RU"> <context> <name>QObject</name> <message> diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_sk.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_sk.ts index ff7f588..9d78cfc 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_sk.ts +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_sk.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0" language="sk_SK"> +<TS version="2.1" language="sk_SK"> <context> <name>QObject</name> <message> diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_zh_CN.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_zh_CN.ts index 0405ee5..ad44b3c 100644 --- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_zh_CN.ts +++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_zh_CN.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0" language="zh_CN"> +<TS version="2.1" language="zh_CN"> <context> <name>QObject</name> <message> diff --git a/Plugins/SqlEnterpriseFormatter/formatcreatetrigger.cpp b/Plugins/SqlEnterpriseFormatter/formatcreatetrigger.cpp index 6eb8b21..ee45541 100644 --- a/Plugins/SqlEnterpriseFormatter/formatcreatetrigger.cpp +++ b/Plugins/SqlEnterpriseFormatter/formatcreatetrigger.cpp @@ -107,7 +107,7 @@ void FormatCreateTriggerEvent::formatInternal() withLinedUpKeyword("DELETE", TRIGGER_MARK); break; case SqliteCreateTrigger::Event::UPDATE_OF: - withLinedUpKeyword("UPDATE OF", TRIGGER_MARK).withIdList(ev->columnNames); + withLinedUpKeyword("UPDATE OF", TRIGGER_MARK).withIdList(ev->columnNames, "updateOfCols"); break; case SqliteCreateTrigger::Event::null: break; diff --git a/Plugins/SqlEnterpriseFormatter/formatexpr.cpp b/Plugins/SqlEnterpriseFormatter/formatexpr.cpp index b1a36b5..e79995f 100644 --- a/Plugins/SqlEnterpriseFormatter/formatexpr.cpp +++ b/Plugins/SqlEnterpriseFormatter/formatexpr.cpp @@ -6,6 +6,8 @@ #include "parser/ast/sqliteraise.h" #include "sqlenterpriseformatter.h" +QRegularExpression FormatExpr::WORD_ONLY_RE = QRegularExpression("^[a-zA-Z]+$"); + FormatExpr::FormatExpr(SqliteExpr* expr) : expr(expr) { @@ -51,7 +53,11 @@ void FormatExpr::formatInternal() { // Operator can be a keyword QString opStr = cfg->SqlEnterpriseFormatter.UppercaseKeywords.get() ? expr->unaryOp.toUpper() : expr->unaryOp.toLower(); - withOperator(opStr, FormatToken::Flag::NO_SPACE_BEFORE|FormatToken::Flag::NO_SPACE_AFTER); + if (WORD_ONLY_RE.match(opStr).hasMatch()) + withKeyword(opStr); + else + withOperator(opStr, FormatToken::Flag::NO_SPACE_AFTER); + withStatement(expr->expr1, "unaryOp"); break; } @@ -148,6 +154,11 @@ void FormatExpr::formatInternal() withKeyword("BETWEEN").withStatement(expr->expr2, "between1").withKeyword("AND").withStatement(expr->expr3, "between2"); break; } + case SqliteExpr::Mode::ROW_VALUE: + { + withParExprLeft().withStatementList(expr->exprList, FormatToken::Flag::NO_NEWLINE_AFTER).withParExprRight(); + break; + } case SqliteExpr::Mode::IN: { withStatement(expr->expr1); @@ -183,22 +194,34 @@ void FormatExpr::formatInternal() withStatement(expr->expr1, "case"); bool then = false; - foreach (SqliteExpr* expr, expr->exprList) + for (SqliteExpr* innerExpr : expr->exprList) { if (then) withKeyword("THEN"); else withKeyword("WHEN"); - withIncrIndent("case"); - withStatement(expr); + if (expr->expr1) + withIncrIndent("case"); + else + withIncrIndent(); + + withStatement(innerExpr); withDecrIndent(); then = !then; } if (expr->expr2) - withKeyword("ELSE").withIncrIndent("case").withStatement(expr->expr2).withDecrIndent(); + { + withKeyword("ELSE"); + if (expr->expr1) + withIncrIndent("case"); + else + withIncrIndent(); + + withStatement(expr->expr2).withDecrIndent(); + } withKeyword("END"); break; diff --git a/Plugins/SqlEnterpriseFormatter/formatexpr.h b/Plugins/SqlEnterpriseFormatter/formatexpr.h index 2712adc..bafe442 100644 --- a/Plugins/SqlEnterpriseFormatter/formatexpr.h +++ b/Plugins/SqlEnterpriseFormatter/formatexpr.h @@ -1,8 +1,10 @@ #ifndef FORMATEXPR_H #define FORMATEXPR_H +#include <QRegularExpression> #include "formatstatement.h" + class SqliteExpr; class FormatExpr : public FormatStatement @@ -14,6 +16,8 @@ class FormatExpr : public FormatStatement void formatInternal(); private: + static QRegularExpression WORD_ONLY_RE; + SqliteExpr* expr = nullptr; }; diff --git a/Plugins/SqlEnterpriseFormatter/formatstatement.cpp b/Plugins/SqlEnterpriseFormatter/formatstatement.cpp index 9702d32..2faaa16 100644 --- a/Plugins/SqlEnterpriseFormatter/formatstatement.cpp +++ b/Plugins/SqlEnterpriseFormatter/formatstatement.cpp @@ -600,7 +600,7 @@ QString FormatStatement::detokenize() case FormatToken::FLOAT: { applyIndent(); - line += doubleToString(token->value.toDouble()); + line += doubleToString(token->value); break; } case FormatToken::OPERATOR: diff --git a/Plugins/SqlEnterpriseFormatter/formatstatement.h b/Plugins/SqlEnterpriseFormatter/formatstatement.h index 427efe9..171b2a2 100644 --- a/Plugins/SqlEnterpriseFormatter/formatstatement.h +++ b/Plugins/SqlEnterpriseFormatter/formatstatement.h @@ -139,7 +139,7 @@ class FormatStatement markAndKeepIndent(indentName); bool first = true; - foreach (T* stmt, stmtList) + for (T* stmt : stmtList) { if (!first) withSeparator(sep, flags); diff --git a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.qrc b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.qrc index 00b290f..839720f 100644 --- a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.qrc +++ b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.qrc @@ -3,6 +3,9 @@ <file>sqlenterpriseformatter.ui</file> </qresource> <qresource prefix="/msg"> + <file>SqlEnterpriseFormatter_de.qm</file> + + <file>SqlEnterpriseFormatter_pl.qm</file> <file>SqlEnterpriseFormatter_ru.qm</file> <file>SqlEnterpriseFormatter_fr.qm</file> @@ -10,3 +13,6 @@ <file>SqlEnterpriseFormatter_zh_CN.qm</file> </qresource> </RCC> + + + |
