mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
修正selectInsert方法字段数不一致错误
mssql中为实现排序增加了row_number列,导致在selectInsert方法中字段数不一致。 修正方法:定义selectInsertSql属性,重写selectInsert方法。
This commit is contained in:
@@ -19,6 +19,7 @@ use think\db\Builder;
|
||||
class Sqlsrv extends Builder
|
||||
{
|
||||
protected $selectSql = 'SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER (%ORDER%) AS ROW_NUMBER FROM (SELECT %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%) AS thinkphp) AS T1 %LIMIT%%COMMENT%';
|
||||
protected $selectInsertSql = 'SELECT %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%';
|
||||
protected $updateSql = 'UPDATE %TABLE% SET %SET% %JOIN% %WHERE% %LIMIT% %LOCK%%COMMENT%';
|
||||
protected $deleteSql = 'DELETE FROM %TABLE% %USING% %JOIN% %WHERE% %LIMIT% %LOCK%%COMMENT%';
|
||||
|
||||
@@ -78,5 +79,10 @@ class Sqlsrv extends Builder
|
||||
}
|
||||
return 'WHERE ' . $limitStr;
|
||||
}
|
||||
public function selectInsert($fields, $table, $options)
|
||||
{
|
||||
$this->selectSql=$this->selectInsertSql;
|
||||
return parent::selectInsert($fields, $table, $options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user