internalQueryOne select count... add tmp table flag

This commit is contained in:
殷勇 2023-08-25 15:03:37 +08:00
parent 0391e1a006
commit 0463bb48fc
2 changed files with 33 additions and 33 deletions

22
app.go
View File

@ -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 {
@ -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,9 +178,9 @@ 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,

View File

@ -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 {