package main import ( //"fmt" //"time" //"math" . "git.wecise.com/wecise/odbserver/odb" "git.wecise.com/wecise/odbserver/odb/test" "gitee.com/wecisecode/util/logger" ) // CGO_ENABLED=1 go run --ldflags '-linkmode external -extldflags "-static"' testlog.go // #cgo LDFLAGS: -L/opt/odbserver/sqlite -lsqlite -ldl // #include "/opt/odbserver/sqlite/sqlite.h" // #include // #include // extern int64_t uhaha_seed; // extern int64_t uhaha_ts; // void uhaha_begin_reader(); // void uhaha_end_reader(); func main() { //options := map[string]interface{} {"cache":odb.CacheAll} //g,err:= odb.New( options ) logger.SetConsole(true) //option := &StoreOption{Cache:CacheAll} option := &Option{Cache: CacheAll, Keyspace: "ootest", DisableInitialHostLookup: true, DisableNotify: true} g, err := test.NewG(option) if err != nil { logger.Error(err.Error()) } else { defer g.Close() } //logger.SetRollingDaily("C:/test/zkcron/src/test", "test.log") //logger.SetLevel(logger.DEBUG) // 测试MQL //stat, _ := g.Prepare(`select * from /system/log/rule where name='xxxx' and level=1`) //rst,meta,err := stat.Exec( "IBPS", 202301251540, "aaaaa", 6789, 1, "sahnghai", 1 ) rst, meta, err := g.Query(`select * from /system/log/rule where name='xxxx' and level=1`) /*stat, _ := g.Prepare(`select * from /native/cnccbdos@202301251540 where syscode = ? and minute = ? and batchno = ?`) rst,meta,err := stat.Exec( "IBPS", 202301251540, 1 )*/ /*stat, _ := g.Prepare(`update /native/cnccbdos@202301251540 set node=? where syscode = ? and minute = ? and batchno = ? and transuid= ? and appno=?`) rst,meta,err := stat.Exec( "bbbbbb", "IBPS", 202301251540, 1, "aaaaa", 1 )*/ //rst,meta,err := g.Query(`insert into /native/cnccbdos@202301271540 (syscode, minute, transuid, comptime, appno, dc, batchno) values( 'IBPS', 202301251540, 'aaaaa', 6789, 1, 'sahnghai', 1)` ) //rst,meta,err := g.Query(`select * from /native/cnccbdos where syscode = 'IBPS' and minute = 202301251540 and batchno = 1` ) //rst,meta,err := g.Query(`update /native/cnccbdos set node='bbbbbb' where syscode = 'IBPS' and minute = 202301251540 and batchno = 1 and transuid='aaaaa' and appno=1` ) //rst,meta,err := g.Query(`insert into /native/cnccbdos (syscode, minute, transuid, comptime, appno, dc) values( 'IBPS', 202301251540, 'aaaaa', 6789, 1, 'sahnghai')` ) if err != nil { logger.Info("Query error:" + err.Error()) logger.Warn(meta["type"]) } else { logger.Info("rst ===>", rst) //logger.Error("meta ===>", meta) if meta["trace"] != nil && len(meta["trace"].([]string)) > 0 { for _, msg := range meta["trace"].([]string) { logger.Error(msg) } } logger.Warn(meta["columns"]) logger.Warn(meta["params"]) } }