kingshard
kingshard copied to clipboard
why set autocommit(0) when connection is still in unautocommit status??
https://github.com/flike/kingshard/blob/f17b3939474659568b3aa14aa89beeef8da4f24b/proxy/server/conn_query.go#L139
if !c.isAutoCommit() { // not in autocommit ??
// then set it again ??
if err = co.SetAutoCommit(0); err != nil {
return
}
} else {
// do transaction ??
if err = co.Begin(); err != nil {
return
}
}
thanks for your response.
isAutoCommit
is check whether need to set autocommit.
When isAutoCommit
return false, it need to SetAutoCommit(0)