Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
mssqlresult.php
1<?php
2namespace Bitrix\Main\DB;
3
4class MssqlResult extends Result
5{
7 private $resultFields = null;
8
14 public function __construct($result, Connection $dbConnection = null, \Bitrix\Main\Diag\SqlTrackerQuery $trackerQuery = null)
15 {
16 parent::__construct($result, $dbConnection, $trackerQuery);
17 }
18
24 public function getFields()
25 {
26 if ($this->resultFields == null)
27 {
28 $this->resultFields = array();
29 if (is_resource($this->resource))
30 {
31 $fields = sqlsrv_field_metadata($this->resource);
32 if ($fields && $this->connection)
33 {
34 $helper = $this->connection->getSqlHelper();
35 foreach ($fields as $value)
36 {
37 $name = ($value["Name"] <> ''? $value["Name"]: uniqid());
38 $parameters = array(
39 "size" => $value["Size"],
40 "scale" => $value["Scale"],
41 );
42 $this->resultFields[$name] = $helper->getFieldByColumnType($name, $value["Type"], $parameters);
43 }
44 }
45 }
46 }
47
48 return $this->resultFields;
49 }
50
56 public function getSelectedRowsCount()
57 {
58 return sqlsrv_num_rows($this->resource);
59 }
60
66 protected function fetchRowInternal()
67 {
68 return sqlsrv_fetch_array($this->resource, SQLSRV_FETCH_ASSOC);
69 }
70}
__construct($result, Connection $dbConnection=null, \Bitrix\Main\Diag\SqlTrackerQuery $trackerQuery=null)