func (s *Stmt) GetRewriteSQL() (string, error) {
	sql := s.sql
	var tmp = ""
	var pos = 0
	var offset = 0
	var quote = false
	for i := 0; i < s.paramCount; i++ {
		quote, tmp = util.ItoString(s.args[i])
		tmp = escapeSQL(tmp)
		pos = s.offsets[i]
		if quote {
			sql = util.Concat(sql[:pos+offset], "'", tmp, "'", sql[pos+offset+1:])
			offset = offset + len(tmp) - 1 + 2
		} else {
			sql = util.Concat(sql[:pos+offset], tmp, sql[pos+offset+1:])
			offset = offset + len(tmp) - 1
		}
	}
	return sql, nil
}
GetRewriteSQL get rewrite sql
package server
import (
	"encoding/binary"
	"errors"
	"fmt"
	"math"
	"strconv"
	"github.com/nooncall/shazam/mysql"
	"github.com/nooncall/shazam/util"
)
var p = &mysql.Field{Name: []byte("?")}
var c = &mysql.Field{}
func calcParams(sql string) (paramCount int, offsets []int, err error) {
	count := 0
	quoteChar := ""
	paramCount = 0
	offsets = make([]int, 0)
	for i, elem := range []byte(sql) {
		if elem == '\\' {
			continue
		} else if elem == '"' || elem == '\'' {
			if quoteChar == "" {
				quoteChar = string(elem)
			} else if quoteChar == string(elem) {
				quoteChar = ""
			}
		} else if quoteChar == "" && elem == '?' {
			count++
			offsets = append(offsets, i)
		}
	}
	if quoteChar != "" {
		err = fmt.Errorf("fatal situation")
		return
	}
	paramCount = count
	return
}
func escapeSQL(sql string) string {
	t := make([]byte, 0, len(sql))
	for _, elem := range []byte(sql) {
		if elem == '\\' || elem == '\'' {
			t = append(t, '\\')
		}
		t = append(t, elem)
	}
	return string(t)
}
type Stmt struct {
	id          uint32
	sql         string
	args        []interface{}
	columnCount int
	paramCount  int
	paramTypes  []byte
	offsets     []int
}
func (s *Stmt) ResetParams() {
	s.args = make([]interface{}, s.paramCount)
}
func (s *Stmt) SetParamTypes(paramTypes []byte) {
	s.paramTypes = paramTypes
}
func (s *Stmt) GetParamTypes() []byte {
	return s.paramTypes
}