fix oracle insert datetime (#1873)
oracle下的日期插入问题。 Reviewed-on: https://gitea.com/xorm/xorm/pulls/1873 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 4color <4color@noreply.gitea.io> Co-committed-by: 4color <4color@noreply.gitea.io>
This commit is contained in:
parent
eed7e65bd9
commit
a7a51533d1
|
@ -19,7 +19,11 @@ func FormatTime(dialect Dialect, sqlTypeName string, t time.Time) (v interface{}
|
||||||
case schemas.Date:
|
case schemas.Date:
|
||||||
v = t.Format("2006-01-02")
|
v = t.Format("2006-01-02")
|
||||||
case schemas.DateTime, schemas.TimeStamp, schemas.Varchar: // !DarthPestilane! format time when sqlTypeName is schemas.Varchar.
|
case schemas.DateTime, schemas.TimeStamp, schemas.Varchar: // !DarthPestilane! format time when sqlTypeName is schemas.Varchar.
|
||||||
v = t.Format("2006-01-02 15:04:05")
|
if dialect.URI().DBType == schemas.ORACLE {
|
||||||
|
v = t
|
||||||
|
} else {
|
||||||
|
v = t.Format("2006-01-02 15:04:05")
|
||||||
|
}
|
||||||
case schemas.TimeStampz:
|
case schemas.TimeStampz:
|
||||||
if dialect.URI().DBType == schemas.MSSQL {
|
if dialect.URI().DBType == schemas.MSSQL {
|
||||||
v = t.Format("2006-01-02T15:04:05.9999999Z07:00")
|
v = t.Format("2006-01-02T15:04:05.9999999Z07:00")
|
||||||
|
|
Loading…
Reference in New Issue