Browse Source

Update PgSql

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
9bb16d27e8
  1. 2
      Src/Asp.Net/PgSqlTest/Demo/Demo6_Queue.cs
  2. 4
      Src/Asp.Net/PgSqlTest/UnitTest/UAdo.cs
  3. 2
      Src/Asp.Net/PgSqlTest/UnitTest/UCodeFirst.cs
  4. 4
      Src/Asp.Net/PgSqlTest/UnitTest/UJson.cs
  5. 6
      Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs

2
Src/Asp.Net/PgSqlTest/Demo/Demo6_Queue.cs

@ -43,7 +43,7 @@ namespace OrmTest
db.Queryable<Order>().AddQueue();
db.Queryable<Order>().AddQueue();
db.AddQueue("select * from [Order] where id=@id", new { id = 10000 });
db.AddQueue("select * from \"order\" where id=@id", new { id = 10000 });
var result2 = db.SaveQueues<Order, Order, Order>();
Console.WriteLine("#### Queue End ####");

4
Src/Asp.Net/PgSqlTest/UnitTest/UAdo.cs

@ -48,9 +48,9 @@ namespace OrmTest
task8.Wait();
UValidate.Check(8, task8.Result[0].id, "ado");
var task9=Db.Ado.SqlQuery<Order, OrderItem>("select * from [order];select * from OrderDetail");
var task9=Db.Ado.SqlQuery<Order, OrderItem>("select * from \"order\";select * from OrderDetail");
var task10 = Db.Ado.SqlQueryAsync<Order, OrderItem>("select * from [order];select * from OrderDetail");
var task10 = Db.Ado.SqlQueryAsync<Order, OrderItem>("select * from \"order\";select * from OrderDetail");
task10.Wait();
}
}

2
Src/Asp.Net/PgSqlTest/UnitTest/UCodeFirst.cs

@ -18,7 +18,7 @@ namespace OrmTest
{
[SqlSugar.SugarColumn(IndexGroupNameList = new string[] { "group1" })]
public int Id { get; set; }
[SqlSugar.SugarColumn(DefaultValue="getdate()", IndexGroupNameList =new string[] {"group1" } )]
[SqlSugar.SugarColumn(DefaultValue="now()", IndexGroupNameList =new string[] {"group1" } )]
public DateTime? CreateDate { get; set; }
}
}

4
Src/Asp.Net/PgSqlTest/UnitTest/UJson.cs

@ -16,7 +16,7 @@ namespace OrmTest
Db.Insertable(new JsonTest() { Order = new Order { Id = 1, Name = "order1" } }).ExecuteCommand();
var list = Db.Queryable<JsonTest>().ToList();
UValidate.Check("order1", list.First().Order.Name, "Json");
Db.Updateable(new JsonTest() { Id = 1, Order = new Order { Id = 2, Name = "order2" } }).ExecuteCommand();
var x=Db.Updateable(new JsonTest() { Id = Db.Queryable<JsonTest>().Max(it => it.Id), Order = new Order { Id = Db.Queryable<JsonTest>().Max(it=>it.Id), Name = "order2" } }).ExecuteCommand();
list= Db.Queryable<JsonTest>().ToList();
UValidate.Check("order2", list.First().Order.Name, "Json");
var list2 = Db.Queryable<JsonTest>().ToList();
@ -28,7 +28,7 @@ namespace OrmTest
{
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
[SqlSugar.SugarColumn(ColumnDataType = "varchar(max)", IsJson = true)]
[SqlSugar.SugarColumn(ColumnDataType = "varchar(4000)", IsJson = true)]
public Order Order { get; set; }
}
}

6
Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs

@ -220,21 +220,21 @@ namespace SqlSugar
{
get
{
return "";
return "CREATE INDEX Index_{0}_{2} ON {0} ({1})";
}
}
protected override string AddDefaultValueSql
{
get
{
return "";
return "ALTER TABLE {0} ALTER COLUMN {1} SET DEFAULT {2}";
}
}
protected override string IsAnyIndexSql
{
get
{
return "select count(*) from sys.indexes where name='{0}'";
return " SELECT count(1) FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace where relname = '{0}'";
}
}
#endregion

Loading…
Cancel
Save