1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
<?php
/**
* `SET` statement.
*/
namespace PhpMyAdmin\SqlParser\Statements;
use PhpMyAdmin\SqlParser\Components\OptionsArray;
use PhpMyAdmin\SqlParser\Components\SetOperation;
use PhpMyAdmin\SqlParser\Statement;
/**
* `SET` statement.
*
* @category Statements
*
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
*/
class SetStatement extends Statement
{
/**
* The clauses of this statement, in order.
*
* @see Statement::$CLAUSES
*
* @var array
*/
public static $CLAUSES = array(
'SET' => array(
'SET',
3
),
'_END_OPTIONS' => array(
'_END_OPTIONS',
1
)
);
/**
* Possible exceptions in SET statment.
*
* @var array
*/
public static $OPTIONS = array(
'CHARSET' => array(
3,
'var',
),
'CHARACTER SET' => array(
3,
'var',
),
'NAMES' => array(
3,
'var',
),
'PASSWORD' => array(
3,
'expr',
),
'SESSION' => 3,
'GLOBAL' => 3,
'PERSIST' => 3,
'PERSIST_ONLY' => 3,
'@@SESSION' => 3,
'@@GLOBAL' => 3,
'@@PERSIST' => 3,
'@@PERSIST_ONLY' => 3,
);
public static $END_OPTIONS = array(
'COLLATE' => array(
1,
'var',
),
'DEFAULT' => 1
);
/**
* Options used in current statement.
*
* @var OptionsArray[]
*/
public $options;
/**
* The end options of this query.
*
* @var OptionsArray
*
* @see static::$END_OPTIONS
*/
public $end_options;
/**
* The updated values.
*
* @var SetOperation[]
*/
public $set;
/**
* @return string
*/
public function build()
{
$ret = 'SET ' . OptionsArray::build($this->options)
. ' ' . SetOperation::build($this->set)
. ' ' . OptionsArray::build($this->end_options);
return trim($ret);
}
}
|