Ejemplo n.º 1
0
        public void ConfigureCommand(NpgsqlCommand command)
        {
            var mapping = _schema.MappingFor(_query).ToQueryableDocument();
            var sql     = "select (count(*) > 0) as result from " + mapping.Table.QualifiedName + " as d";

            var where = _schema.BuildWhereFragment(mapping, _query);
            sql       = sql.AppendWhere(@where, command);

            command.AppendQuery(sql);
        }
Ejemplo n.º 2
0
        public void ConfigureCommand(NpgsqlCommand command)
        {
            var mapping = _schema.MappingFor(_query.SourceType()).ToQueryableDocument();
            var locator = mapping.JsonLocator(_query.SelectClause.Selector);
            var field   = _operator.ToFormat(locator);

            var sql = $"select {field} from {mapping.Table.QualifiedName} as d";

            var @where = _schema.BuildWhereFragment(mapping, _query);

            sql = sql.AppendWhere(@where, command);

            command.AppendQuery(sql);
        }
Ejemplo n.º 3
0
        public void ConfigureCommand(NpgsqlCommand command)
        {
            var sql    = _selector.ToSelectClause(_mapping);
            var @where = _schema.BuildWhereFragment(_mapping, _query);

            sql = sql.AppendWhere(@where, command);

            var orderBy = _query.ToOrderClause(_mapping);

            if (orderBy.IsNotEmpty())
            {
                sql += orderBy;
            }

            sql += $" LIMIT {_rowLimit}";
            sql  = _query.AppendOffset(sql);

            command.AppendQuery(sql);
        }
Ejemplo n.º 4
0
        public static IWhereFragment BuildWhereFragment(this IDocumentSchema schema, QueryModel query)
        {
            var mapping = schema.MappingFor(query.SourceType()).ToQueryableDocument();

            return(schema.BuildWhereFragment(mapping, query));
        }