test dm char(36)

This commit is contained in:
28810
2020-08-20 22:31:39 +08:00
parent d74f5e3d0b
commit 1f8841e5e2
4 changed files with 60 additions and 167 deletions

View File

@ -3,6 +3,7 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Linq;
using System.Text;
using Xunit;
@ -11,6 +12,45 @@ namespace FreeSql.Tests.Dameng
{
public class DamengCodeFirstTest
{
[Fact]
public void StringLength36()
{
using (var conn = g.dameng.Ado.MasterPool.Get())
{
var cmd = conn.Value.CreateCommand();
cmd.CommandText = @"SELECT a.""ID"", a.""CREATORID""
FROM ""TS_SL361"" a
WHERE (a.""ID"" = 1) AND ROWNUM < 2";
using (var dr = cmd.ExecuteReader())
{
if (dr.Read())
{
var id1 = dr.GetInt64(0);
var creatorId1 = dr.GetString(1);
var id = dr.GetValue(0);
//var creatorId = dr.GetValue(1); //<2F><><EFBFBD><EFBFBD>
}
}
}
//var repo = g.dameng.GetRepository<TS_SL361, long>();
//var item1 = new TS_SL361 { CreatorId = "xxx '123 " };
//repo.Insert(item1);
//var item2 = repo.Get(item1.Id);
//Assert.Equal(item1.CreatorId, item2.CreatorId);
}
class TS_SL361
{
[Column(IsIdentity = true)]
public long Id { get; set; }
[Column(StringLength = 36)]
public string CreatorId { get; set; }
}
[Fact]
public void Text_StringLength_1()
{

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Xunit;
@ -12,6 +13,25 @@ namespace FreeSql.Tests.Oracle
{
public class OracleCodeFirstTest
{
[Fact]
public void StringLength36()
{
var repo = g.oracle.GetRepository<TS_SL361, long>();
var item1 = new TS_SL361 { CreatorId = "xxx '123 " };
repo.Insert(item1);
var item2 = repo.Get(item1.Id);
Assert.Equal(item1.CreatorId, item2.CreatorId);
}
class TS_SL361
{
[Column(IsIdentity = true)]
public long Id { get; set; }
[Column(StringLength = 36)]
public string CreatorId { get; set; }
}
[Fact]
public void NClob_StringLength_1()
{