Fix time bug

This commit is contained in:
Lunny Xiao 2021-07-22 17:09:34 +08:00
parent c7f3c3cae9
commit b11dd70c3c
3 changed files with 11 additions and 8 deletions

View File

@ -176,12 +176,7 @@ func (statement *Statement) GenInsertSQL(colNames []string, args []interface{})
if err := statement.dialect.Quoter().QuoteTo(buf.Builder, table.AutoIncrement); err != nil { if err := statement.dialect.Quoter().QuoteTo(buf.Builder, table.AutoIncrement); err != nil {
return nil, err return nil, err
} }
} /* else if statement.dialect.URI().DBType == schemas.ORACLE {
if _, err := buf.WriteString(fmt.Sprintf("; select %s.currval from dual",
dialects.OracleSeqName(tableName))); err != nil {
return nil, err
} }
}*/
} }
return buf, nil return buf, nil

View File

@ -512,7 +512,11 @@ func (session *Session) genInsertColumns(bean interface{}) ([]string, []interfac
return nil, nil, err return nil, nil, err
} }
if session.engine.dialect.URI().DBType == schemas.ORACLE { if session.engine.dialect.URI().DBType == schemas.ORACLE {
if col.SQLType.IsNumeric() {
args = append(args, t.Unix())
} else {
args = append(args, t) args = append(args, t)
}
} else { } else {
args = append(args, val) args = append(args, val)
} }

View File

@ -220,7 +220,11 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
return 0, err return 0, err
} }
if session.engine.dialect.URI().DBType == schemas.ORACLE { if session.engine.dialect.URI().DBType == schemas.ORACLE {
if col.SQLType.IsNumeric() {
args = append(args, t.Unix())
} else {
args = append(args, t) args = append(args, t)
}
} else { } else {
args = append(args, val) args = append(args, val)
} }