Skip to content

Commit

Permalink
Merge pull request siddontang#24 from dancebear/patch-1
Browse files Browse the repository at this point in the history
Update conn_query.go
  • Loading branch information
siddontang committed Sep 15, 2014
2 parents 84b3ff5 + d002ad6 commit a32a60c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions proxy/conn_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (c *Conn) getConn(n *Node, isSelect bool) (co *client.SqlConn, err error) {
return
}

func (c *Conn) getShardConns(stmt sqlparser.Statement, bindVars map[string]interface{}) ([]*client.SqlConn, error) {
func (c *Conn) getShardConns(isSelect bool,stmt sqlparser.Statement, bindVars map[string]interface{}) ([]*client.SqlConn, error) {
nodes, err := c.getShardList(stmt, bindVars)
if err != nil {
return nil, err
Expand All @@ -135,7 +135,7 @@ func (c *Conn) getShardConns(stmt sqlparser.Statement, bindVars map[string]inter

var co *client.SqlConn
for _, n := range nodes {
co, err = c.getConn(n, true)
co, err = c.getConn(n, isSelect)
if err != nil {
break
}
Expand Down Expand Up @@ -236,7 +236,7 @@ func makeBindVars(args []interface{}) map[string]interface{} {
func (c *Conn) handleSelect(stmt *sqlparser.Select, sql string, args []interface{}) error {
bindVars := makeBindVars(args)

conns, err := c.getShardConns(stmt, bindVars)
conns, err := c.getShardConns(true,stmt, bindVars)
if err != nil {
return err
} else if conns == nil {
Expand Down Expand Up @@ -288,7 +288,7 @@ func (c *Conn) commitShardConns(conns []*client.SqlConn) error {
func (c *Conn) handleExec(stmt sqlparser.Statement, sql string, args []interface{}) error {
bindVars := makeBindVars(args)

conns, err := c.getShardConns(stmt, bindVars)
conns, err := c.getShardConns(false,stmt, bindVars)
if err != nil {
return err
} else if conns == nil {
Expand Down

0 comments on commit a32a60c

Please sign in to comment.