Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
procedure.php
1<?php
2namespace Bitrix\Perfmon\Sql;
3
4class Procedure extends BaseObject
5{
6 public $type = '';
7
12 public function __construct($name = '', $type = '')
13 {
14 parent::__construct($name);
15 $this->type = (string)$type;
16 }
17
29 public static function create(Tokenizer $tokenizer)
30 {
31 $type = $tokenizer->getCurrentToken()->text;
32 $tokenizer->nextToken();
33 $tokenizer->skipWhiteSpace();
34
35 $name = $tokenizer->getCurrentToken()->text;
36 $token = $tokenizer->nextToken();
37 if ($token->text === '.')
38 {
39 $token = $tokenizer->nextToken();
40 $name .= '.' . $token->text;
41 }
42 $procedure = new self($name, $type);
43
44 $tokenizer->resetState();
45 $definition = '';
46 while (!$tokenizer->endOfInput())
47 {
48 $definition .= $tokenizer->getCurrentToken()->text;
49 $tokenizer->nextToken();
50 }
51
52 $procedure->setBody($definition);
53
54 return $procedure;
55 }
56
64 public function getCreateDdl($dbType = '')
65 {
66 return $this->body;
67 }
68
76 public function getDropDdl($dbType = '')
77 {
78 return 'DROP ' . $this->type . ' ' . $this->name;
79 }
80
89 public function getModifyDdl(BaseObject $target, $dbType = '')
90 {
91 return [
92 $this->getDropDdl($dbType),
93 $target->getCreateDdl($dbType),
94 ];
95 }
96}
static create(Tokenizer $tokenizer)
Definition procedure.php:29
getModifyDdl(BaseObject $target, $dbType='')
Definition procedure.php:89
__construct($name='', $type='')
Definition procedure.php:12