• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/db/pgsqlconnection.php
  • Класс: BitrixMainDBPgsqlConnection
  • Вызов: PgsqlConnection::add
public function add($tableName, array $data, $identity = "ID")
{
	$insert = $this->getSqlHelper()->prepareInsert($tableName, $data);
	if($identity !== null && !isset($data[$identity]))
	{
		$sql = "INSERT INTO ".$tableName."(".$insert[0].") VALUES (".$insert[1].") RETURNING ".$identity;
		$row = $this->query($sql)->fetch();
		return array_shift($row);
	}
	else
	{
		$sql = "INSERT INTO ".$tableName."(".$insert[0].") VALUES (".$insert[1].")";
		$this->query($sql);
		return $data[$identity];
	}
}