gestionTablePrefix = BddConstant::DEFAULT_TABLE_PREFIX ."gestion_"; $this->defaultTablePrefix = BddConstant::DEFAULT_TABLE_PREFIX; $this->pdo = $db; } private function execSQL($sql, $conditions){ $stmt = $this->pdo->prepare($sql); $stmt->execute($conditions); $data = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); return json_encode($data); } private function execSQLNoData($sql, $conditions){ $stmt = $this->pdo->prepare($sql); $stmt->execute($conditions); $stmt->closeCursor(); } private function execSQLNoJsonReturn($sql, $conditions){ $stmt = $this->pdo->prepare($sql); $stmt->execute($conditions); $data = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); return $data; } public function getProvidersList(){ $sql = "SELECT * FROM ".$this->gestionTablePrefix."provider as provider"; return $this->execSQLNoJsonReturn($sql,[]); } public function createDefaultProvider($idNextCloud){ $sql = "INSERT INTO `".$this->gestionTablePrefix."provider` ( `id_nextcloud` ) VALUES (?);"; $this->execSQLNoData($sql, array( $idNextCloud ) ); } public function getProviderCount(){ $count = 0; $sql = "SELECT COUNT(provider.id) as provider_count FROM ".$this->gestionTablePrefix."provider as provider;"; $result = $this->execSQLNoJsonReturn($sql,[]); if(!empty($result)){ $count = $result[0]["provider_count"]; } return $count; } }