Ensure identifier uniqueness in Disposable FullTextSearch
This commit is contained in:
parent
abd5768044
commit
7397b38763
1 changed files with 6 additions and 6 deletions
|
@ -37,12 +37,12 @@ class DisposableFullTextSearch
|
||||||
{
|
{
|
||||||
$this->db = $database;
|
$this->db = $database;
|
||||||
|
|
||||||
// Unique identifier generation. Two DisposableFullTextSearch object should never have the same as the first object destruction
|
do {
|
||||||
// would delete both check-full-text-search rows, before the second object destruction is called, leading to unexpected behavior.
|
// Unique identifier generation. Two DisposableFullTextSearch object should never have the same as the first object destruction
|
||||||
// Maximum value is indicated by the INT UNSIGNED type of the check-full-text-search.pid field
|
// would delete both check-full-text-search rows before the second object destruction is called, leading to unexpected behavior.
|
||||||
$this->identifier = random_int(0, pow(2, 32) - 1);
|
// Maximum value is indicated by the INT UNSIGNED type of the check-full-text-search.pid field
|
||||||
|
$this->identifier = random_int(0, pow(2, 32) - 1);
|
||||||
$this->db->insert('check-full-text-search', ['pid' => $this->identifier, 'searchtext' => $haystack], Database::INSERT_UPDATE);
|
} while($this->db->insert('check-full-text-search', ['pid' => $this->identifier, 'searchtext' => $haystack]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
|
|
Loading…
Reference in a new issue