Exemple #1
0
func (p *Plan) generateOneSQL(stmt sqlparser.Statement, index int) {
	buf := sqlparser.NewTrackedBuffer(nil)
	stmt.Format(buf)
	sql := buf.String()
	glog.Infof("generate select SQL:%s", sql)
	p.SQLs = append(p.SQLs, &SQL{
		Backend: p.Table.Backends[index],
		SQL:     []string{sql},
	})
}
Exemple #2
0
func (p *Plan) generateSQLALL(stmt sqlparser.Statement) {
	buf := sqlparser.NewTrackedBuffer(nil)
	stmt.Format(buf)
	sql := buf.String()
	glog.Infof("generate select SQL:%s", sql)
	for _, backend := range p.Table.Backends {
		p.SQLs = append(p.SQLs, &SQL{
			Backend: backend,
			SQL:     []string{sql},
		})
	}
}