示例#1
0
        public SqlBuilder FilterA(string column, ProtocolParameter protocol)
        {
            if (protocol == null)
            {
                return(this);
            }

            if (protocol.Eq != null)
            {
                AppendFilter($@"{column} = {Param(protocol.Eq)}::character(51)");
            }

            if (protocol.Ne != null)
            {
                AppendFilter($@"{column} != {Param(protocol.Ne)}::character(51)");
            }

            if (protocol.In != null)
            {
                AppendFilter($@"{column} = ANY ({Param(protocol.In)})");
            }

            if (protocol.Ni != null && protocol.Ni.Count > 0)
            {
                AppendFilter($@"NOT ({column} = ANY ({Param(protocol.Ni)}))");
            }

            return(this);
        }
示例#2
0
文件: SqlBuilder.cs 项目: yepeek/tzkt
        public SqlBuilder FilterA(string column, ProtocolParameter protocol)
        {
            if (protocol == null)
            {
                return(this);
            }

            if (protocol.Eq != null)
            {
                AppendFilter($@"{column} = @p{Counter}::character(51)");
                Params.Add($"p{Counter++}", protocol.Eq);
            }

            if (protocol.Ne != null)
            {
                AppendFilter($@"{column} != @p{Counter}::character(51)");
                Params.Add($"p{Counter++}", protocol.Ne);
            }

            if (protocol.In != null)
            {
                AppendFilter($@"{column} = ANY (@p{Counter})");
                Params.Add($"p{Counter++}", protocol.In);
            }

            if (protocol.Ni != null && protocol.Ni.Count > 0)
            {
                AppendFilter($@"NOT ({column} = ANY (@p{Counter}))");
                Params.Add($"p{Counter++}", protocol.Ni);
            }

            return(this);
        }