internalQueryOne select count... add tmp table flag
This commit is contained in:
parent
0391e1a006
commit
0463bb48fc
64
app.go
64
app.go
@ -2,11 +2,11 @@ package f5
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"os"
|
||||||
|
"q5"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
"os"
|
|
||||||
"q5"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type App interface {
|
type App interface {
|
||||||
@ -22,7 +22,7 @@ type App interface {
|
|||||||
GetNowSeconds() int64
|
GetNowSeconds() int64
|
||||||
GetNowMillis() int64
|
GetNowMillis() int64
|
||||||
GetNowNano() int64
|
GetNowNano() int64
|
||||||
RegisterMainThreadCb(func ())
|
RegisterMainThreadCb(func())
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserApp interface {
|
type UserApp interface {
|
||||||
@ -33,27 +33,27 @@ type UserApp interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type app struct {
|
type app struct {
|
||||||
zoneId int32
|
zoneId int32
|
||||||
nodeId int32
|
nodeId int32
|
||||||
instanceId int32
|
instanceId int32
|
||||||
terminated bool
|
terminated bool
|
||||||
flags map[int32]int32
|
flags map[int32]int32
|
||||||
servicing bool
|
servicing bool
|
||||||
contextHash map[int32]q5.Args
|
contextHash map[int32]q5.Args
|
||||||
loopCond *sync.Cond
|
loopCond *sync.Cond
|
||||||
imTopNode *IMMsgNode
|
imTopNode *IMMsgNode
|
||||||
imBotNode *IMMsgNode
|
imBotNode *IMMsgNode
|
||||||
imWorkNode *IMMsgNode
|
imWorkNode *IMMsgNode
|
||||||
imMsgMutex sync.RWMutex
|
imMsgMutex sync.RWMutex
|
||||||
chGoLoopTimerExit chan int
|
chGoLoopTimerExit chan int
|
||||||
chGoLoopWait chan int64
|
chGoLoopWait chan int64
|
||||||
nowTime time.Time
|
nowTime time.Time
|
||||||
nowUnixNano int64
|
nowUnixNano int64
|
||||||
imMsgHandlers [1024]func(q5.Args)
|
imMsgHandlers [1024]func(q5.Args)
|
||||||
maxRunDelay int64
|
maxRunDelay int64
|
||||||
maxScheduleTime int64
|
maxScheduleTime int64
|
||||||
uuid q5.Uuid
|
uuid q5.Uuid
|
||||||
userApp UserApp
|
userApp UserApp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) init(userApp UserApp) {
|
func (this *app) init(userApp UserApp) {
|
||||||
@ -82,14 +82,14 @@ func (this *app) init(userApp UserApp) {
|
|||||||
this.nodeId = int32(tmpNodeId)
|
this.nodeId = int32(tmpNodeId)
|
||||||
this.instanceId = int32(tmpInstanceId)
|
this.instanceId = int32(tmpInstanceId)
|
||||||
}
|
}
|
||||||
this.uuid.SetMachineId((this.nodeId - 1) * MAX_NODE_ID + this.instanceId)
|
this.uuid.SetMachineId((this.nodeId-1)*MAX_NODE_ID + this.instanceId)
|
||||||
this.loopCond = sync.NewCond(new(sync.Mutex))
|
this.loopCond = sync.NewCond(new(sync.Mutex))
|
||||||
this.chGoLoopTimerExit = make(chan int)
|
this.chGoLoopTimerExit = make(chan int)
|
||||||
this.chGoLoopWait = make(chan int64)
|
this.chGoLoopWait = make(chan int64)
|
||||||
_app.RegisterIMMsgHandle(
|
_app.RegisterIMMsgHandle(
|
||||||
IM_EXEC_MAIN_THREAD_CB,
|
IM_EXEC_MAIN_THREAD_CB,
|
||||||
func (args q5.Args) {
|
func(args q5.Args) {
|
||||||
cb := args[0].(func ())
|
cb := args[0].(func())
|
||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
this.outputRuningLog()
|
this.outputRuningLog()
|
||||||
@ -125,7 +125,7 @@ func (this *app) run() {
|
|||||||
this.schedule()
|
this.schedule()
|
||||||
endTick := q5.GetTickCount()
|
endTick := q5.GetTickCount()
|
||||||
|
|
||||||
if this.maxRunDelay < endTick - beginTick {
|
if this.maxRunDelay < endTick-beginTick {
|
||||||
this.maxRunDelay = endTick - beginTick
|
this.maxRunDelay = endTick - beginTick
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,10 +178,10 @@ func (this *app) RegisterIMMsgHandle(msgId uint16, handle func(q5.Args)) {
|
|||||||
this.imMsgHandlers[msgId] = handle
|
this.imMsgHandlers[msgId] = handle
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) RegisterMainThreadCb(cb func ()) {
|
func (this *app) RegisterMainThreadCb(cb func()) {
|
||||||
_app.AddIMMsg(IM_EXEC_MAIN_THREAD_CB,
|
_app.AddIMMsg(IM_EXEC_MAIN_THREAD_CB,
|
||||||
[]interface{} {
|
[]interface{}{
|
||||||
cb,
|
cb,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,8 +245,8 @@ func (this *app) dispatchIMMsg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) installTimer() {
|
func (this *app) installTimer() {
|
||||||
GetTimer().SetInterval(1000 * 60,
|
GetTimer().SetInterval(1000*60,
|
||||||
func (ev int32, params *q5.Args) {
|
func(ev int32, params *q5.Args) {
|
||||||
if ev == q5.TIMER_EXEC_EVENT {
|
if ev == q5.TIMER_EXEC_EVENT {
|
||||||
GetSysLog().Info("max_run_delay:%d max_schedule_time:%d",
|
GetSysLog().Info("max_run_delay:%d max_schedule_time:%d",
|
||||||
_app.maxRunDelay,
|
_app.maxRunDelay,
|
||||||
|
@ -182,7 +182,7 @@ func (this *dbPool) PageQuery(
|
|||||||
}
|
}
|
||||||
this.internalQueryOne(
|
this.internalQueryOne(
|
||||||
dataSource,
|
dataSource,
|
||||||
fmt.Sprintf("SELECT COUNT(*) FROM (%s)", finalySql),
|
fmt.Sprintf("SELECT COUNT(*) FROM (%s) as t", finalySql),
|
||||||
params,
|
params,
|
||||||
func(err error, rows *DataSet) {
|
func(err error, rows *DataSet) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user