Esempio n. 1
0
func (conn *Connection) BeginTransaction() (err *ODBCError) {
	ret := C.SQLSetConnectAttr(C.SQLHDBC(conn.Dbc), C.SQL_ATTR_AUTOCOMMIT, C.SQLPOINTER(unsafe.Pointer(uintptr(C.SQL_AUTOCOMMIT_OFF))), C.SQL_IS_UINTEGER)
	if !Success(ret) {
		err = FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
	}
	return
}
Esempio n. 2
0
func (conn *Connection) AutoCommit(b bool) (err *ODBCError) {
	var n C.int
	if b {
		n = C.SQL_AUTOCOMMIT_ON
	} else {
		n = C.SQL_AUTOCOMMIT_OFF
	}
	ret := C.SQLSetConnectAttr(C.SQLHDBC(conn.Dbc), C.SQL_ATTR_AUTOCOMMIT, C.SQLPOINTER(unsafe.Pointer(uintptr(n))), C.SQL_IS_UINTEGER)
	if !Success(ret) {
		err = FormatError(C.SQL_HANDLE_DBC, conn.Dbc)
	}
	return
}