Skip to content

Commit b3c0e4e

Browse files
committed
wip
1 parent 35c5c76 commit b3c0e4e

File tree

7 files changed

+16
-71
lines changed

7 files changed

+16
-71
lines changed

system/Database/BaseConnection.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,20 @@ public function close()
486486
}
487487
}
488488

489+
/**
490+
* Keep or establish the connection if no queries have been sent for
491+
* a length of time exceeding the server's idle timeout.
492+
*
493+
* @return void
494+
*/
495+
public function reconnect()
496+
{
497+
if ($this->ping() === false) {
498+
$this->close();
499+
$this->initialize();
500+
}
501+
}
502+
489503
/**
490504
* Platform dependent way method for closing the connection.
491505
*

system/Database/MySQLi/Connection.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -234,20 +234,6 @@ public function connect(bool $persistent = false)
234234
return false;
235235
}
236236

237-
/**
238-
* Keep or establish the connection if no queries have been sent for
239-
* a length of time exceeding the server's idle timeout.
240-
*
241-
* @return void
242-
*/
243-
public function reconnect()
244-
{
245-
if ($this->ping() === false) {
246-
$this->close();
247-
$this->initialize();
248-
}
249-
}
250-
251237
/**
252238
* Close the database connection.
253239
*

system/Database/OCI8/Connection.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,20 +150,6 @@ public function connect(bool $persistent = false)
150150
: $func($this->username, $this->password, $this->DSN, $this->charset);
151151
}
152152

153-
/**
154-
* Keep or establish the connection if no queries have been sent for
155-
* a length of time exceeding the server's idle timeout.
156-
*
157-
* @return void
158-
*/
159-
public function reconnect()
160-
{
161-
if ($this->ping() === false) {
162-
$this->close();
163-
$this->initialize();
164-
}
165-
}
166-
167153
/**
168154
* Close the database connection.
169155
*

system/Database/Postgre/Connection.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,6 @@ private function convertDSN()
142142
$this->DSN = $output;
143143
}
144144

145-
/**
146-
* Keep or establish the connection if no queries have been sent for
147-
* a length of time exceeding the server's idle timeout.
148-
*
149-
* @return void
150-
*/
151-
public function reconnect()
152-
{
153-
if ($this->ping() === false) {
154-
$this->close();
155-
$this->initialize();
156-
}
157-
}
158-
159145
/**
160146
* Close the database connection.
161147
*

system/Database/SQLSRV/Connection.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -166,20 +166,6 @@ public function getAllErrorMessages(): string
166166
return implode("\n", $errors);
167167
}
168168

169-
/**
170-
* Keep or establish the connection if no queries have been sent for
171-
* a length of time exceeding the server's idle timeout.
172-
*
173-
* @return void
174-
*/
175-
public function reconnect()
176-
{
177-
if ($this->ping() === false) {
178-
$this->close();
179-
$this->initialize();
180-
}
181-
}
182-
183169
/**
184170
* Close the database connection.
185171
*

system/Database/SQLite3/Connection.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,6 @@ public function connect(bool $persistent = false)
119119
}
120120
}
121121

122-
/**
123-
* Keep or establish the connection if no queries have been sent for
124-
* a length of time exceeding the server's idle timeout.
125-
*
126-
* @return void
127-
*/
128-
public function reconnect()
129-
{
130-
if ($this->ping() === false) {
131-
$this->close();
132-
$this->initialize();
133-
}
134-
}
135-
136122
/**
137123
* Close the database connection.
138124
*

tests/system/Database/Live/PingTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public function testPingAfterReconnect(): void
6060
public function testPingCanBeUsedToCheckConnectionBeforeQuery(): void
6161
{
6262
if ($this->db->ping()) {
63-
$result = $this->db->query('SELECT 1');
63+
$sql = $this->db->DBDriver === 'OCI8' ? 'SELECT 1 FROM DUAL' : 'SELECT 1';
64+
$result = $this->db->query($sql);
6465
$this->assertNotFalse($result);
6566
} else {
6667
$this->fail('Connection should be alive');

0 commit comments

Comments
 (0)