protected function forget($key)
 {
     //$sql="delete from arframeworkcache where name='".$key."'";
     $key = $this->hash($key);
     return Database::exec("delete from " . $this->DatabaseTableName() . " where name='" . $key . "'");
 }
Example #2
0
 /**
  * Update the existing row in migration datatable
  */
 protected static function updateRow($status, $name, $time)
 {
     $table = self::getMigrationTable();
     Database::exec("update {$table} set status_schema='{$status}' where name_schema='{$name}' and date_schema='{$time}'");
 }
Example #3
0
 public function edit()
 {
     $sql = "update " . $this->DBtable . " set ";
     //
     $data = $this->getData();
     unset($data["primaryKey"]);
     // Beta 27/05/2016
     //
     $i = 0;
     //
     foreach ($data as $key => $value) {
         if ($i == 0) {
             $sql .= "{$key}='{$value}'";
         } else {
             $sql .= ",{$key}='{$value}'";
         }
         $i++;
     }
     if ($this->isMaj) {
         if ($i == 0) {
             $sql .= "edited_at='" . Time::now() . "'";
         } else {
             $sql .= ",edited_at='" . Time::now() . "'";
         }
     }
     //
     $key = $this->getPKvalue();
     $sql .= " where " . $this->primaryKey . "='" . $key . "'";
     //
     //return $data;
     return Database::exec($sql);
 }
Example #4
0
 public static function remove($nom, $colmuns)
 {
     $name = self::tableName($nom);
     //
     self::$main_sql = "alter table " . $name . " ";
     //
     if (is_array($colmuns)) {
         // foreach ($colmuns as $value) {
         for ($i = 0; $i < count($colmuns); $i++) {
             if ($i == count($colmuns) - 1) {
                 self::$main_sql .= " drop " . $colmuns[$i];
             } else {
                 self::$main_sql .= " drop " . $colmuns[$i] . ",";
             }
         }
     } else {
         self::$main_sql .= " drop " . $colmuns;
     }
     //
     return Database::exec(self::$main_sql);
 }
Example #5
0
 public function clear()
 {
     Database::exec('TRUNCATE TABLE ' . $this->name . ';');
 }