diff --git a/create.go b/create.go index b341743..1a481ba 100644 --- a/create.go +++ b/create.go @@ -4,6 +4,7 @@ import ( "database/sql" "reflect" + "github.com/sijms/go-ora/v2" "gorm.io/gorm" "gorm.io/gorm/callbacks" "gorm.io/gorm/clause" @@ -205,6 +206,10 @@ func convertValue(val interface{}) interface{} { } else { val = 0 } + case string: + if len(v) > 2000 { + val = go_ora.Clob{String: v, Valid: true} + } default: val = convertCustomType(val) } diff --git a/oracle.go b/oracle.go index ff649c7..3348d6a 100644 --- a/oracle.go +++ b/oracle.go @@ -404,13 +404,17 @@ func (d Dialector) QuoteTo(writer clause.Writer, str string) { var numericPlaceholder = regexp.MustCompile(`:(\d+)`) func (d Dialector) Explain(sql string, vars ...interface{}) string { - for idx, v := range vars { - if b, ok := ptrDereference(v).(bool); ok { - if b { + for idx, val := range vars { + val = ptrDereference(val) + switch v := ptrDereference(val).(type) { + case bool: + if v { vars[idx] = 1 } else { vars[idx] = 0 } + case go_ora.Clob: + vars[idx] = v.String } } return logger.ExplainSQL(sql, numericPlaceholder, `'`, vars...)