query类增加sequence方法 用于设置 自增序列名

This commit is contained in:
thinkphp
2016-05-19 12:38:11 +08:00
parent 34a6285ba2
commit e151d70f62
2 changed files with 16 additions and 3 deletions

View File

@@ -1059,6 +1059,18 @@ class Query
return $this;
}
/**
* 设置自增序列名
* @access public
* @param string $sequence 自增序列名
* @return $this
*/
public function sequence($sequence = null)
{
$this->options['sequence'] = $sequence;
return $this;
}
/**
* 获取数据表信息
* @access public
@@ -1312,7 +1324,7 @@ class Query
// 生成SQL语句
$sql = $this->builder()->insert($data, $options, $replace);
// 执行操作
return $this->execute($sql, $this->getBind(), $options['fetch_sql'], $getLastInsID);
return $this->execute($sql, $this->getBind(), $options['fetch_sql'], $getLastInsID, isset($options['sequence']) ? $options['sequence'] : null);
}
/**