1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
hsphpreadconnection.php
См. документацию.
1<?php
8
9namespace Bitrix\Main\Data;
10
17{
18 protected $host = 'localhost';
19 protected $port = '9998';
20
22 {
23 parent::__construct($configuration);
24
25 // host validation
26 if (array_key_exists('host', $configuration))
27 {
28 if (!is_string($configuration['host']) || $configuration['host'] == "")
29 {
30 throw new \Bitrix\Main\Config\ConfigurationException("Invalid host parameter");
31 }
32
33 $this->host = $configuration['host'];
34 }
35
36 // port validation
37 if (array_key_exists('port', $configuration))
38 {
39 if (!is_string($configuration['port']) || $configuration['port'] == "")
40 {
41 throw new \Bitrix\Main\Config\ConfigurationException("Invalid port parameter");
42 }
43
44 $this->port = $configuration['port'];
45 }
46 }
47
48 protected function connectInternal()
49 {
50 if ($this->isConnected)
51 {
52 return;
53 }
54
55 $this->resource = new \HSPHP\ReadSocket();
56 $this->resource->connect($this->host, $this->port);
57 $this->isConnected = true;
58 }
59
60 protected function disconnectInternal()
61 {
62 }
63
64 public function get($key)
65 {
66 return null;
67 }
68
69 public function set($key, $value)
70 {
71 return null;
72 }
73
74 public function getEntityByPrimary(\Bitrix\Main\ORM\Entity $entity, $primary, $select)
75 {
76 $this->connectInternal();
77
78 $table = $entity->getDBTableName();
79 $sqlConfiguration = $entity->getConnection()->getConfiguration();
80
81 $primary = (array) $primary;
82
83 if (count($primary) > 1)
84 {
85 throw new \Exception('HSPHP Read Socket doesn\'t support multiple select');
86 }
87
88 $indexId = $this->resource->getIndexId($sqlConfiguration['database'], $table, '', join(',', (array) $select));
89 $this->resource->select($indexId, '=', $primary);
90 $response = $this->resource->readResponse();
91
92 //foreach
93 $result = array();
94
95 if (is_array($response))
96 {
97 foreach ($response as $row)
98 {
99 $newRow = array();
100
101 foreach ($row as $k => $v)
102 {
103 $newRow[$select[$k]] = $v;
104 }
105
106 $result[] = $newRow;
107 }
108 }
109
110 return $result;
111 }
112}
getEntityByPrimary(\Bitrix\Main\ORM\Entity $entity, $primary, $select)
Определения hsphpreadconnection.php:74
__construct(array $configuration)
Определения hsphpreadconnection.php:21
</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
$entity
$select
Определения iblock_catalog_list.php:194
Определения ufield.php:9
$table
Определения mysql_to_pgsql.php:36
if(empty($signedUserToken)) $key
Определения quickway.php:257
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$response
Определения result.php:21
$k
Определения template_pdf.php:567