Browse Source

Time configuration

pull/19/head
sunkaixuan 3 years ago
parent
commit
1ba4ff0066
  1. 4
      Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs
  2. 4
      Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs
  3. 4
      Src/Asp.Net/SqlSugar/Realization/Dm/SqlBuilder/DmUpdateBuilder.cs
  4. 4
      Src/Asp.Net/SqlSugar/Realization/MySql/SqlBuilder/MySqlInsertBuilder.cs
  5. 4
      Src/Asp.Net/SqlSugar/Realization/MySql/SqlBuilder/MySqlUpdateBuilder.cs
  6. 4
      Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleInsertBuilder.cs
  7. 4
      Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleUpdateBuilder.cs
  8. 2
      Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlServerProvider.cs
  9. 4
      Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteInsertBuilder.cs
  10. 4
      Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteUpdateBuilder.cs

4
Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs

@ -190,9 +190,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

4
Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs

@ -292,9 +292,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

4
Src/Asp.Net/SqlSugar/Realization/Dm/SqlBuilder/DmUpdateBuilder.cs

@ -52,9 +52,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

4
Src/Asp.Net/SqlSugar/Realization/MySql/SqlBuilder/MySqlInsertBuilder.cs

@ -45,9 +45,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

4
Src/Asp.Net/SqlSugar/Realization/MySql/SqlBuilder/MySqlUpdateBuilder.cs

@ -107,9 +107,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }

4
Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleInsertBuilder.cs

@ -117,9 +117,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true) if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{ {

4
Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleUpdateBuilder.cs

@ -53,9 +53,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true) if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{ {

2
Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlServerProvider.cs

@ -141,7 +141,7 @@ namespace SqlSugar
var date = Convert.ToDateTime(sqlParameter.Value); var date = Convert.ToDateTime(sqlParameter.Value);
if (date==DateTime.MinValue) if (date==DateTime.MinValue)
{ {
sqlParameter.Value = Convert.ToDateTime("1753/01/01"); sqlParameter.Value =UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
} }
if (parameter.Direction == 0) if (parameter.Direction == 0)

4
Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteInsertBuilder.cs

@ -91,9 +91,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true) if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{ {

4
Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteUpdateBuilder.cs

@ -47,9 +47,9 @@ namespace SqlSugar
if (type == UtilConstants.DateType && iswhere == false) if (type == UtilConstants.DateType && iswhere == false)
{ {
var date = value.ObjToDate(); var date = value.ObjToDate();
if (date < Convert.ToDateTime("1900-1-1")) if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{ {
date = Convert.ToDateTime("1900-1-1"); date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
} }
if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true) if (this.Context.CurrentConnectionConfig?.MoreSettings?.DisableMillisecond == true)
{ {

Loading…
Cancel
Save