Add SQL string cache

This commit is contained in:
Patrick O'brien 2016-09-01 11:28:35 +10:00
parent d56e28a36d
commit 2ecff95e42

View file

@ -32,7 +32,12 @@ func buildQuery(q *Query) (string, []interface{}) {
defer strmangle.PutBuffer(buf) defer strmangle.PutBuffer(buf)
return buf.String(), args // Cache the generated query for query object re-use
bufStr := buf.String()
q.plainSQL.sql = bufStr
q.plainSQL.args = args
return bufStr, args
} }
func buildSelectQuery(q *Query) (*bytes.Buffer, []interface{}) { func buildSelectQuery(q *Query) (*bytes.Buffer, []interface{}) {