浏览代码

Merge pull request #208 from ChannelMeter/fix/preparestatement-error-check

Check the error status of prepareStatement in execute batch
Ben Hood 11 年之前
父节点
当前提交
3a9324943f
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      conn.go

+ 3 - 3
conn.go

@@ -490,6 +490,9 @@ func (c *Conn) executeBatch(batch *Batch) error {
 		if len(entry.Args) > 0 || entry.binding != nil {
 			var err error
 			info, err = c.prepareStatement(entry.Stmt, nil)
+			if err != nil {
+				return err
+			}
 
 			if entry.binding == nil {
 				args = entry.Args
@@ -505,9 +508,6 @@ func (c *Conn) executeBatch(batch *Batch) error {
 			}
 
 			stmts[string(info.Id)] = entry.Stmt
-			if err != nil {
-				return err
-			}
 			f.writeByte(1)
 			f.writeShortBytes(info.Id)
 		} else {