Esempio n. 1
0
 /// <summary>
 /// Add one where clause sql statement.
 /// </summary>
 /// <param name="sql">One where clause sql statement</param>
 public void AddSql(string sql)
 {
     if (!string.IsNullOrEmpty(sql))
     {
         SqlWhereItem item = new SqlWhereItem();
         item.sql  = sql;
         item.type = 0; // invalid value
         this.items.Add(item);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Add one where clause sql statement.
 /// </summary>
 /// <param name="sql">One where clause sql statement</param>
 public void AddSql(string sql, string[] parameters)
 {
     if (!string.IsNullOrEmpty(sql))
     {
         SqlWhereItem item = new SqlWhereItem();
         item.sql        = sql;
         item.type       = 0; // invalid value
         item.Parameters = parameters;
         this.items.Add(item);
     }
 }
Esempio n. 3
0
            private void AddGeneric(string key, object value, string comparer, SqlDbType type)
            {
                switch (type)
                {
                case SqlDbType.BigInt:
                    if (value.GetType() == typeof(String))
                    {
                        long result;
                        if (!long.TryParse((string)value, out result))
                        {
                            throw new ExceptionEmptyQuery();
                        }
                    }
                    break;

                case SqlDbType.Int:
                case SqlDbType.SmallInt:
                case SqlDbType.TinyInt:
                    if (value.GetType() == typeof(String))
                    {
                        int result;
                        if (!int.TryParse((string)value, out result))
                        {
                            throw new ExceptionEmptyQuery();
                        }
                    }
                    break;
                }
                SqlWhereItem item = new SqlWhereItem();

                item.key     = key;
                item.compare = comparer;
                item.value   = value;
                item.type    = type;
                this.items.Add(item);
            }
Esempio n. 4
0
 public void Add(SqlWhereItem where)
 {
     items.Add(where);
 }