Esempio n. 1
0
 public function init()
 {
     try {
         \Yii::$app->db->createCommand('OPEN SYMMETRIC KEY [key_DataShare] DECRYPTION BY CERTIFICATE [cert_keyProtection]; SELECT 1 as a; ')->execute();
     } catch (Exception $e) {
         Log::trace("Error : " . $e);
         throw new Exception("Error : " . $e);
     }
     parent::init();
 }
Esempio n. 2
0
 public function getNetPerfDatasetRep($cntr, $days = 2)
 {
     if (is_array($cntr)) {
         $counter = $cntr[0];
         $instance = $cntr[1];
     } else {
         $counter = $cntr;
     }
     if ($counter == 'disk') {
         try {
             $cmd = \Yii::$app->db->createCommand('exec dbo.usp_getNetRep :d;');
             $cmd->bindValue(':d', $days);
             $dataset = $cmd->queryAll();
         } catch (Exception $e) {
             Log::trace("Error : " . $e);
             throw new Exception("Error : " . $e);
         }
     }
     return !empty($dataset) ? $dataset : [[0, 0, 0, 0, 0]];
 }