Пример #1
0
 public function load(CM_OutputStream_Interface $output)
 {
     $client = $this->getServiceManager()->getDatabases()->getMaster();
     $query = new CM_Db_Query_Insert($client, 'cm_requestClientCounter', ['counter' => 0]);
     $query->execute();
     $this->_setLoaded(true);
 }
Пример #2
0
 /**
  * @param string $key
  * @param mixed  $value
  */
 public function set($key, $value)
 {
     $fields = array('key' => $key, 'value' => serialize($value));
     $query = new CM_Db_Query_Insert($this->_getDatabaseClient(), 'cm_option', $fields, null, null, 'REPLACE');
     $query->execute();
     $this->_clearCache();
 }
Пример #3
0
 public function load(CM_OutputStream_Interface $output)
 {
     $dbClient = $this->getServiceManager()->getDatabases()->getMaster();
     $values = Functional\map($this->_getAllTypes(), function ($className, $type) {
         return [$type, $className];
     });
     $query = new CM_Db_Query_Truncate($dbClient, 'cm_tmp_classType');
     $query->execute();
     $query = new CM_Db_Query_Insert($dbClient, 'cm_tmp_classType', ['type', 'className'], $values, null, 'REPLACE');
     $query->execute();
 }
Пример #4
0
 /**
  * @param string            $table
  * @param string|array      $fields Column-name OR Column-names array OR associative field=>value pair
  * @param string|array|null $values Column-value OR Column-values array OR Multiple Column-values array(array)
  * @param array|null        $onDuplicateKeyValues
  * @param string|null       $statement
  * @return string|null
  */
 public static function insert($table, $fields, $values = null, array $onDuplicateKeyValues = null, $statement = null)
 {
     if (null === $statement) {
         $statement = 'INSERT';
     }
     $client = self::getClient();
     $query = new CM_Db_Query_Insert($client, $table, $fields, $values, $onDuplicateKeyValues, $statement);
     $query->execute();
     return $client->getLastInsertId();
 }