public void FillColumns(ColumnDisplay disp, string[] filterColumns, bool exactMatch) { m_disp = disp; m_initColumns = filterColumns; m_exactMatch = exactMatch; var set = new HashSetEx <string>(); if (filterColumns != null) { set.AddRange(filterColumns); } foreach (var col in disp) { var cs = (IColumnStructure)col.ValueTag; if (cs == null) { continue; } if (cs.DataType is DbTypeXml || cs.DataType is DbTypeBlob) { continue; } string colname = col.ValueRef.ToString(); checkedListBox1.Items.Add(colname, set.Contains(colname)); } chbExactMatch.Checked = exactMatch; }
internal string CreateSqlCondition(ColumnDisplay disp, ISqlDialect dialect, IDmlfHandler handler, bool includeUserInput) { if (disp != null) { m_lastColumnDisplay = disp; } if (TableData == null) { return(""); } List <string> conds = new List <string>(); if (includeUserInput && !Filter.IsEmpty()) { conds.Add("(" + Filter + ")"); } if (AdditionalCondition != null) { conds.Add("(" + AdditionalCondition.ToSql(dialect, handler) + ")"); } if (TableData.TabDataCaps.Filtering && !SearchText.IsEmpty()) { conds.Add(CreateSearchCondition(disp, dialect, handler)); } if (conds.Count == 0) { return(""); } return(String.Join(" AND ", conds.ToArray())); }
public ColumnDisplay GetColumnDisplay() { var res = new ColumnDisplay(); int index = 0; foreach (var col in Columns) { res.AddColumn(col, index); index++; } return(res); }
private string CreateSearchCondition(ColumnDisplay disp, ISqlDialect dialect, IDmlfHandler handler) { if (disp == null) { disp = m_lastColumnDisplay; } if (disp == null) { return("1=1"); } bool was = false; StringBuilder res = new StringBuilder(); //ITableStructure table = TableData.GetStructure(Perspective); var dda = dialect.CreateDataAdapter(); var spars = new FulltextSearchParams { ExactMatch = SearchExactMatch }; foreach (var col in disp) { var cs = (IColumnStructure)col.ValueTag; if (cs == null) { continue; } if (cs.DataType is DbTypeXml || cs.DataType is DbTypeBlob) { continue; } if (SearchColumns != null && Array.IndexOf(SearchColumns, col.ValueRef.ToString()) < 0) { continue; } if (was) { res.Append(" OR "); } res.Append(dda.GetFulltextSearchExpr(col.ValueRef.Expr.ToSql(dialect, handler), SearchText, spars)); //res.AppendFormat("{0} LIKE {1}", dialect.QuoteIdentifier(col.ColumnName), dialect.GetSqlLiteral("%" + SearchText + "%")); was = true; } if (!was) { res.Append("1=1"); } return("(" + res.ToString() + ")"); }