pub struct Transaction<'a>(/* private fields */);Expand description
This struct represents MySql transaction.
Transaction is just a sugar for START TRANSACTION, ROLLBACK and COMMIT queries,
so please note, that it is easy to mess things up calling this queries manually.
You should always call either commit or rollback, otherwise transaction will be rolled
back implicitly when corresponding connection is dropped or queried.
Implementations§
Methods from Deref<Target = Conn>§
Sourcepub fn last_insert_id(&self) -> Option<u64>
pub fn last_insert_id(&self) -> Option<u64>
Returns the ID generated by a query (usually INSERT) on a table with a column having the
AUTO_INCREMENT attribute. Returns None if there was no previous query on the connection
or if the query did not update an AUTO_INCREMENT value.
Sourcepub fn affected_rows(&self) -> u64
pub fn affected_rows(&self) -> u64
Returns the number of rows affected by the last INSERT, UPDATE, REPLACE or DELETE
query.
Sourcepub fn info(&self) -> Cow<'_, str>
pub fn info(&self) -> Cow<'_, str>
Text information, as reported by the server in the last OK packet, or an empty string.
Sourcepub fn get_warnings(&self) -> u16
pub fn get_warnings(&self) -> u16
Number of warnings, as reported by the server in the last OK packet, or 0.
Sourcepub fn last_ok_packet(&self) -> Option<&OkPacket<'static>>
pub fn last_ok_packet(&self) -> Option<&OkPacket<'static>>
Returns a reference to the last OK packet.
Sourcepub fn server_version(&self) -> (u16, u16, u16)
pub fn server_version(&self) -> (u16, u16, u16)
Returns server version.