Browse Source

Delete the prep info struct if it failed to prepare

Chris Bannister 12 years ago
parent
commit
e80fdd993e
1 changed files with 7 additions and 0 deletions
  1. 7 0
      conn.go

+ 7 - 0
conn.go

@@ -279,6 +279,13 @@ func (c *Conn) prepareStatement(stmt string, trace Tracer) (*queryInfo, error) {
 	}
 
 	flight.wg.Done()
+
+	if err != nil {
+		c.prepMu.Lock()
+		delete(c.prep, stmt)
+		c.prepMu.Unlock()
+	}
+
 	return flight.info, flight.err
 }