mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 增加 DbFirst DbColumnInfo Position 属性,字段默认位置;
This commit is contained in:
@ -330,6 +330,7 @@ where a.owner in ({1}) and {0}
|
||||
ds2item[8] = string.Concat(row[10]);
|
||||
ds2.Add(ds2item);
|
||||
}
|
||||
var position = 0;
|
||||
foreach (var row in ds2)
|
||||
{
|
||||
string table_id = string.Concat(row[0]);
|
||||
@ -359,7 +360,8 @@ where a.owner in ({1}) and {0}
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[table_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
|
||||
loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
|
||||
|
@ -246,6 +246,7 @@ where a.table_schema in ({1}) and {0}
|
||||
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||
if (ds == null) return loc1;
|
||||
|
||||
var position = 0;
|
||||
foreach (var row in ds)
|
||||
{
|
||||
string table_id = string.Concat(row[0]);
|
||||
@ -275,7 +276,8 @@ where a.table_schema in ({1}) and {0}
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[table_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
|
||||
loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
|
||||
|
@ -330,6 +330,7 @@ where a.owner in ({1}) and {0}
|
||||
ds2item[8] = string.Concat(row[10]);
|
||||
ds2.Add(ds2item);
|
||||
}
|
||||
var position = 0;
|
||||
foreach (var row in ds2)
|
||||
{
|
||||
string table_id = string.Concat(row[0]);
|
||||
@ -359,7 +360,8 @@ where a.owner in ({1}) and {0}
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[table_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
|
||||
loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
|
||||
|
@ -216,6 +216,7 @@ where a.table_schema in ({1}) and {0}
|
||||
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||
if (ds == null) return loc1;
|
||||
|
||||
var position = 0;
|
||||
foreach (var row in ds)
|
||||
{
|
||||
string table_id = string.Concat(row[0]);
|
||||
@ -245,7 +246,8 @@ where a.table_schema in ({1}) and {0}
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[table_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
|
||||
loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
|
||||
|
@ -303,6 +303,7 @@ where a.owner in ({1}) and {0}
|
||||
ds2item[8] = string.Concat(row[10]);
|
||||
ds2.Add(ds2item);
|
||||
}
|
||||
var position = 0;
|
||||
foreach (var row in ds2)
|
||||
{
|
||||
string table_id = string.Concat(row[0]);
|
||||
@ -332,7 +333,8 @@ where a.owner in ({1}) and {0}
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[table_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
|
||||
loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
|
||||
|
@ -228,6 +228,7 @@ where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || c.relname")
|
||||
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||
if (ds == null) return loc1;
|
||||
|
||||
var position = 0;
|
||||
foreach (object[] row in ds)
|
||||
{
|
||||
var object_id = string.Concat(row[0]);
|
||||
@ -275,7 +276,8 @@ where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || c.relname")
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[object_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[object_id][column].DbType = this.GetDbType(loc3[object_id][column]);
|
||||
loc3[object_id][column].CsType = this.GetCsTypeInfo(loc3[object_id][column]);
|
||||
|
@ -268,6 +268,7 @@ from sys.parameters", loc88.ToString().Replace("a.table_name", "a.object_id"), "
|
||||
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||
if (ds == null) return loc1;
|
||||
|
||||
var position = 0;
|
||||
foreach (object[] row in ds)
|
||||
{
|
||||
var table_id = string.Concat(row[0]);
|
||||
@ -293,7 +294,8 @@ from sys.parameters", loc88.ToString().Replace("a.table_name", "a.object_id"), "
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[object_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[object_id][column].DbType = this.GetDbType(loc3[object_id][column]);
|
||||
loc3[object_id][column].CsType = this.GetCsTypeInfo(loc3[object_id][column]);
|
||||
|
@ -303,6 +303,7 @@ where a.owner in ({1}) and {0}
|
||||
ds2item[8] = string.Concat(row[10]);
|
||||
ds2.Add(ds2item);
|
||||
}
|
||||
var position = 0;
|
||||
foreach (var row in ds2)
|
||||
{
|
||||
string table_id = string.Concat(row[0]);
|
||||
@ -332,7 +333,8 @@ where a.owner in ({1}) and {0}
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[table_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
|
||||
loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
|
||||
|
@ -338,6 +338,7 @@ where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || c.relname")
|
||||
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||
if (ds == null) return loc1;
|
||||
|
||||
var position = 0;
|
||||
foreach (object[] row in ds)
|
||||
{
|
||||
var object_id = string.Concat(row[0]);
|
||||
@ -385,7 +386,8 @@ where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || c.relname")
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[object_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[object_id][column].DbType = this.GetDbType(loc3[object_id][column]);
|
||||
loc3[object_id][column].CsType = this.GetCsTypeInfo(loc3[object_id][column]);
|
||||
|
@ -271,6 +271,7 @@ from sys.parameters", loc88.ToString().Replace("a.table_name", "a.object_id"), "
|
||||
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||
if (ds == null) return loc1;
|
||||
|
||||
var position = 0;
|
||||
foreach (object[] row in ds)
|
||||
{
|
||||
var table_id = string.Concat(row[0]);
|
||||
@ -296,7 +297,8 @@ from sys.parameters", loc88.ToString().Replace("a.table_name", "a.object_id"), "
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[object_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = ++position
|
||||
});
|
||||
loc3[object_id][column].DbType = this.GetDbType(loc3[object_id][column]);
|
||||
loc3[object_id][column].CsType = this.GetCsTypeInfo(loc3[object_id][column]);
|
||||
|
@ -159,7 +159,7 @@ namespace FreeSql.Sqlite
|
||||
if (database == null || database.Any() == false) database = GetDatabases().ToArray();
|
||||
if (database.Any() == false) return loc1;
|
||||
|
||||
Action<object[]> addColumn = row =>
|
||||
Action<object[], int> addColumn = (row, position) =>
|
||||
{
|
||||
string table_id = string.Concat(row[0]);
|
||||
string column = string.Concat(row[1]);
|
||||
@ -185,7 +185,8 @@ namespace FreeSql.Sqlite
|
||||
DbTypeTextFull = sqlType,
|
||||
Table = loc2[table_id],
|
||||
Coment = comment,
|
||||
DefaultValue = defaultValue
|
||||
DefaultValue = defaultValue,
|
||||
Position = position
|
||||
});
|
||||
loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
|
||||
loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
|
||||
@ -247,6 +248,7 @@ from {db}.sqlite_master where type = 'table'";
|
||||
{
|
||||
var dsql = string.Concat(row[5]);
|
||||
var cols = _orm.Ado.ExecuteArray(CommandType.Text, $"PRAGMA \"{db}\".table_info(\"{table}\")");
|
||||
var position = 0;
|
||||
foreach (var col in cols)
|
||||
{
|
||||
var col_name = string.Concat(col[1]);
|
||||
@ -268,7 +270,7 @@ from {db}.sqlite_master where type = 'table'";
|
||||
ds2item[7] = string.Concat(col[5]) == "1" ? 1 : 0;
|
||||
ds2item[8] = "";
|
||||
ds2item[9] = string.Concat(col[4]);
|
||||
addColumn(ds2item);
|
||||
addColumn(ds2item, ++position);
|
||||
}
|
||||
|
||||
var fks = _orm.Ado.ExecuteArray(CommandType.Text, $"PRAGMA \"{db}\".foreign_key_list(\"{table}\")");
|
||||
|
Reference in New Issue
Block a user