<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=DbReconnect</id>
	<title>DbReconnect - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=DbReconnect"/>
	<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=DbReconnect&amp;action=history"/>
	<updated>2026-09-19T14:00:30Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://g1r-mp.com/wiki/index.php?title=DbReconnect&amp;diff=890&amp;oldid=prev</id>
		<title>QCherry: Document upcoming 0.1.4 database recovery; organize wiki navigation</title>
		<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=DbReconnect&amp;diff=890&amp;oldid=prev"/>
		<updated>2026-09-19T10:51:42Z</updated>

		<summary type="html">&lt;p&gt;Document upcoming 0.1.4 database recovery; organize wiki navigation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= dbReconnect =&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Available since 0.1.4 (in development; not present in public 0.1.3). Server-side only.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Explicitly requests a fresh session for a disconnected resource-owned MySQL handle, including one fenced after transaction/session loss.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
boolean dbReconnect(DatabaseConnection connection)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns true if a recovery request was accepted, &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; if a connection has already been established. Returns false for foreign/unknown/closed handles, an already connected or reconnecting connection, or one still busy. Observe [[dbGetConnectionState]] or [[onDatabaseConnectionStateChange]] for completion.&lt;br /&gt;
&lt;br /&gt;
With autoreconnect=false this requests one connection attempt. With autoreconnect=true failed attempts continue with bounded backoff. The original handle is retained and generation increases on success. No failed queries or session SQL are replayed. Calling it for transaction_lost acknowledges session replacement; it cannot resume the transaction or determine whether a lost COMMIT succeeded.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local status = dbGetConnectionState(db)&lt;br /&gt;
if status and status.state == &amp;quot;disconnected&amp;quot; then&lt;br /&gt;
    dbReconnect(db) -- asynchronous; check state before submitting more work&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [[MySQL connection recovery]] for safe transaction handling.&lt;br /&gt;
[[Category:Lua Functions]]&lt;br /&gt;
[[Category:Server Functions]]&lt;br /&gt;
[[Category:Database Functions]]&lt;/div&gt;</summary>
		<author><name>QCherry</name></author>
	</entry>
</feed>