Merge branch 'v1' into lunny/fix_bug_longtext_with_json

This commit is contained in:
Lunny Xiao 2025-07-18 02:59:18 +00:00
commit e1ae4ff968
6 changed files with 1113 additions and 0 deletions

View File

@ -50,6 +50,9 @@ Drivers for Go's sql package which currently support database/sql includes:
* MsSql * MsSql
- [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb) - [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb)
* GBase8s
- [https://gitee.com/GBase8s/go-gci](https://gitee.com/GBase8s/go-gci)
* Oracle * Oracle
- [github.com/godror/godror](https://github.com/godror/godror) (experiment) - [github.com/godror/godror](https://github.com/godror/godror) (experiment)
- [github.com/mattn/go-oci8](https://github.com/mattn/go-oci8) (experiment) - [github.com/mattn/go-oci8](https://github.com/mattn/go-oci8) (experiment)

View File

@ -49,6 +49,9 @@ v1.0.0 相对于 v0.8.2 有以下不兼容的变更:
* MsSql * MsSql
- [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb) - [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb)
* GBase8s
- [https://gitee.com/GBase8s/go-gci](https://gitee.com/GBase8s/go-gci)
* Oracle * Oracle
- [github.com/godror/godror](https://github.com/godror/godror) (试验性支持) - [github.com/godror/godror](https://github.com/godror/godror) (试验性支持)
- [github.com/mattn/go-oci8](https://github.com/mattn/go-oci8) (试验性支持) - [github.com/mattn/go-oci8](https://github.com/mattn/go-oci8) (试验性支持)

1089
dialects/gbase8s.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -798,6 +798,22 @@ func (engine *Engine) dumpTables(ctx context.Context, tables []*schemas.Table, w
return err return err
} }
} }
} else if sess.engine.dialect.URI().DBType == schemas.GBASE8S {
stp.Name = strings.Replace(stp.Name, "SQLT_", "", 1)
if stp.IsTime() && len(s.String) == 20 { // "2025-06-10T07:55:31Z"
t, err := time.Parse(time.RFC3339, s.String)
if err != nil {
return fmt.Errorf("failed to parse time %s: %v", s.String, err)
}
r := t.Format("2006-01-02 15:04:05")
if _, err = io.WriteString(w, "'"+r+"'"); err != nil {
return err
}
} else {
if _, err = io.WriteString(w, "'"+strings.ReplaceAll(s.String, "'", "''")+"'"); err != nil {
return err
}
}
} else { } else {
if _, err = io.WriteString(w, "'"+strings.ReplaceAll(s.String, "'", "''")+"'"); err != nil { if _, err = io.WriteString(w, "'"+strings.ReplaceAll(s.String, "'", "''")+"'"); err != nil {
return err return err

View File

@ -23,6 +23,7 @@ const (
MSSQL DBType = "mssql" MSSQL DBType = "mssql"
ORACLE DBType = "oracle" ORACLE DBType = "oracle"
DAMENG DBType = "dameng" DAMENG DBType = "dameng"
GBASE8S DBType = "gbase8s"
) )
// SQLType represents SQL types // SQLType represents SQL types

View File

@ -196,6 +196,7 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{})
} }
} else if col.Comment != oriCol.Comment { } else if col.Comment != oriCol.Comment {
if engine.dialect.URI().DBType == schemas.POSTGRES || if engine.dialect.URI().DBType == schemas.POSTGRES ||
engine.dialect.URI().DBType == schemas.GBASE8S ||
engine.dialect.URI().DBType == schemas.MYSQL { engine.dialect.URI().DBType == schemas.MYSQL {
_, err = session.exec(engine.dialect.ModifyColumnSQL(tbNameWithSchema, col)) _, err = session.exec(engine.dialect.ModifyColumnSQL(tbNameWithSchema, col))
} }