- 修复 表达式 Not 位运算符解析错误;#340

This commit is contained in:
28810 2020-06-09 14:24:54 +08:00
parent b9948f4508
commit f4ffcfff7c
3 changed files with 6 additions and 0 deletions

View File

@ -306,6 +306,7 @@ namespace FreeSql.Tests.Dameng
[Fact] [Fact]
public void CurdAllField() public void CurdAllField()
{ {
g.dameng.Delete<TableAllType>().Where("1=1").ExecuteAffrows();
var item2 = new TableAllType var item2 = new TableAllType
{ {
Bool = true, Bool = true,

View File

@ -155,6 +155,10 @@ namespace FreeSql.Tests
[Fact] [Fact]
public void Test03() public void Test03()
{ {
var tttrule = 8;
var tttid = new long[] { 18, 19, 4017 };
g.sqlserver.Update<Author123>().Set(it => it.SongId == (short)(it.SongId & ~tttrule)).Where(it => (it.SongId & tttrule) == tttrule && !tttid.Contains(it.Id)).ExecuteAffrows();
g.sqlite.Delete<Song123>().Where("1=1").ExecuteAffrows(); g.sqlite.Delete<Song123>().Where("1=1").ExecuteAffrows();
g.sqlite.Delete<Author123>().Where("1=1").ExecuteAffrows(); g.sqlite.Delete<Author123>().Where("1=1").ExecuteAffrows();
g.sqlite.Insert(new Song123(1)).ExecuteAffrows(); g.sqlite.Insert(new Song123(1)).ExecuteAffrows();

View File

@ -580,6 +580,7 @@ namespace FreeSql.Internal
{ {
case ExpressionType.Not: case ExpressionType.Not:
var notExp = (exp as UnaryExpression)?.Operand; var notExp = (exp as UnaryExpression)?.Operand;
if (notExp.Type.IsNumberType()) return $"~{ExpressionLambdaToSql(notExp, tsc)}"; //位操作
if (notExp.NodeType == ExpressionType.MemberAccess) if (notExp.NodeType == ExpressionType.MemberAccess)
{ {
var notBody = ExpressionLambdaToSql(notExp, tsc); var notBody = ExpressionLambdaToSql(notExp, tsc);