fix
parent
51af81d925
commit
d8653ccf8f
|
@ -5,6 +5,7 @@ import (
|
|||
"git.botann.com/tinycs/boomerang/tyconf/ini"
|
||||
"git.botann.com/tinycs/boomerang/tyoracle"
|
||||
"git.botann.com/tinycs/boomerang/tyoracle/basesql"
|
||||
_ "github.com/godror/godror"
|
||||
)
|
||||
|
||||
var APP AppConf
|
||||
|
|
|
@ -33,11 +33,12 @@ func (s *SqlBuilder[T]) InsertConditions(symbol string, cond string, args ...int
|
|||
if strings.HasPrefix(cond, " and") {
|
||||
cond = strings.Join(strings.Split(cond, " and")[1:], " and ")
|
||||
}
|
||||
if s.Driver == util.DriverOracle {
|
||||
cond, args = dealOralceInCondition(cond, args)
|
||||
} else {
|
||||
cond, args = dealInCondition(cond, args)
|
||||
}
|
||||
// if s.Driver == util.DriverOracle {
|
||||
// cond, args = dealOralceInCondition(cond, args)
|
||||
// } else {
|
||||
// cond, args = dealInCondition(cond, args)
|
||||
// }
|
||||
cond, args = dealInCondition(cond, args)
|
||||
s.Opts.Conditions = append(s.Opts.Conditions, cond)
|
||||
s.Opts.Args = append(s.Opts.Args, args...)
|
||||
s.buildCondition(symbol, cond)
|
||||
|
|
2
go.mod
2
go.mod
|
@ -2,7 +2,7 @@ module git.botann.com/lijun/sql-builder
|
|||
|
||||
go 1.21.5
|
||||
|
||||
require git.botann.com/tinycs/boomerang v1.4.7
|
||||
require git.botann.com/tinycs/boomerang v1.4.12
|
||||
|
||||
require (
|
||||
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1,5 +1,7 @@
|
|||
git.botann.com/tinycs/boomerang v1.4.7 h1:O3M38Y1i+Kl/U9ii4U124r0MKibVQcZ+a9IjOTpSOu4=
|
||||
git.botann.com/tinycs/boomerang v1.4.7/go.mod h1:JA5Fu88ZdYmkWMXVLRe/bZ3GE/iWxPUUvi1hSsg3cOQ=
|
||||
git.botann.com/tinycs/boomerang v1.4.12 h1:IcvLkzHFnVkJRNsMaDEPs8ixaRHpLw6IdhKNyZdHZY4=
|
||||
git.botann.com/tinycs/boomerang v1.4.12/go.mod h1:YTA0bw60BnajniDSvTyVt6vYtBKLEf70eG/gKfSDz80=
|
||||
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
|
||||
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/UNO-SOFT/zlog v0.8.1 h1:TEFkGJHtUfTRgMkLZiAjLSHALjwSBdw6/zByMC5GJt4=
|
||||
|
|
28
main_test.go
28
main_test.go
|
@ -50,28 +50,24 @@ func (p *Page) SetPageSize(pageSize int) {
|
|||
|
||||
func TestOracle(t *testing.T) {
|
||||
var err error
|
||||
type Employye struct {
|
||||
EmployeeId int `json:"employee_id"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Email string `json:"email"`
|
||||
Rn int
|
||||
type Area struct {
|
||||
Autoseq int `json:"autoseq"`
|
||||
Name string `json:"name"`
|
||||
Id string `json:"id"`
|
||||
AreaDn string `json:"area_dn"`
|
||||
Rn int `json:"rn"`
|
||||
}
|
||||
var data []Employye
|
||||
var data []Area
|
||||
var ids = []int{86986, 86987}
|
||||
sqlb := OracleSqlBuilder()
|
||||
err = sqlb.SetSchema("HR")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
var ids = []int{100, 101, 102}
|
||||
sqls := `select employee_id,first_name,last_name,email from employees where 1=1 @c1 @c2`
|
||||
sqls := `select autoseq,name,id,area_dn from tareas where del = 0 @c1 @c2`
|
||||
sqlb.Sql = sqls
|
||||
sqlb.InsertConditions("@c1", "employee_id in (:in)", ids)
|
||||
sqlb.InsertConditions("@c2", "first_name = :first_name and last_name = :last_name", "Steven", "King")
|
||||
sqlb.InsertConditions("@c1", "area_dn like ?", "level1=1,level2=85226,level3=86918,level4=86919,level5=86986%")
|
||||
sqlb.InsertConditions("@c2", "autoseq in (?)", ids)
|
||||
page := Page{PageIndex: 1, PageSize: 10}
|
||||
err = sqlb.PaginateBySql(&data, &page)
|
||||
page.Data = &data
|
||||
fmt.Println(err, page.Data)
|
||||
fmt.Println(err, page)
|
||||
}
|
||||
|
||||
func TestMysql(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue