//... w := cn.writeBuf('B') if cn.binaryParameters { cn.sendBinaryParameters(w, v) } else { w.int16(0) w.int16(len(v)) for i, x := range v { if x == nil { w.int32(-1) } else { //メッセージに値をエンコードして挿入 b := encode(&cn.parameterStatus, x, st.paramTyps[i]) w.int32(len(b)) w.bytes(b) } ライブラリを見てみる なぜプレースホルダでSQLi対策ができるか 23
*rows, err error) { //... // Check to see if we can use the "simpleQuery" interface, which is // *much* faster than going through prepare/exec if len(args) == 0 { return cn.simpleQuery(query) } 引数がなければ(プレースホルダになっていない場合) ライブラリを見てみる なぜプレースホルダでSQLi対策ができるか 28