Explorar el Código

Move up check for error status of prepareStatement to before access of info.

Nimi Wariboko Jr hace 11 años
padre
commit
5cf06ce3d8
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  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 {