Atualizando Database.class.php

This commit is contained in:
Kenio 2025-08-25 14:18:04 -03:00
parent f5e3846d27
commit 95deea4129

View file

@ -128,21 +128,31 @@ class Database
:last_modified,
:db_accessible)';
/** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql);
try{
/** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Inicia a transação */
$this->connection->connect()->beginTransaction();
/** Inicia a transação */
$this->connection->connect()->beginTransaction();
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam(':client_id', $this->clientId);
$this->stmt->bindParam(':file_size', $this->fileSize);
$this->stmt->bindParam(':last_modified', $this->lastModified);
$this->stmt->bindParam(':db_accessible', $this->dbAccessible);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam(':client_id', $this->clientId);
$this->stmt->bindParam(':file_size', $this->fileSize);
$this->stmt->bindParam(':last_modified', $this->lastModified);
$this->stmt->bindParam(':db_accessible', $this->dbAccessible);
/** Executo o SQL */
$this->stmt->execute();
/** Executo o SQL */
$this->stmt->execute();
} catch (\Exception $exception) {
/** Desfaz a transação */
$this->connection->connect()->rollback();
/** Informo */
throw new InvalidArgumentException($exception->getMessage(), 0);
}
}
@ -156,10 +166,11 @@ class Database
$this->sql = 'delete from db
where client_id = :client_id';
/** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql);
try {
try {
/** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Inicia a transação */
$this->connection->connect()->beginTransaction();
@ -179,9 +190,8 @@ class Database
/** Desfaz a transação */
$this->connection->connect()->rollback();
/** Captura o erro */
array_push($this->errors, 'Error:: ' . $exception->getMessage());
return false;
/** Informo */
throw new InvalidArgumentException($exception->getMessage(), 0);
}
}