|
@@ -9,7 +9,7 @@ import (
|
|
|
"time"
|
|
|
|
|
|
"git.wecise.com/wecise/cgimport/schema"
|
|
|
- ci "git.wecise.com/wecise/odb-go/schema"
|
|
|
+ "git.wecise.com/wecise/odb-go/dbo"
|
|
|
"github.com/wecisecode/util/cmap"
|
|
|
"github.com/wecisecode/util/merrs"
|
|
|
"github.com/wecisecode/util/mio"
|
|
@@ -17,7 +17,7 @@ import (
|
|
|
)
|
|
|
|
|
|
type classdatainfo struct {
|
|
|
- *ci.ClassInfoHelper
|
|
|
+ *dbo.ClassInfoHelper
|
|
|
insertcount int64
|
|
|
lastlogtime time.Time
|
|
|
lastlogicount int64
|
|
@@ -79,7 +79,10 @@ func (odbci *ODBCImporter) createclass(classname, mql string) (err error) {
|
|
|
return merrs.New("len(cis) != 1")
|
|
|
}
|
|
|
oci := cis[0]
|
|
|
- aci := odbci.schema.NewClassinfo(oci)
|
|
|
+ aci, e := odbci.schema.NewClassinfo(oci)
|
|
|
+ if e != nil {
|
|
|
+ return e
|
|
|
+ }
|
|
|
// add graph tags
|
|
|
_, e = odbci.client.Query(aci.Addtagmql, aci.Classaliasname, aci.Classaliasname, []string{aci.Classaliasname}).Do()
|
|
|
if e != nil {
|
|
@@ -108,10 +111,13 @@ func (odbci *ODBCImporter) getClassinfos() (err error) {
|
|
|
odbci.schema.Clear()
|
|
|
classinfos, e := odbci.client.ClassInfo("/m3cnet", true)
|
|
|
if e != nil {
|
|
|
- return e
|
|
|
+ return merrs.New(e)
|
|
|
}
|
|
|
for _, oci := range classinfos {
|
|
|
- aci := odbci.schema.NewClassinfo(oci)
|
|
|
+ aci, e := odbci.schema.NewClassinfo(oci)
|
|
|
+ if e != nil {
|
|
|
+ return e
|
|
|
+ }
|
|
|
cdi := &classdatainfo{ClassInfoHelper: aci}
|
|
|
classdatainfos.Set(aci.Classaliasname, cdi)
|
|
|
classdatainfos.Set(aci.Classfullname, cdi)
|
|
@@ -122,7 +128,9 @@ func (odbci *ODBCImporter) getClassinfos() (err error) {
|
|
|
func (odbci *ODBCImporter) init(rebuild bool) (err error) {
|
|
|
err = odbci.getClassinfos()
|
|
|
if err != nil {
|
|
|
- return
|
|
|
+ if !merrs.NotExistError.Contains(err) {
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
// bs, _ := json.MarshalIndent(schema.ClassInfos, "", " ")
|
|
|
// fmt.Println(string(bs))
|
|
@@ -141,6 +149,10 @@ func (odbci *ODBCImporter) init(rebuild bool) (err error) {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ err = odbci.getClassinfos()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
return nil
|
|
|
}
|
|
|
|