当前位置: 首页>>代码示例>>C#>>正文


C# SQL.ToString方法代码示例

本文整理汇总了C#中SQL.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SQL.ToString方法的具体用法?C# SQL.ToString怎么用?C# SQL.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQL的用法示例。


在下文中一共展示了SQL.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_Return_Simple_Delete_From_Table

        public void Should_Return_Simple_Delete_From_Table()
        {
            var expected = "DELETE FROM table";
            var sql = new SQL();
            sql.Delete().From("table");

            Assert.AreEqual(expected, sql.ToString());
        }
开发者ID:seymourpoler,项目名称:PetProjects,代码行数:8,代码来源:Squel.Delete.Test.cs

示例2: Should_Return_Update_On_One_Field_From_One_Table_With_Where

        public void Should_Return_Update_On_One_Field_From_One_Table_With_Where()
        {
            var expected = "UPDATE table SET f = ? WHERE (FieldOne = ValueOne)";

            var sql = new SQL();
            sql.Update().Table("table").Set("f", "?").Where("FieldOne = ValueOne");

            Assert.AreEqual(expected, sql.ToString());
        }
开发者ID:seymourpoler,项目名称:PetProjects,代码行数:9,代码来源:Squel.Update.Test.cs

示例3: Should_Return_Update_On_One_Field_From_One_Table

        public void Should_Return_Update_On_One_Field_From_One_Table()
        {
            var expected = "UPDATE table SET f = ?";

            var sql = new SQL();
            sql.Update().Table("table").Set("f","?");

            Assert.AreEqual(expected, sql.ToString());
        }
开发者ID:seymourpoler,项目名称:PetProjects,代码行数:9,代码来源:Squel.Update.Test.cs

示例4: Should_Return_Simple_Delete_From_Table_With_Some_Where

        public void Should_Return_Simple_Delete_From_Table_With_Some_Where()
        {
            var expected = "DELETE FROM students WHERE (id > 5) AND (id < 102)";
            var sql = new SQL();
            sql.Delete()
                .From("students")
                .Where("id > 5")
                .Where("id < 102");

            Assert.AreEqual(expected, sql.ToString());
        }
开发者ID:seymourpoler,项目名称:PetProjects,代码行数:11,代码来源:Squel.Delete.Test.cs

示例5: Should_Return_Insert_In_One_Table

        public void Should_Return_Insert_In_One_Table()
        {
            var expected = "INSERT INTO students (name) VALUES (Thomas)";

            var sql = new SQL();
            sql.Insert()
                .Into("students")
                .Set("name", "Thomas");

            Assert.AreEqual(expected, sql.ToString());
        }
开发者ID:seymourpoler,项目名称:PetProjects,代码行数:11,代码来源:Squel.Insert.Test.cs

示例6: Should_Return_Update_With_Some_Set_From_One_Table_With_NULL

        public void Should_Return_Update_With_Some_Set_From_One_Table_With_NULL()
        {
            var expected = "UPDATE students SET name = 'Fred', age = 29, score = 1.2, nichname = NULL";

            var sql = new SQL();
            sql.Update()
                .Table("students")
                .Set("name", "'Fred'")
                .Set("age", 29)
                .Set("score", 1.2)
                .Set("nichname", null);

            Assert.AreEqual(expected, sql.ToString());
        }
开发者ID:seymourpoler,项目名称:PetProjects,代码行数:14,代码来源:Squel.Update.Test.cs

示例7: Should_Return_Insert_With_Some_Sets_From_One_Table

        public void Should_Return_Insert_With_Some_Sets_From_One_Table()
        {
            var expected = "INSERT INTO students (name, age, score, graduate, nickname) VALUES (Thomas, 29, 90.2, True, NULL)";

            var sql = new SQL();
            sql.Insert()
                .Into("students")
                .Set("name", "Thomas")
                .Set("age", 29)
                .Set("score", 90.2)
                .Set("graduate", true)
                .Set("nickname", null);

            Assert.AreEqual(expected, sql.ToString());
        }
开发者ID:seymourpoler,项目名称:PetProjects,代码行数:15,代码来源:Squel.Insert.Test.cs

示例8: Should_Return_Complex_Expression

        public void Should_Return_Complex_Expression()
        {
            var expected = "id < 500 AND (id > 100 OR name <> 'Thomas') AND (age BETWEEN 20 AND 25 OR name <> 'Fred') OR nickname = 'Hardy'";
            var sql = new SQL();
            sql.Expr()
                .And("id < 500")
                .AndBegin()
                    .Or("id > 100")
                    .Or("name <> 'Thomas'")
                .End()
                .AndBegin()
                    .Or("age BETWEEN 20 AND 25")
                    .Or("name <> 'Fred'")
                .End()
                .Or("nickname = 'Hardy'");

            Assert.AreEqual(expected, sql.ToString());
        }
开发者ID:seymourpoler,项目名称:PetProjects,代码行数:18,代码来源:ConditionSentence.Test.cs

示例9: SerializeLogicalOperator

        public virtual string SerializeLogicalOperator(SQL.LogicalOperator eLogicalOperator)
        {
            string strLogicalOperator;

            if (eLogicalOperator == LogicalOperator.And)
                strLogicalOperator = "AND";
            else if (eLogicalOperator == LogicalOperator.Or)
                strLogicalOperator = "OR";
            else
                throw new NotSupportedException(eLogicalOperator.ToString());

            return strLogicalOperator;
        }
开发者ID:erdincay,项目名称:DatabaseObjects,代码行数:13,代码来源:Serializer.cs

示例10: SerializeAggregateFunction

 public virtual string SerializeAggregateFunction(SQL.AggregateFunction aggregate)
 {
     switch (aggregate)
     {
         case AggregateFunction.Average:
             return "AVG";
         case AggregateFunction.Count:
             return "COUNT";
         case AggregateFunction.Sum:
             return "SUM";
         case AggregateFunction.Minimum:
             return "MIN";
         case AggregateFunction.Maximum:
             return "MAX";
         case AggregateFunction.StandardDeviation:
             return "STDEV";
         case AggregateFunction.Variance:
             return "VAR";
         default:
             throw new NotSupportedException(aggregate.ToString());
     }
 }
开发者ID:erdincay,项目名称:DatabaseObjects,代码行数:22,代码来源:Serializer.cs

示例11: SerializeDataType

 public virtual string SerializeDataType(SQL.DataType dataType, int intSize, int intPrecision, int intScale)
 {
     throw new NotImplementedException("Data type " + dataType.ToString() + " is not implemented for " + this.GetType().Name);
 }
开发者ID:erdincay,项目名称:DatabaseObjects,代码行数:4,代码来源:Serializer.cs

示例12: SerializeComparisonOperator

 public virtual string SerializeComparisonOperator(SQL.ComparisonOperator compare)
 {
     switch (compare)
     {
         case ComparisonOperator.EqualTo:
             return "=";
         case ComparisonOperator.NotEqualTo:
             return "<>";
         case ComparisonOperator.LessThan:
             return "<";
         case ComparisonOperator.LessThanOrEqualTo:
             return "<=";
         case ComparisonOperator.GreaterThan:
             return ">";
         case ComparisonOperator.GreaterThanOrEqualTo:
             return ">=";
         case ComparisonOperator.Like:
             return "LIKE";
         case ComparisonOperator.NotLike:
             return "NOT LIKE";
         default:
             throw new NotSupportedException(compare.ToString());
     }
 }
开发者ID:erdincay,项目名称:DatabaseObjects,代码行数:24,代码来源:Serializer.cs

示例13: SerializeBitwiseOperator

 public virtual string SerializeBitwiseOperator(SQL.BitwiseOperator eOperator)
 {
     if (eOperator == BitwiseOperator.And)
         return "&";
     else if (eOperator == BitwiseOperator.Or)
         return "|";
     else
         throw new NotSupportedException(eOperator.ToString());
 }
开发者ID:erdincay,项目名称:DatabaseObjects,代码行数:9,代码来源:Serializer.cs

示例14: SerializeArithmeticOperator

 public string SerializeArithmeticOperator(SQL.ArithmeticOperator @operator)
 {
     switch (@operator)
     {
         case ArithmeticOperator.Add:
             return "+";
         case ArithmeticOperator.Subtract:
             return "-";
         case ArithmeticOperator.Multiply:
             return "*";
         case ArithmeticOperator.Divide:
             return "/";
         case ArithmeticOperator.Modulus:
             return "%";
         default:
             throw new NotSupportedException(@operator.ToString());
     }
 }
开发者ID:erdincay,项目名称:DatabaseObjects,代码行数:18,代码来源:Serializer.cs

示例15: Insert

 /// <summary>
 /// ��ȡIP������Ӽ�¼
 /// </summary>
 /// <param name="ipSetting">��ȡIP����ʵ����</param>
 /// <param name="delCache">��ӳɹ��������CACHE key��֧������</param>
 /// <param name="dbkey">�������ݿ����ӳ��е�����key��Ϊ��ʱʹ��ConnString����</param>
 /// <returns>������ӳɹ����ID</returns>
 public static Int64 Insert(IpSetting ipSetting, string dbkey = "", string[] delCache = null)
 {
     object obj = new SQL().Database(dbkey).Insert(IpSetting._)
         .ValueP(IpSetting._IPCID, ipSetting.IPCID)
         .ValueP(IpSetting._WebName, ipSetting.WebName)
         .ValueP(IpSetting._IPUrl, ipSetting.IPUrl)
         .ValueP(IpSetting._IPRegex, ipSetting.IPRegex)
         .ValueP(IpSetting._DataEncode, ipSetting.DataEncode)
         .ToExec();
     if (obj.ToInt() != 1) return 0;
     obj = new SQL().Database(dbkey).From(IpSetting._).Max("IPCID").ToScalar();
     if (obj.IsAllNull()) return 0;
     Int64 value = obj.ToString().ToBigInt();
     if (delCache.IsNull()) return value;
     Cache2.Remove("TH.Mailer.IpSettingCache_", delCache);
     return value;
 }
开发者ID:jango2015,项目名称:SendEmail,代码行数:24,代码来源:IpSettingHelper.cs


注:本文中的SQL.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。