1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
hsphpreadconnection.php
См. документацию.
1
<?php
8
9
namespace
Bitrix\Main\Data;
10
16
class
HsphpReadConnection
extends
NosqlConnection
implements
\Bitrix\Main\ORM\Query\INosqlPrimarySelector
17
{
18
protected
$host
=
'localhost'
;
19
protected
$port
=
'9998'
;
20
21
public
function
__construct
(
array
$configuration
)
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
}
Bitrix\Main\Data\Connection\$configuration
$configuration
Определения
connection.php:21
Bitrix\Main\Data\Connection\isConnected
isConnected()
Определения
connection.php:62
Bitrix\Main\Data\HsphpReadConnection
Определения
hsphpreadconnection.php:17
Bitrix\Main\Data\HsphpReadConnection\getEntityByPrimary
getEntityByPrimary(\Bitrix\Main\ORM\Entity $entity, $primary, $select)
Определения
hsphpreadconnection.php:74
Bitrix\Main\Data\HsphpReadConnection\connectInternal
connectInternal()
Определения
hsphpreadconnection.php:48
Bitrix\Main\Data\HsphpReadConnection\disconnectInternal
disconnectInternal()
Определения
hsphpreadconnection.php:60
Bitrix\Main\Data\HsphpReadConnection\$host
$host
Определения
hsphpreadconnection.php:18
Bitrix\Main\Data\HsphpReadConnection\$port
$port
Определения
hsphpreadconnection.php:19
Bitrix\Main\Data\HsphpReadConnection\__construct
__construct(array $configuration)
Определения
hsphpreadconnection.php:21
Bitrix\Main\Data\NosqlConnection
Определения
nosqlconnection.php:12
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$entity
$entity
Определения
group_bizproc_workflow_delete.php:17
$select
$select
Определения
iblock_catalog_list.php:194
Bitrix\Main\ORM\Query\INosqlPrimarySelector
Определения
inosqlprimaryselector.php:14
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main\ORM
Bitrix\Main
Bitrix\Main\$table
$table
Определения
mysql_to_pgsql.php:36
Bitrix
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
count
</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
$response
Определения
result.php:21
$k
$k
Определения
template_pdf.php:567
bitrix
modules
main
lib
data
hsphpreadconnection.php
Создано системой
1.14.0