选择语言 :

 Module_OOP_ORM_Data::value_increment

指定offset递增

通过这个方法改变值后,构造SQL时会是field_name=field_name+1,而不是field_name=2这样,可解决并发问题

$this Module_OOP_ORM_Data::value_increment( string $offset [, ing $value = integer 1 ] )

参数列表

参数 类型 描述 默认值
$offset string $offset
$value ing $value integer 1
返回值
  • $this
File: ./modules/oop/orm/data.class.php
public function value_increment($offset, $value=1)
{
    $this->$offset = $this->$offset + $value;

    $config = $this->_get_offset_config($offset);
    if ( ! $config ) continue;

    # 虚拟字段
    if ( $config['is_virtual_field'] ) continue;
    if ( ! isset($config['field_name']) ) continue;
    $field_name = $config['field_name'];

    $this->_value_increment[$field_name] = $value;

    return $this;
}