$sql = "INSERT INTO
$this->table (
$this->idCol,
$this->tokenCol,
$this->expirationCol) VALUES (:id, :token, {
$this->
getCurrentTimestampStatement()} +
$this->initialTtl)";
$conn =
$this->
getConnection();
try { $stmt =
$conn->
prepare($sql);
} catch (\PDOException
) { if (!
$conn->
inTransaction() || \
in_array($this->driver,
['pgsql', 'sqlite', 'sqlsrv'
], true
)) { $this->
createTable();
} $stmt =
$conn->
prepare($sql);
} $stmt->
bindValue(':id',
$this->
getHashedKey($key));
$stmt->
bindValue(':token',
$this->
getUniqueToken($key));
try { $stmt->
execute();
} catch (\PDOException
) { // the lock is already acquired. It could be us. Let's try to put off.
$this->
putOffExpiration($key,
$this->initialTtl
);
} $this->
randomlyPrune();
$this->
checkNotExpired($key);
}