1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
database.php
См. документацию.
1<?php
2
9
10use Bitrix\Main;
13
14abstract class CAllDatabase
15{
21 var $debug;
27 var $type;
29 var $column_cache = [];
34 var $obSlave = null;
35 static $arNodes = [];
39 protected $connection; // d7 connection
40 protected $connectionName = null;
45 var $cntQuery = 0;
50 var $timeQuery = 0.0;
55 var $arQueryDebug = [];
59 public $sqlTracker = null;
60
61 public function StartUsingMasterOnly()
62 {
63 Main\Application::getInstance()->getConnectionPool()->useMasterOnly(true);
64 }
65
66 public function StopUsingMasterOnly()
67 {
68 Main\Application::getInstance()->getConnectionPool()->useMasterOnly(false);
69 }
70
71 public function getConnection()
72 {
73 $this->Doconnect();
74
75 return $this->connection;
76 }
77
85 public static function GetDBNodeConnection($node_id, $bIgnoreErrors = false, $bCheckStatus = true)
86 {
87 global $DB;
88
89 if (!array_key_exists($node_id, self::$arNodes))
90 {
91 if (CModule::IncludeModule('cluster'))
92 {
93 self::$arNodes[$node_id] = CClusterDBNode::GetByID($node_id);
94 }
95 else
96 {
97 self::$arNodes[$node_id] = false;
98 }
99 }
100 $node = &self::$arNodes[$node_id];
101
102 if (
103 is_array($node)
104 && (
105 !$bCheckStatus
106 || (
107 $node["ACTIVE"] == "Y"
108 && ($node["STATUS"] == "ONLINE" || $node["STATUS"] == "READY")
109 )
110 )
111 && !isset($node["ONHIT_ERROR"])
112 )
113 {
114 if (!array_key_exists("DB", $node))
115 {
116 $node_DB = new CDatabase;
117 $node_DB->type = $DB->type;
118 $node_DB->debug = $DB->debug;
119 $node_DB->DebugToFile = $DB->DebugToFile;
120 $node_DB->bNodeConnection = true;
121 $node_DB->node_id = $node_id;
122
123 if ($node_DB->Connect($node["DB_HOST"], $node["DB_NAME"], $node["DB_LOGIN"], $node["DB_PASSWORD"], "node" . $node_id))
124 {
125 if (Main\Application::getConnection("node" . $node_id)?->isDeferred())
126 {
127 if ($node_DB->DoConnect("node" . $node_id))
128 {
129 $node["DB"] = $node_DB;
130 }
131 }
132 else
133 {
134 $node["DB"] = $node_DB;
135 }
136 }
137 }
138
139 if (array_key_exists("DB", $node))
140 {
141 return $node["DB"];
142 }
143 }
144
145 if ($bIgnoreErrors)
146 {
147 return false;
148 }
149 else
150 {
151 static::showConnectionError();
152 die();
153 }
154 }
155
156 public static function showConnectionError()
157 {
159 $response->setStatus('500 Internal Server Error');
160 $response->writeHeaders();
161
162 if (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/dbconn_error.php"))
163 {
164 include($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/dbconn_error.php");
165 }
166 else
167 {
168 echo "Error connecting to database. Please try again later.";
169 }
170 }
171
180 public static function GetModuleConnection($module_id, $bModuleInclude = false)
181 {
182 $node_id = COption::GetOptionString($module_id, "dbnode_id", "N");
183 if (is_numeric($node_id))
184 {
185 if ($bModuleInclude)
186 {
187 $status = COption::GetOptionString($module_id, "dbnode_status", "ok");
188 if ($status === "move")
189 {
190 return false;
191 }
192 }
193
194 $moduleDB = CDatabase::GetDBNodeConnection($node_id, $bModuleInclude);
195
196 if (is_object($moduleDB))
197 {
198 $moduleDB->bModuleConnection = true;
199 return $moduleDB;
200 }
201
202 //There was a connection error
203 if ($bModuleInclude && CModule::IncludeModule('cluster'))
204 {
206 }
207
208 //TODO: unclear what to return when node went offline
209 //in the middle of the hit.
210 return false;
211 }
212 else
213 {
214 return $GLOBALS["DB"];
215 }
216 }
217
222 {
223 $this->DBHost = $DBHost;
224 $this->DBName = $DBName;
225 $this->DBLogin = $DBLogin;
226 $this->DBPassword = $DBPassword;
227 $this->connectionName = $connectionName;
228
230 {
231 return true;
232 }
233 else
234 {
235 return $this->DoConnect($connectionName);
236 }
237 }
238
239 public function DoConnect($connectionName = '')
240 {
241 if ($this->connection && $this->connection->isConnected())
242 {
243 // the connection can reconnect outside
244 $this->db_Conn = $this->connection->getResource();
245 return true;
246 }
247
249
250 $found = false;
251
252 // try to get a connection by its name
253 $connection = $application->getConnection($connectionName ?: (string)$this->connectionName);
254
255 if ($connection instanceof Main\DB\Connection)
256 {
257 // empty connection data, using the default connection
258 if ((string)$this->DBHost === '')
259 {
260 $found = true;
261
262 $this->DBHost = $connection->getHost();
263 $this->DBName = $connection->getDatabase();
264 $this->DBLogin = $connection->getLogin();
265 $this->DBPassword = $connection->getPassword();
266 }
267
268 // or specific connection data
269 if (!$found)
270 {
271 $found = (
272 $this->DBHost == $connection->getHost()
273 && $this->DBName == $connection->getDatabase()
274 && $this->DBLogin == $connection->getLogin()
275 );
276 }
277 }
278
279 // connection not found, adding the new connection to the pool
280 if (!$found)
281 {
282 if ((string)$connectionName === '')
283 {
284 $connectionName = "{$this->DBHost}.{$this->DBName}.{$this->DBLogin}";
285 }
286
287 $parameters = [
288 'host' => $this->DBHost,
289 'database' => $this->DBName,
290 'login' => $this->DBLogin,
291 'password' => $this->DBPassword,
292 ];
293
294 $connection = $application->getConnectionPool()->cloneConnection(
295 ConnectionPool::DEFAULT_CONNECTION_NAME,
297 $parameters
298 );
299
300 if ($this->bNodeConnection && ($connection instanceof Main\DB\Connection))
301 {
302 $connection->setNodeId($this->node_id);
303 }
304
305 $found = true;
306 }
307
308 if ($found)
309 {
310 // real connection establishes here
311 $this->db_Conn = $connection->getResource();
312
313 $this->connection = $connection;
314 $this->sqlTracker = null;
315 $this->cntQuery = 0;
316 $this->timeQuery = 0;
317 $this->arQueryDebug = [];
318
319 return true;
320 }
321
322 return false;
323 }
324
325 public function startSqlTracker()
326 {
327 if (!$this->sqlTracker)
328 {
330 $this->sqlTracker = $app->getConnection()->startTracker();
331 }
332 return $this->sqlTracker;
333 }
334
335 public function GetVersion()
336 {
337 if (!$this->version)
338 {
339 $this->version = $this->connection->getVersion()[0];
340 }
341
342 return $this->version;
343 }
344
345 public function GetNowFunction()
346 {
347 return $this->CurrentTimeFunction();
348 }
349
350 public function GetNowDate()
351 {
352 return $this->CurrentDateFunction();
353 }
354
355 public function DateToCharFunction($strFieldName, $strType = "FULL", $lang = false, $bSearchInSitesOnly = false)
356 {
357 static $CACHE = [];
358
359 $id = $strType . ',' . $lang . ',' . $bSearchInSitesOnly;
360 if (!isset($CACHE[$id]))
361 {
362 if ($lang === false && ($context = Context::getCurrent()) && ($culture = $context->getCulture()) !== null)
363 {
364 $format = ($strType == "FULL" ? $culture->getFormatDatetime() : $culture->getFormatDate());
365 }
366 else
367 {
368 $format = CLang::GetDateFormat($strType, $lang, $bSearchInSitesOnly);
369 }
370 $CACHE[$id] = $this->DateFormatToDB($format);
371 }
372
373 $sFieldExpr = $strFieldName;
374
375 //time zone
376 if ($strType == "FULL" && CTimeZone::Enabled())
377 {
378 $diff = CTimeZone::GetOffset();
379
380 if ($diff <> 0)
381 {
382 $sFieldExpr = $this->connection->getSqlHelper()->addSecondsToDateTime($diff, $strFieldName);
383 }
384 }
385
386 return str_replace("#FIELD#", $sFieldExpr, $CACHE[$id]);
387 }
388
389 public function CharToDateFunction($strValue, $strType = "FULL", $lang = false)
390 {
391 // get user time
392 if ($strValue instanceof Main\Type\DateTime && !$strValue->isUserTimeEnabled())
393 {
394 $strValue = clone $strValue;
395 $strValue->toUserTime();
396 }
397
398 // format
399 if ($lang === false && ($context = Context::getCurrent()) && ($culture = $context->getCulture()) !== null)
400 {
401 $format = ($strType == "FULL" ? $culture->getFormatDatetime() : $culture->getFormatDate());
402 }
403 else
404 {
405 $format = CLang::GetDateFormat($strType, $lang);
406 }
407
408 $sFieldExpr = "'" . CDatabase::FormatDate($strValue, $format, ($strType == "SHORT" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:MI:SS")) . "'";
409
410 //time zone
411 if ($strType == "FULL" && CTimeZone::Enabled())
412 {
413 $diff = CTimeZone::GetOffset();
414
415 if ($diff <> 0)
416 {
417 $this->Doconnect();
418 $sFieldExpr = $this->connection->getSqlHelper()->addSecondsToDateTime(-$diff, $sFieldExpr);
419 }
420 }
421
422 return $sFieldExpr;
423 }
424
425 public function Concat()
426 {
427 $this->Doconnect();
428 return call_user_func_array([$this->connection->getSqlHelper(), 'getConcatFunction'], func_get_args());
429 }
430
431 public function Substr($str, $from, $length = null)
432 {
433 // works for mysql and oracle, redefined for mssql
434 $sql = 'SUBSTR(' . $str . ', ' . $from;
435
436 if (!is_null($length))
437 {
438 $sql .= ', ' . $length;
439 }
440
441 return $sql . ')';
442 }
443
444 public function IsNull($expression, $result)
445 {
446 $this->Doconnect();
447 return $this->connection->getSqlHelper()->getIsNullFunction($expression, $result);
448 }
449
450 public function Length($field)
451 {
452 $this->Doconnect();
453 return $this->connection->getSqlHelper()->getLengthFunction($field);
454 }
455
456 public function ToChar($expr, $len = 0)
457 {
458 return "CAST(" . $expr . " AS CHAR" . ($len > 0 ? "(" . $len . ")" : "") . ")";
459 }
460
461 public function ToNumber($expr)
462 {
463 return "CAST(" . $expr . " AS SIGNED)";
464 }
465
466 public static function DateFormatToPHP($format)
467 {
468 static $cache = [];
469 if (!isset($cache[$format]))
470 {
471 $cache[$format] = Main\Type\Date::convertFormatToPhp($format);
472 }
473 return $cache[$format];
474 }
475
476 public static function FormatDate($strDate, $format = "DD.MM.YYYY HH:MI:SS", $new_format = "DD.MM.YYYY HH:MI:SS")
477 {
478 if (empty($strDate))
479 {
480 return false;
481 }
482
483 if ($format === false && defined("FORMAT_DATETIME"))
484 {
485 $format = FORMAT_DATETIME;
486 }
487
488 $fromPhpFormat = Main\Type\Date::convertFormatToPhp($format);
489
490 $time = false;
491 try
492 {
493 $time = new Main\Type\DateTime($strDate, $fromPhpFormat);
494 }
495 catch (Main\ObjectException)
496 {
497 }
498
499 if ($time !== false)
500 {
501 //Compatibility issue
502 $fixed_format = preg_replace(
503 [
504 "/(?<!Y)Y(?!Y)/i",
505 "/(?<!M)M(?![MI])/i",
506 "/(?<!D)D(?!D)/i",
507 "/(?<!H)H:I:S/i",
508 ],
509 [
510 "YYYY",
511 "MM",
512 "DD",
513 "HH:MI:SS",
514 ],
515 mb_strtoupper($new_format)
516 );
517 $toPhpFormat = Main\Type\Date::convertFormatToPhp($fixed_format);
518
519 return $time->format($toPhpFormat);
520 }
521
522 return false;
523 }
524
525 public function TopSql($strSql, $nTopCount)
526 {
527 $nTopCount = intval($nTopCount);
528 if ($nTopCount > 0)
529 {
530 return $strSql . "\nLIMIT " . $nTopCount;
531 }
532 else
533 {
534 return $strSql;
535 }
536 }
537
538 public function LastID()
539 {
540 $this->DoConnect();
541 return $this->connection->getInsertedId();
542 }
543
544 public function GetTableFieldsList($table)
545 {
546 return array_keys($this->GetTableFields($table));
547 }
548
556 public function Query($strSql, $bIgnoreErrors = false, $error_position = "", $arOptions = [])
557 {
558 global $DB;
559
560 $this->DoConnect();
561 $this->db_Error = "";
562
563 if ($this->DebugToFile || $DB->ShowSqlStat)
564 {
565 $start_time = microtime(true);
566 }
567
568 //We track queries for DML statements
569 //and when there is no one we can choose
570 //to run query against master connection
571 //or replicated one
572 $connectionPool = Main\Application::getInstance()->getConnectionPool();
573
574 if ($connectionPool->isMasterOnly())
575 {
576 //We requested to process all queries
577 //by master connection
578 }
579 elseif ($this->bModuleConnection)
580 {
581 //In case of dedicated module database
582 //were is nothing to do
583 }
584 elseif (isset($arOptions["fixed_connection"]))
585 {
586 //We requested to process this query
587 //by current connection
588 }
589 elseif ($this->bNodeConnection)
590 {
591 //It is node so nothing to do
592 }
593 else
594 {
595 if (isset($arOptions["ignore_dml"]))
596 {
597 $connectionPool->ignoreDml(true);
598 }
599
600 $connection = $connectionPool->getSlaveConnection($strSql);
601
602 if (isset($arOptions["ignore_dml"]))
603 {
604 $connectionPool->ignoreDml(false);
605 }
606
607 if ($connection !== null)
608 {
609 if (!isset($this->obSlave))
610 {
611 $nodeId = $connection->getNodeId();
612
613 ob_start();
614 $conn = CDatabase::GetDBNodeConnection($nodeId, true);
615 ob_end_clean();
616
617 if (is_object($conn))
618 {
619 $this->obSlave = $conn;
620 }
621 else
622 {
623 self::$arNodes[$nodeId]["ONHIT_ERROR"] = true;
625 }
626 }
627
628 if (is_object($this->obSlave))
629 {
630 return $this->obSlave->Query($strSql, $bIgnoreErrors, $error_position, $arOptions);
631 }
632 }
633 }
634
635 $result = $this->QueryInternal($strSql);
636
637 if ($this->DebugToFile || $DB->ShowSqlStat)
638 {
640 $exec_time = round(microtime(true) - $start_time, 10);
641
642 if ($DB->ShowSqlStat)
643 {
644 $DB->addDebugQuery($strSql, $exec_time, $connectionPool->isSlavePossible() ? $this->node_id : -1);
645 }
646
647 if ($this->DebugToFile)
648 {
649 $this->startSqlTracker()->writeFileLog($strSql, $exec_time, "CONN: " . $this->getThreadId());
650 }
651 }
652
653 if (!$result)
654 {
655 $this->db_Error = $this->GetError();
656 $this->db_ErrorSQL = $strSql;
657 if (!$bIgnoreErrors)
658 {
659 if ($this->DebugToFile)
660 {
661 $this->startSqlTracker()->writeFileLog("ERROR: " . $this->db_Error, 0, "CONN: " . $this->getThreadId());
662 }
663
664 if (defined('ERROR_EMAIL') && ERROR_EMAIL != '')
665 {
666 $error_position = preg_replace("#<br[^>]*>#i", "\n", $error_position);
667 SendError($error_position . "\nQuery Error:\n" . $strSql . " \n [" . $this->db_Error . "]\n---------------\n\n");
668 }
669
670 throw $this->connection->createQueryException($this->GetErrorCode(), $this->db_Error, $strSql);
671 }
672 return false;
673 }
674
675 $res = new CDBResult($result);
676 $res->DB = $this;
677 if ($DB->ShowSqlStat)
678 {
679 $res->SqlTraceIndex = count($DB->arQueryDebug) - 1;
680 }
681 return $res;
682 }
683
684 public function QueryBind($strSql, $arBinds, $bIgnoreErrors = false)
685 {
686 return $this->Query($strSql, $bIgnoreErrors);
687 }
688
692 public function QueryLong($strSql, $bIgnoreErrors = false)
693 {
694 return $this->Query($strSql, $bIgnoreErrors);
695 }
696
697 public function ForSql($strValue, $iMaxLength = 0)
698 {
699 $this->Doconnect();
700 return $this->connection->getSqlHelper()->forSql($strValue, $iMaxLength);
701 }
702
703 public function TableExists($tableName)
704 {
705 $this->DoConnect();
706 return $this->connection->isTableExists($tableName);
707 }
708
709 public function quote($identifier)
710 {
711 $this->Doconnect();
712 return $this->connection->getSqlHelper()->quote($identifier);
713 }
714
715 abstract public function PrepareInsert($strTableName, $arFields);
716
717 abstract public function PrepareUpdate($strTableName, $arFields);
718
719 public function PrepareUpdateJoin($strTableName, $arFields, $from, $where)
720 {
721 return '';
722 }
723
724 public function Update($table, $arFields, $WHERE = "", $error_position = "", $DEBUG = false, $ignore_errors = false, $additional_check = true)
725 {
726 $rows = 0;
727 if (is_array($arFields))
728 {
729 $ar = [];
730 foreach ($arFields as $field => $value)
731 {
732 if ((string)$value == '')
733 {
734 $ar[] = $this->quote($field) . " = ''";
735 }
736 else
737 {
738 $ar[] = $this->quote($field) . " = " . $value;
739 }
740 }
741
742 if (!empty($ar))
743 {
744 $strSql = "UPDATE " . $table . " SET " . implode(", ", $ar) . " " . $WHERE;
745 if ($DEBUG)
746 {
747 echo "<br>" . htmlspecialcharsEx($strSql) . "<br>";
748 }
749 $w = $this->Query($strSql, $ignore_errors, $error_position);
750 if (is_object($w))
751 {
752 $rows = $w->AffectedRowsCount();
753 if ($DEBUG)
754 {
755 echo "affected_rows = " . $rows . "<br>";
756 }
757
758 if ($rows <= 0 && $additional_check)
759 {
760 $w = $this->Query("SELECT 'x' FROM " . $table . " " . $WHERE, $ignore_errors, $error_position);
761 if (is_object($w))
762 {
763 if ($w->Fetch())
764 {
765 $rows = $w->SelectedRowsCount();
766 }
767 if ($DEBUG)
768 {
769 echo "num_rows = " . $rows . "<br>";
770 }
771 }
772 }
773 }
774 }
775 }
776 return $rows;
777 }
778
779 public function InitTableVarsForEdit($tablename, $strIdentFrom = "str_", $strIdentTo = "str_", $strSuffixFrom = "", $bAlways = false)
780 {
781 $fields = $this->GetTableFields($tablename);
782 foreach ($fields as $strColumnName => $field)
783 {
784 $varnameFrom = $strIdentFrom . $strColumnName . $strSuffixFrom;
785 $varnameTo = $strIdentTo . $strColumnName;
786 global ${$varnameFrom}, ${$varnameTo};
787 if ((isset(${$varnameFrom}) || $bAlways))
788 {
789 if (is_array(${$varnameFrom}))
790 {
791 ${$varnameTo} = [];
792 foreach (${$varnameFrom} as $k => $v)
793 {
794 ${$varnameTo}[$k] = htmlspecialcharsbx($v);
795 }
796 }
797 else
798 {
799 ${$varnameTo} = htmlspecialcharsbx(${$varnameFrom});
800 }
801 }
802 }
803 }
804
810 public function ParseSqlBatch($strSql)
811 {
812 $this->DoConnect();
813 return $this->connection->parseSqlBatch($strSql);
814 }
815
816 public function RunSQLBatch($filepath)
817 {
818 if (!file_exists($filepath) || !is_file($filepath))
819 {
820 return ["File $filepath is not found."];
821 }
822
823 $arErr = [];
824 $contents = file_get_contents($filepath);
825
826 $this->DoConnect();
827 foreach ($this->connection->parseSqlBatch($contents) as $strSql)
828 {
829 if (!$this->Query($strSql, true))
830 {
831 $arErr[] = "<hr><pre>Query:\n" . $strSql . "\n\nError:\n<font color=red>" . $this->GetErrorMessage() . "</font></pre>";
832 }
833 }
834
835 if (!empty($arErr))
836 {
837 return $arErr;
838 }
839
840 return false;
841 }
842
843 public function IsDate($value, $format = false, $lang = false, $format_type = "SHORT")
844 {
845 if ($format === false)
846 {
847 $format = CLang::GetDateFormat($format_type, $lang);
848 }
849 return CheckDateTime($value, $format);
850 }
851
852 public function GetErrorMessage()
853 {
854 if (is_object($this->obSlave) && $this->obSlave->db_Error <> '')
855 {
856 return $this->obSlave->db_Error;
857 }
858 elseif ($this->db_Error <> '')
859 {
860 return $this->db_Error . "!";
861 }
862 else
863 {
864 return '';
865 }
866 }
867
868 public function GetErrorSQL()
869 {
870 if (is_object($this->obSlave) && $this->obSlave->db_ErrorSQL <> '')
871 {
872 return $this->obSlave->db_ErrorSQL;
873 }
874 elseif ($this->db_ErrorSQL <> '')
875 {
876 return $this->db_ErrorSQL;
877 }
878 else
879 {
880 return '';
881 }
882 }
883
884 public function StartTransaction()
885 {
886 $this->DoConnect();
887 $this->connection->startTransaction();
888 }
889
890 public function Commit()
891 {
892 $this->DoConnect();
893 $this->connection->commitTransaction();
894 }
895
896 public function Rollback()
897 {
898 $this->DoConnect();
899 $this->connection->rollbackTransaction();
900 }
901
902 public function DDL($strSql, $bIgnoreErrors = false, $error_position = "", $arOptions = [])
903 {
904 $res = $this->Query($strSql, $bIgnoreErrors, $error_position, $arOptions);
905
906 //Reset metadata cache
907 $this->column_cache = [];
908
909 return $res;
910 }
911
912 public function addDebugQuery($strSql, $exec_time, $node_id = 0)
913 {
914 $this->cntQuery++;
915 $this->timeQuery += $exec_time;
916 $this->arQueryDebug[] = $this->startSqlTracker()->getNewTrackerQuery()
917 ->setSql($strSql)
918 ->setTime($exec_time)
919 ->setTrace(defined("BX_NO_SQL_BACKTRACE") ? null : Main\Diag\Helper::getBackTrace(8, null, 2))
920 ->setState($GLOBALS["BX_STATE"])
921 ->setNode($node_id)
922 ;
923 }
924
925 public function addDebugTime($index, $exec_time)
926 {
927 $this->arQueryDebug[$index]?->addTime($exec_time);
928 }
929
930 public function GetIndexName($tableName, $arColumns, $bStrict = false)
931 {
932 $this->Doconnect();
933 return $this->connection->getIndexName($tableName, $arColumns, $bStrict) ?? '';
934 }
935
936 public function IndexExists($tableName, $arColumns, $bStrict = false)
937 {
938 return $this->GetIndexName($tableName, $arColumns, $bStrict) !== "";
939 }
940
941 public function CreateIndex($indexName, $tableName, $columns, $unique = false, $fulltext = false)
942 {
943 return false;
944 }
945
952 public static function registerAutoload(?string $connectionType = null): void
953 {
954 if ($connectionType === null)
955 {
957 $connectionType = $application->getConnection()->getType();
958 }
959
961 'main',
962 [
963 'CDatabase' => 'classes/' . $connectionType . '/database.php',
964 'CDBResult' => 'classes/' . $connectionType . '/dbresult.php',
965 ]
966 );
967 }
968
973 protected function getError()
974 {
975 return '';
976 }
977
982 protected function getErrorCode()
983 {
984 return 0;
985 }
986}
xml version
Определения yandex.php:67
$module_id
Определения options.php:6
static getInstance()
Определения application.php:98
static getConnection($name="")
Определения application.php:638
static registerAutoLoadClasses($moduleName, array $classes)
Определения loader.php:273
static convertFormatToPhp($format)
Определения date.php:309
isUserTimeEnabled()
Определения datetime.php:281
static SetOffline($node_id)
Определения dbnode.php:226
static GetByID($node_id, $arVirtNode=false)
Определения dbnode.php:79
Определения database.php:15
$db_Conn
Определения database.php:20
$obSlave
Определения database.php:34
$connection
Определения database.php:39
$result
Определения database.php:26
IndexExists($tableName, $arColumns, $bStrict=false)
Определения database.php:936
$version
Определения database.php:28
RunSQLBatch($filepath)
Определения database.php:816
$DBHost
Определения database.php:17
startSqlTracker()
Определения database.php:325
static $arNodes
Определения database.php:35
GetErrorMessage()
Определения database.php:852
getError()
Определения database.php:973
$sqlTracker
Определения database.php:59
$cntQuery
Определения database.php:45
DoConnect($connectionName='')
Определения database.php:239
LastID()
Определения database.php:538
GetIndexName($tableName, $arColumns, $bStrict=false)
Определения database.php:930
InitTableVarsForEdit($tablename, $strIdentFrom="str_", $strIdentTo="str_", $strSuffixFrom="", $bAlways=false)
Определения database.php:779
IsDate($value, $format=false, $lang=false, $format_type="SHORT")
Определения database.php:843
$DBName
Определения database.php:16
GetTableFieldsList($table)
Определения database.php:544
DDL($strSql, $bIgnoreErrors=false, $error_position="", $arOptions=[])
Определения database.php:902
IsNull($expression, $result)
Определения database.php:444
$db_Error
Определения database.php:24
PrepareInsert($strTableName, $arFields)
ToChar($expr, $len=0)
Определения database.php:456
$timeQuery
Определения database.php:50
TableExists($tableName)
Определения database.php:703
StartTransaction()
Определения database.php:884
addDebugTime($index, $exec_time)
Определения database.php:925
$ShowSqlStat
Определения database.php:23
getErrorCode()
Определения database.php:982
GetNowDate()
Определения database.php:350
Concat()
Определения database.php:425
Rollback()
Определения database.php:896
$bNodeConnection
Определения database.php:31
static showConnectionError()
Определения database.php:156
Query($strSql, $bIgnoreErrors=false, $error_position="", $arOptions=[])
Определения database.php:556
GetErrorSQL()
Определения database.php:868
$DBPassword
Определения database.php:19
$arQueryDebug
Определения database.php:55
static registerAutoload(?string $connectionType=null)
Определения database.php:952
$connectionName
Определения database.php:40
$debug
Определения database.php:21
$DebugToFile
Определения database.php:22
CreateIndex($indexName, $tableName, $columns, $unique=false, $fulltext=false)
Определения database.php:941
StartUsingMasterOnly()
Определения database.php:61
Update($table, $arFields, $WHERE="", $error_position="", $DEBUG=false, $ignore_errors=false, $additional_check=true)
Определения database.php:724
ToNumber($expr)
Определения database.php:461
$type
Определения database.php:27
Length($field)
Определения database.php:450
$bModuleConnection
Определения database.php:30
$db_ErrorSQL
Определения database.php:25
static GetModuleConnection($module_id, $bModuleInclude=false)
Определения database.php:180
PrepareUpdate($strTableName, $arFields)
getConnection()
Определения database.php:71
CharToDateFunction($strValue, $strType="FULL", $lang=false)
Определения database.php:389
Connect($DBHost, $DBName, $DBLogin, $DBPassword, $connectionName="")
Определения database.php:221
$DBLogin
Определения database.php:18
ForSql($strValue, $iMaxLength=0)
Определения database.php:697
static FormatDate($strDate, $format="DD.MM.YYYY HH:MI:SS", $new_format="DD.MM.YYYY HH:MI:SS")
Определения database.php:476
PrepareUpdateJoin($strTableName, $arFields, $from, $where)
Определения database.php:719
DateToCharFunction($strFieldName, $strType="FULL", $lang=false, $bSearchInSitesOnly=false)
Определения database.php:355
ParseSqlBatch($strSql)
Определения database.php:810
GetVersion()
Определения database.php:335
QueryLong($strSql, $bIgnoreErrors=false)
Определения database.php:692
GetNowFunction()
Определения database.php:345
Commit()
Определения database.php:890
$column_cache
Определения database.php:29
quote($identifier)
Определения database.php:709
TopSql($strSql, $nTopCount)
Определения database.php:525
$node_id
Определения database.php:32
static DateFormatToPHP($format)
Определения database.php:466
StopUsingMasterOnly()
Определения database.php:66
static GetDBNodeConnection($node_id, $bIgnoreErrors=false, $bCheckStatus=true)
Определения database.php:85
Substr($str, $from, $length=null)
Определения database.php:431
QueryBind($strSql, $arBinds, $bIgnoreErrors=false)
Определения database.php:684
addDebugQuery($strSql, $exec_time, $node_id=0)
Определения database.php:912
Определения dbresult.php:88
Определения database.php:557
$start_time
Определения clock_selector.php:9
$str
Определения commerceml2.php:63
$contents
Определения commerceml2.php:57
$arFields
Определения dblapprove.php:5
$res
Определения filter_act.php:7
$app
Определения proxy.php:8
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $DB
Определения cron_frame.php:29
$context
Определения csv_new_setup.php:223
$application
Определения bitrix.php:23
const FORMAT_DATETIME
Определения include.php:64
if(!defined('SITE_ID')) $lang
Определения include.php:91
$culture
Определения include.php:61
$status
Определения session.php:10
$arOptions
Определения structure.php:223
SendError($error)
Определения tools.php:3922
htmlspecialcharsEx($str)
Определения tools.php:2685
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
CheckDateTime($datetime, $format=false)
Определения tools.php:398
Определения culture.php:9
Определения arrayresult.php:2
Определения cachetracker.php:2
Определения collection.php:2
$GLOBALS['____1690880296']
Определения license.php:1
$table
Определения mysql_to_pgsql.php:36
$time
Определения payment.php:61
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$ar
Определения options.php:199
die
Определения quickway.php:367
</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
$rows
Определения options.php:264
$k
Определения template_pdf.php:567
$fields
Определения yandex_run.php:501