Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
sequence.php
1<?php
2namespace Bitrix\Perfmon\Sql;
3
4class Sequence extends BaseObject
5{
15 public static function create(Tokenizer $tokenizer)
16 {
17 $name = $tokenizer->getCurrentToken()->text;
18 $sequence = new self($name);
19
20 $tokenizer->resetState();
21 $definition = '';
22 while (!$tokenizer->endOfInput())
23 {
24 $definition .= $tokenizer->getCurrentToken()->text;
25 $tokenizer->nextToken();
26 }
27
28 $sequence->setBody($definition);
29
30 return $sequence;
31 }
32
40 public function getCreateDdl($dbType = '')
41 {
42 if ($dbType === 'ORACLE')
43 {
44 return $this->body;
45 }
46 else
47 {
48 return '// ' . get_class($this) . ':getDropDdl for database type [' . $dbType . '] not implemented';
49 }
50 }
51
59 public function getDropDdl($dbType = '')
60 {
61 if ($dbType === 'ORACLE')
62 {
63 return 'DROP SEQUENCE ' . $this->name;
64 }
65 else
66 {
67 return '// ' . get_class($this) . ':getDropDdl for database type [' . $dbType . '] not implemented';
68 }
69 }
70
79 public function getModifyDdl(BaseObject $target, $dbType = '')
80 {
81 if ($dbType === 'ORACLE')
82 {
83 return [
84 $this->getDropDdl($dbType),
85 $target->getCreateDdl($dbType),
86 ];
87 }
88 else
89 {
90 return '// ' . get_class($this) . ':getDropDdl for database type [' . $dbType . '] not implemented';
91 }
92 }
93}
static create(Tokenizer $tokenizer)
Definition sequence.php:15
getModifyDdl(BaseObject $target, $dbType='')
Definition sequence.php:79