add SyncSelectCustomQuery
This commit is contained in:
parent
f79618418e
commit
eb482c3b27
25
dbpool.go
25
dbpool.go
@ -89,6 +89,31 @@ func (this *dbPool) SelectCustomQuery(dataSource string, sql string, cb QueryRes
|
|||||||
this.internalQuery(dataSource, sql, params, cb)
|
this.internalQuery(dataSource, sql, params, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *dbPool) SyncSelectCustomQuery(dataSource string, sql string, cb QueryResultCb) {
|
||||||
|
chDone := make(chan bool)
|
||||||
|
params := []string{}
|
||||||
|
if this.style == GO_STYLE_DB {
|
||||||
|
go this.internalQuery(dataSource, sql, params,
|
||||||
|
func(err error, ds *DataSet) {
|
||||||
|
cb(err, ds)
|
||||||
|
chDone <- true
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.internalQuery(dataSource, sql, params,
|
||||||
|
func(err error, ds *DataSet) {
|
||||||
|
cb(err, ds)
|
||||||
|
chDone <- true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-chDone:
|
||||||
|
close(chDone)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (this *dbPool) SelectLike(
|
func (this *dbPool) SelectLike(
|
||||||
dataSource string,
|
dataSource string,
|
||||||
tblName string,
|
tblName string,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user