Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb 乐观事务/悲观事务c/c++范例
【TiDB Usage Environment】TiDB Feature Research Environment
【TiDB Version】v5.4.1
【Encountered Problem】Is there a usage example for C/C++ API interface? How to enable optimistic/pessimistic transactions?
【Reproduction Path】None
【Problem Phenomenon and Impact】None
【Attachment】None
Hello, which API are you referring to? The MySQL client or the TiDB server HTTP API?
Here are examples in Java/Golang that you can refer to:
# Pessimistic Transaction
connection.createStatement().executeUpdate(txnComment + "begin pessimistic");
# Optimistic Transaction
connection.createStatement().executeUpdate(txnComment + "begin optimistic");
This topic was automatically closed 1 minute after the last reply. No new replies are allowed.