1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
pgsqlresult.php
См. документацию.
1<?php
2namespace Bitrix\Main\DB;
3
4class PgsqlResult extends Result
5{
7 protected $resource;
8
10 private $resultFields = null;
11
17 public function getSelectedRowsCount()
18 {
19 return pg_num_rows($this->resource);
20 }
21
27 public function getFieldsCount(): int
28 {
29 return pg_num_fields($this->resource);
30 }
31
37 public function getFields()
38 {
39 if ($this->resultFields == null)
40 {
41 $this->resultFields = array();
42
43 if (
44 $this->connection
45 && (is_resource($this->resource) || is_object($this->resource))
46 )
47 {
48 $fields = pg_num_fields($this->resource);
49 if ($fields)
50 {
51 $helper = $this->connection->getSqlHelper();
52 for ($i = 0; $i < $fields; $i++)
53 {
54 $fieldName = mb_strtoupper(pg_field_name($this->resource, $i));
55 $fieldType = pg_field_type($this->resource, $i);
56 $this->resultFields[$fieldName] = $helper->getFieldByColumnType($fieldName, $fieldType);
57 }
58 }
59 }
60 }
61
62 return $this->resultFields;
63 }
64
65 protected $byteaFields = false;
66
72 protected function fetchRowInternal()
73 {
74 $result = pg_fetch_assoc($this->resource);
75 if ($result)
76 {
77 if ($this->byteaFields === false)
78 {
79 $this->byteaFields = [];
80 $fieldNum = 0;
81 foreach ($result as $fieldName => $_)
82 {
83 $fieldType = pg_field_type($this->resource, $fieldNum);
84 if ($fieldType === 'bytea')
85 {
86 $this->byteaFields[$fieldName] = $fieldType;
87 }
88 $fieldNum++;
89 }
90 }
91
92 if ($this->byteaFields)
93 {
94 foreach ($this->byteaFields as $fieldName => $fieldType)
95 {
96 $result[$fieldName] = pg_unescape_bytea($result[$fieldName]);
97 }
98 }
99
100 return array_change_key_case($result, \CASE_UPPER);
101 }
102 else
103 {
104 return $result;
105 }
106 }
107}
getSelectedRowsCount()
Определения pgsqlresult.php:17
fetchRowInternal()
Определения pgsqlresult.php:72
Определения result.php:20
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$i
Определения factura.php:643
$fields
Определения yandex_run.php:501