1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
#include "parser_helper_stubs.h"
#include "ast/sqlitecreatetable.h"
ParserStubAlias::ParserStubAlias(const QString &name, bool asKw)
{
this->name = name;
this->asKw = asKw;
}
ParserIndexedBy::ParserIndexedBy(const QString &name)
{
indexedBy = name;
}
ParserIndexedBy::ParserIndexedBy(bool notIndexed)
{
this->notIndexedKw = notIndexed;
}
ParserStubInsertOrReplace::ParserStubInsertOrReplace(bool replace)
{
this->replace = replace;
this->orConflict = SqliteConflictAlgo::null;
}
ParserStubInsertOrReplace::ParserStubInsertOrReplace(bool replace, SqliteConflictAlgo orConflict)
{
this->replace = replace;
this->orConflict = orConflict;
}
ParserStubExplain::ParserStubExplain(bool explain, bool queryPlan)
{
this->explain = explain;
this->queryPlan = queryPlan;
}
ParserDeferSubClause::ParserDeferSubClause(SqliteDeferrable deferrable, SqliteInitially initially)
{
this->initially = initially;
this->deferrable = deferrable;
}
ParserTermOrLiteral::ParserTermOrLiteral(const QString& name)
{
value = name;
nameMode = true;
}
ParserTermOrLiteral::ParserTermOrLiteral(const QVariant& literal)
{
value = literal;
}
QString ParserTermOrLiteral::toName() const
{
return value.toString();
}
QVariant ParserTermOrLiteral::toLiteral() const
{
return value;
}
bool ParserTermOrLiteral::isName() const
{
return !value.isNull() && value.type() == QVariant::String;
}
bool ParserTermOrLiteral::isLiteral() const
{
return !nameMode;
}
ParserStubCreateTableOption* parserStubFindCreateTableOption(const QList<ParserStubCreateTableOption*>& options, ParserStubCreateTableOption::Type type)
{
return findFirst<ParserStubCreateTableOption>(options, [type](auto opt) -> bool {return opt->type == type;});
}
ParserStubCreateTableOption::ParserStubCreateTableOption(Type type) :
type(type)
{
}
|