diff options
| author | 2021-12-17 07:06:30 -0500 | |
|---|---|---|
| committer | 2021-12-17 07:06:30 -0500 | |
| commit | 1fdc150116cad39aae5c5da407c3312b47a59e3a (patch) | |
| tree | 123c79a4d7ad2d45781ba03ce939f7539fb428d8 /SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h | |
| parent | feda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (diff) | |
New upstream version 3.3.3+dfsg1.upstream/3.3.3+dfsg1
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h index 9ccfaa3..c5ec197 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h +++ b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h @@ -4,7 +4,6 @@ #include "token.h" #include "ast/sqliteconflictalgo.h" #include "ast/sqlitesortorder.h" -#include "dialect.h" class SqliteStatement; @@ -33,10 +32,10 @@ class SqliteStatement; * if (ifNotExists) * builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace(); * - * if (dialect == Dialect::Sqlite3 && !database.isNull()) - * builder.withOther(database, dialect).withOperator("."); + * if (!database.isNull()) + * builder.withOther(database).withOperator("."); * - * builder.withOther(view, dialect).withSpace().withKeyword("AS").withStatement(select); + * builder.withOther(view).withSpace().withKeyword("AS").withStatement(select); * * return builder.build(); * } @@ -66,31 +65,29 @@ class StatementTokenBuilder /** * @brief Adds "other" token (some object name, or other word). * @param value Value for the token. - * @param dialect Dialect used for wrapping the value. + * @param wrapIfNeeded Defined whether the value should be wrapped if identified to require wrapping (i.e. is a keyword, or multiword). * @return Reference to the builder for the further building. * - * The \p value is wrapped with the proper wrapper using wrapObjIfNeeded(). - * - * @overload + * This is used for table names, etc. The \p value is quoted just as passed. + * You may want to pass wrapIfNeeded=false if you know that this may be equal to keyword, + * that is allowed as ID too (Lemon's fallback to ID). */ - StatementTokenBuilder& withOther(const QString& value, Dialect dialect); + StatementTokenBuilder& withOther(const QString& value, bool wrapIfNeeded); /** * @brief Adds string using double-quote wrapping. * @param value Value for the token. - * @param dialect Dialect used for wrapping the value if double-quote could not be used. * @return Reference to the builder for the further building. * * The \p value is wrapped with double quote, but if it's not possible then the proper wrapper is used by wrapObjIfNeeded(). * * @overload */ - StatementTokenBuilder& withStringPossiblyOther(const QString& value, Dialect dialect); + StatementTokenBuilder& withStringPossiblyOther(const QString& value); /** * @brief Adds list of "other" tokens. * @param value List of values for tokens. - * @param dialect Dialect used for wrapping values. * @param separator Optional value for separator tokens. * @return Reference to the builder for the further building. * @@ -98,18 +95,6 @@ class StatementTokenBuilder * token between all produced tokens using the \p separator value. To skip separator tokens pass * an empty string as the separator value. */ - StatementTokenBuilder& withOtherList(const QList<QString>& value, Dialect dialect, const QString& separator = ","); - - /** - * @brief Adds list of "other" tokens. - * @param value List of values for tokens. - * @param separator Optional value for separator tokens. - * @return Reference to the builder for the further building. - * - * Works just like the other withOtherList() method, except it doesn't wrap values with wrapObjIfNeeded(). - * - * @overload - */ StatementTokenBuilder& withOtherList(const QList<QString>& value, const QString& separator = ","); /** |
