Atualizando Database.class.php
This commit is contained in:
parent
f5e3846d27
commit
95deea4129
1 changed files with 27 additions and 17 deletions
44
vendor/model/Database.class.php
vendored
44
vendor/model/Database.class.php
vendored
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue