mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 10:45:08 +08:00
Update Sqlite Core
This commit is contained in:
@@ -106,7 +106,14 @@ namespace SqlSugar
|
||||
var mappInfo = mappingColumns.SingleOrDefault(it => it.EntityName == type.Name && it.PropertyName.Equals(propertyInfo.Name));
|
||||
if (mappInfo != null)
|
||||
{
|
||||
fileName = mappInfo.DbColumnName;
|
||||
if (!ReaderKeys.Contains(mappInfo.DbColumnName))
|
||||
{
|
||||
fileName = ReaderKeys.Single(it => it.Equals(mappInfo.DbColumnName, StringComparison.CurrentCultureIgnoreCase));
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = mappInfo.DbColumnName;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Context.IgnoreColumns != null && Context.IgnoreColumns.Any(it => it.PropertyName.Equals(propertyInfo.Name, StringComparison.CurrentCultureIgnoreCase)
|
||||
@@ -124,7 +131,7 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.ReaderKeys.Any(it => it.Equals(fileName, StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
BindField(generator, result, propertyInfo, fileName);
|
||||
BindField(generator, result, propertyInfo, ReaderKeys.Single(it => it.Equals(fileName, StringComparison.CurrentCultureIgnoreCase)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ namespace SqlSugar
|
||||
new KeyValuePair<string, CSharpDataType>("varchar",CSharpDataType.@string),
|
||||
new KeyValuePair<string, CSharpDataType>("text",CSharpDataType.@string),
|
||||
new KeyValuePair<string, CSharpDataType>("char",CSharpDataType.@string),
|
||||
new KeyValuePair<string, CSharpDataType>("num",CSharpDataType.@string),
|
||||
|
||||
new KeyValuePair<string, CSharpDataType>("tinyint",CSharpDataType.@byte),
|
||||
new KeyValuePair<string, CSharpDataType>("UNSIGNEDINTEGER8",CSharpDataType.@byte),
|
||||
|
Binary file not shown.
@@ -106,7 +106,14 @@ namespace SqlSugar
|
||||
var mappInfo = mappingColumns.SingleOrDefault(it => it.EntityName == type.Name && it.PropertyName.Equals(propertyInfo.Name));
|
||||
if (mappInfo != null)
|
||||
{
|
||||
fileName = mappInfo.DbColumnName;
|
||||
if (!ReaderKeys.Contains(mappInfo.DbColumnName))
|
||||
{
|
||||
fileName = ReaderKeys.Single(it=>it.Equals(mappInfo.DbColumnName,StringComparison.CurrentCultureIgnoreCase));
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = mappInfo.DbColumnName;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Context.IgnoreColumns != null && Context.IgnoreColumns.Any(it => it.PropertyName.Equals(propertyInfo.Name, StringComparison.CurrentCultureIgnoreCase)
|
||||
@@ -124,7 +131,7 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.ReaderKeys.Any(it => it.Equals(fileName, StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
BindField(generator, result, propertyInfo, fileName);
|
||||
BindField(generator, result, propertyInfo, ReaderKeys.Single(it => it.Equals(fileName, StringComparison.CurrentCultureIgnoreCase)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -13,20 +13,26 @@ namespace System.Data.SQLite
|
||||
public static List<DbColumnInfo> GetColumnInfosByTableName(string tableName, DbDataReader dataReader)
|
||||
{
|
||||
List<DbColumnInfo> result = new List<DbColumnInfo>();
|
||||
var columns = dataReader.GetColumnSchema();
|
||||
foreach (var row in columns)
|
||||
while (dataReader.Read())
|
||||
{
|
||||
var type = dataReader.GetValue(2).ObjToString();
|
||||
var length = 0;
|
||||
if (type.Contains("("))
|
||||
{
|
||||
type = type.Split('(').First();
|
||||
length = type.Split('(').Last().TrimEnd(')').ObjToInt();
|
||||
}
|
||||
DbColumnInfo column = new DbColumnInfo()
|
||||
{
|
||||
TableName = tableName,
|
||||
DataType = row.DataTypeName,
|
||||
IsNullable = row.AllowDBNull.ObjToBool(),
|
||||
IsIdentity = row.IsAutoIncrement.ObjToBool(),
|
||||
DataType = type,
|
||||
IsNullable = !dataReader.GetBoolean(3),
|
||||
IsIdentity = dataReader.GetBoolean(3)&&dataReader.GetBoolean(5).ObjToBool() && (type.IsIn("integer", "int", "int32", "int64", "long")),
|
||||
ColumnDescription = null,
|
||||
DbColumnName = row.ColumnName,
|
||||
DefaultValue = null,
|
||||
IsPrimarykey = row.IsKey.ObjToBool(),
|
||||
Length = row.ColumnSize.ObjToInt()
|
||||
DbColumnName = dataReader.GetString(1),
|
||||
DefaultValue =dataReader.GetValue(4).ObjToString(),
|
||||
IsPrimarykey = dataReader.GetBoolean(5).ObjToBool(),
|
||||
Length = length
|
||||
};
|
||||
result.Add(column);
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ namespace SqlSugar
|
||||
new KeyValuePair<string, CSharpDataType>("varchar",CSharpDataType.@string),
|
||||
new KeyValuePair<string, CSharpDataType>("text",CSharpDataType.@string),
|
||||
new KeyValuePair<string, CSharpDataType>("char",CSharpDataType.@string),
|
||||
new KeyValuePair<string, CSharpDataType>("num",CSharpDataType.@string),
|
||||
|
||||
new KeyValuePair<string, CSharpDataType>("tinyint",CSharpDataType.@byte),
|
||||
new KeyValuePair<string, CSharpDataType>("UNSIGNEDINTEGER8",CSharpDataType.@byte),
|
||||
|
@@ -175,7 +175,7 @@ namespace SqlSugar
|
||||
|
||||
}, (cm, key) =>
|
||||
{
|
||||
string sql = "select * from " + tableName + " limit 0,1";
|
||||
string sql = "PRAGMA table_info("+tableName+")";
|
||||
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;
|
||||
this.Context.Ado.IsEnableLogEvent = false;
|
||||
using (DbDataReader reader = (SqliteDataReader)this.Context.Ado.GetDataReader(sql))
|
||||
|
Binary file not shown.
@@ -11,7 +11,7 @@ namespace OrmTest.Models
|
||||
[SugarTable("STudent")]
|
||||
public class Student
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "ID")]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "Id")]
|
||||
public int Id { get; set; }
|
||||
public int? SchoolId { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
@@ -18,19 +18,21 @@ namespace OrmTest
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
/***Unit Test***/
|
||||
new Field(1).Init();
|
||||
new Where(1).Init();
|
||||
new Method(1).Init();
|
||||
new JoinQuery(1).Init();
|
||||
new SingleQuery(1).Init();
|
||||
new SelectQuery(1).Init();
|
||||
new AutoClose(1).Init();
|
||||
new Insert(1).Init();
|
||||
new Delete(1).Init();
|
||||
new Update(1).Init();
|
||||
new Mapping(1).Init();
|
||||
new DataTest(1).Init();
|
||||
/***SQLITE CORE case sensitive, Unit comment dropped***/
|
||||
|
||||
///***Unit Test***/
|
||||
//new Field(1).Init();
|
||||
//new Where(1).Init();
|
||||
//new Method(1).Init();
|
||||
//new JoinQuery(1).Init();
|
||||
//new SingleQuery(1).Init();
|
||||
//new SelectQuery(1).Init();
|
||||
//new AutoClose(1).Init();
|
||||
//new Insert(1).Init();
|
||||
//new Delete(1).Init();
|
||||
//new Update(1).Init();
|
||||
//new Mapping(1).Init();
|
||||
//new DataTest(1).Init();
|
||||
|
||||
/***Performance Test***/
|
||||
new SqlSugarPerformance(100).Select();
|
||||
|
@@ -20,6 +20,7 @@ namespace OrmTest.UnitTest
|
||||
for (int i = 0; i < this.Count; i++)
|
||||
{
|
||||
var db = GetInstance();
|
||||
db.MappingColumns = null;
|
||||
var x = db.Queryable<Student>().ToList();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user