Esempio n. 1
0
 public Window Name(string name, string definition)
 {
     _components.Add(new StringComponent(name));
     _components.Add(new StringComponent(Constants.QueryComponents.AS));
     _components.Add(new StringComponent(definition));
     return(this);
 }
Esempio n. 2
0
        internal Compound(QueryComponents components, CompoundType type)
        {
            _components = components;
            switch (type)
            {
            case CompoundType.Union:
                _components.Add(new StringComponent(Constants.QueryComponents.UNION));
                break;

            case CompoundType.UnionAll:
                _components.Add(new StringComponent(Constants.QueryComponents.UNION));
                _components.Add(new StringComponent(Constants.QueryComponents.SELECT_ALL));
                break;

            case CompoundType.Intersects:
                _components.Add(new StringComponent(Constants.QueryComponents.INTERSECT));
                break;

            case CompoundType.Except:
                _components.Add(new StringComponent(Constants.QueryComponents.EXCEPT));
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Esempio n. 3
0
        public Values Begin(bool beginValues = true)
        {
            StringComponent values = new StringComponent(Constants.QueryComponents.VALUES);
            StringComponent comma  = new StringComponent(Constants.QueryComponents.COMMA);

            _components.Add(beginValues ? values : comma);
            _components.Add(new StringComponent(Constants.QueryComponents.PARENTHESIS_OPEN));
            return(this);
        }
Esempio n. 4
0
 public Insert Begin(InsertMode mode, ConflictMode?conflictMode = null)
 {
     if (conflictMode.HasValue)
     {
         _components.Add(new InsertComponent(conflictMode.Value));
         return(this);
     }
     _components.Add(new InsertComponent(mode));
     return(this);
 }
Esempio n. 5
0
 public On Column(string name)
 {
     _components.Add(new StringComponent(name));
     return(this);
 }
Esempio n. 6
0
 public Select Begin()
 {
     _components.Add(new StringComponent(Constants.QueryComponents.SELECT));
     return(this);
 }
Esempio n. 7
0
 public GroupBy Expression(string expression)
 {
     _components.Add(new StringComponent(expression));
     return(this);
 }
Esempio n. 8
0
 internal GroupBy(QueryComponents components)
 {
     _components = components;
     _components.Add(new StringComponent(Constants.QueryComponents.GROUP_BY));
 }
Esempio n. 9
0
 public Joins Left()
 {
     _components.Add(new StringComponent(Constants.QueryComponents.LEFT));
     return(this);
 }
Esempio n. 10
0
 internal OrderBy(QueryComponents components)
 {
     _components = components;
     _components.Add(new StringComponent(Constants.QueryComponents.ORDER_BY));
 }
Esempio n. 11
0
 public As Alias(string alias)
 {
     _components.Add(new StringComponent(alias));
     return(this);
 }
Esempio n. 12
0
 public Where Column(string columnName)
 {
     _components.Add(new StringComponent(columnName));
     return(this);
 }
Esempio n. 13
0
 internal Where(QueryComponents components)
 {
     _components = components;
     _components.Add(new StringComponent(Constants.QueryComponents.WHERE));
 }
Esempio n. 14
0
 public ForeignKeys Begin()
 {
     _components.Add(new StringComponent(Constants.QueryComponents.FOREIGN_KEY));
     return(this);
 }
Esempio n. 15
0
        public Table Begin(TableMode mode, bool isView = false)
        {
            switch (mode)
            {
            case TableMode.Create:
                StringComponent createTable = new StringComponent(Constants.QueryComponents.CREATE_TABLE);
                StringComponent createView  = new StringComponent(Constants.QueryComponents.CREATE_VIEW);
                _components.Add(isView ? createView : createTable);
                break;

            case TableMode.Alter:
                if (isView)
                {
                    throw new NotSupportedException("Sqlite error: Cannot alter a view");
                }
                _components.Add(new StringComponent(Constants.QueryComponents.ALTER_TABLE));
                break;

            case TableMode.Drop:
                StringComponent dropTable = new StringComponent(Constants.QueryComponents.DROP_TABLE);
                StringComponent dropView  = new StringComponent(Constants.QueryComponents.DROP_VIEW);
                _components.Add(isView ? dropView : dropTable);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
            return(this);
        }
Esempio n. 16
0
 internal Window(QueryComponents components)
 {
     _components = components;
     _components.Add(new StringComponent(Constants.QueryComponents.WINDOW));
 }
Esempio n. 17
0
 internal As(QueryComponents components)
 {
     _components = components;
     _components.Add(new StringComponent(Constants.QueryComponents.AS));
 }
Esempio n. 18
0
 public Columns Begin()
 {
     _components.Add(new StringComponent(Constants.QueryComponents.PARENTHESIS_OPEN));
     return(this);
 }
Esempio n. 19
0
 public Delete With()
 {
     _components.Add(new StringComponent(Constants.QueryComponents.WITH));
     return(this);
 }
Esempio n. 20
0
 internal Limit(QueryComponents components)
 {
     _components = components;
     _components.Add(new StringComponent(Constants.QueryComponents.LIMIT));
 }