subsql:=fmt.Sprintf("select last_row(ts) from %s.%s group by tbname",d.srcdbname,stbname)
subRows,err:=d.db.Query(subsql)
iferr!=nil{
checkErr(err,subsql)
}
forsubRows.Next(){
vartbnamestring
subRows.Scan(&lastTime,&tbname)
}
subRows.Close()
}
}
fori,f:=rangefields{
fori,f:=rangefields{
col:=fmt.Sprintf("%s %s %s",stbname,tbname,f)
col:=fmt.Sprintf("%s %s",tbname,f)
count:=0
var(
{
tstime.Time
dbnamestring
var(
tablenamestring
tstime.Time
colnamestring
dbnamestring
checkintervalint
tablenamestring
thresholdint
colnamestring
)
checkintervalint
checkSql:=fmt.Sprintf("select * from %s.%s where dbname = \"%s\" and tablename = \"%s\" and colname = \"%s\"",d.dbname,d.metaTable,d.srcdbname,tbname,f)
thresholdint
checkRow,err:=d.db.Query(checkSql)
)
iferr!=nil{
checkErr(err,checkSql)
checkSql:=fmt.Sprintf("select * from %s.%s where dbname = \"%s\" and tablename = \"%s\" and colname = \"%s\"",d.dbname,d.metaTable,d.srcdbname,tbname,f)