Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
InsertSelectTrait.php
1<?php
2
3namespace Bitrix\Im\V2\Common;
4
7
8trait InsertSelectTrait
9{
10 public static function insertSelect(Query $query, array $fields, bool $isIgnore = true): void
11 {
12 $connection = Application::getConnection();
13 $helper = $connection->getSqlHelper();
14 $tableName = $helper->quote(static::getTableName());
15 $fields = implode(', ', array_map([$helper, 'quote'], $fields));
16
17 if ($isIgnore)
18 {
19 $sql = $helper->getInsertIgnore(
20 $tableName,
21 " ({$fields}) ",
22 $query->getQuery()
23 );
24 }
25 else
26 {
27 $sql = "INSERT INTO {$tableName} ({$fields}) \n {$query->getQuery()} ";
28 }
29
30 $connection->queryExecute($sql);
31 }
32}
static getConnection($name="")