kingshard icon indicating copy to clipboard operation
kingshard copied to clipboard

why set autocommit(0) when connection is still in unautocommit status??

Open pingworld opened this issue 4 years ago • 1 comments

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.

pingworld avatar Jan 27 '21 02:01 pingworld

isAutoCommit is check whether need to set autocommit. When isAutoCommit return false, it need to SetAutoCommit(0)

fenngwd avatar Feb 07 '21 05:02 fenngwd