public void Ctor_WithKeyword_SetsKeywordProperty() { var expected = "FOOBAR"; var keyword = new SqlKeyword(expected); Assert.Equal(expected, keyword.Keyword); }
/// <summary> /// Create SQL keyword /// </summary> public string CreateSqlKeyword(SqlKeyword keywordType) { switch (keywordType) { case SqlKeyword.ILike: return(" ILIKE "); case SqlKeyword.Like: return(" LIKE "); case SqlKeyword.Lower: return(" LOWER "); case SqlKeyword.Upper: return(" UPPER "); case SqlKeyword.False: return(" FALSE "); case SqlKeyword.True: return(" TRUE "); case SqlKeyword.CreateOrAlter: return("CREATE OR REPLACE "); case SqlKeyword.RefreshMaterializedView: return("REFRESH MATERIALIZED VIEW "); default: throw new NotImplementedException(); } }
public void ImplicitConversion_WithKeyword_SetsKeywordProperty() { var expected = "FOOBAR"; SqlKeyword keyword = expected; Assert.Equal(expected, keyword.Keyword); }
/// <summary> /// Create SQL keyword /// </summary> public string CreateSqlKeyword(SqlKeyword keywordType) { switch (keywordType) { case SqlKeyword.ILike: case SqlKeyword.Like: return(" LIKE "); case SqlKeyword.Lower: return(" LOWER "); case SqlKeyword.Upper: return(" UPPER "); default: throw new NotImplementedException(); } }
public virtual string Keyword(SqlKeyword keyword) { switch (keyword) { case SqlKeyword.Select: return("SELECT"); case SqlKeyword.As: return("AS"); case SqlKeyword.AllColumns: return("*"); case SqlKeyword.From: return("FROM"); case SqlKeyword.InnerJoin: return("INNER JOIN"); case SqlKeyword.LeftJoin: return("LEFT JOIN"); case SqlKeyword.On: return("ON"); case SqlKeyword.Where: return("WHERE"); case SqlKeyword.And: return("AND"); case SqlKeyword.Or: return("OR"); case SqlKeyword.Not: return("NOT"); case SqlKeyword.OrderBy: return("ORDER BY"); case SqlKeyword.GroupBy: return("GROUP BY"); case SqlKeyword.Having: return("HAVING"); case SqlKeyword.In: return("IN"); case SqlKeyword.Like: return("LIKE"); case SqlKeyword.SubString: return("SUBSTRING"); case SqlKeyword.Sum: return("SUM"); case SqlKeyword.Count: return("COUNT"); case SqlKeyword.Min: return("MIN"); case SqlKeyword.Max: return("MAX"); default: throw new ArgumentOutOfRangeException(nameof(keyword), keyword, null); } }