GeezerVison is showing github.com — add additional tests for SetStatement · phpmyadmin/sql-parser@24d9cfa
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: tests/Parser/SetStatementTest.php +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,6 +31,8 @@ public function setProvider(): array | 31 | 31 | ['parser/parseSetNamesError'], | 32 | 32 | ['parser/parseSetError1'], | 33 | 33 | ['parser/parseInsertIntoSet'], | | 34 | + ['parser/parseSetVariable'], | | 35 | + ['parser/parseSetGlobalVariable'], | 34 | 36 | ]; | 35 | 37 | } | 36 | 38 | } |
Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +SET GLOBAL max_connections = 1 |
Collapse file Copy file name to clipboard +144Lines changed: 144 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "query": "SET GLOBAL max_connections = 1", | | 3 | + "lexer": { | | 4 | + "@type": "PhpMyAdmin\\SqlParser\\Lexer", | | 5 | + "str": "SET GLOBAL max_connections = 1", | | 6 | + "len": 30, | | 7 | + "last": 30, | | 8 | + "list": { | | 9 | + "@type": "PhpMyAdmin\\SqlParser\\TokensList", | | 10 | + "tokens": [ | | 11 | + { | | 12 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 13 | + "token": "SET", | | 14 | + "value": "SET", | | 15 | + "keyword": "SET", | | 16 | + "type": 1, | | 17 | + "flags": 11, | | 18 | + "position": 0 | | 19 | + }, | | 20 | + { | | 21 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 22 | + "token": " ", | | 23 | + "value": " ", | | 24 | + "keyword": null, | | 25 | + "type": 3, | | 26 | + "flags": 0, | | 27 | + "position": 3 | | 28 | + }, | | 29 | + { | | 30 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 31 | + "token": "GLOBAL", | | 32 | + "value": "GLOBAL", | | 33 | + "keyword": "GLOBAL", | | 34 | + "type": 1, | | 35 | + "flags": 1, | | 36 | + "position": 4 | | 37 | + }, | | 38 | + { | | 39 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 40 | + "token": " ", | | 41 | + "value": " ", | | 42 | + "keyword": null, | | 43 | + "type": 3, | | 44 | + "flags": 0, | | 45 | + "position": 10 | | 46 | + }, | | 47 | + { | | 48 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 49 | + "token": "max_connections", | | 50 | + "value": "max_connections", | | 51 | + "keyword": null, | | 52 | + "type": 0, | | 53 | + "flags": 0, | | 54 | + "position": 11 | | 55 | + }, | | 56 | + { | | 57 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 58 | + "token": " ", | | 59 | + "value": " ", | | 60 | + "keyword": null, | | 61 | + "type": 3, | | 62 | + "flags": 0, | | 63 | + "position": 26 | | 64 | + }, | | 65 | + { | | 66 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 67 | + "token": "=", | | 68 | + "value": "=", | | 69 | + "keyword": null, | | 70 | + "type": 2, | | 71 | + "flags": 2, | | 72 | + "position": 27 | | 73 | + }, | | 74 | + { | | 75 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 76 | + "token": " ", | | 77 | + "value": " ", | | 78 | + "keyword": null, | | 79 | + "type": 3, | | 80 | + "flags": 0, | | 81 | + "position": 28 | | 82 | + }, | | 83 | + { | | 84 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 85 | + "token": "1", | | 86 | + "value": 1, | | 87 | + "keyword": null, | | 88 | + "type": 6, | | 89 | + "flags": 0, | | 90 | + "position": 29 | | 91 | + }, | | 92 | + { | | 93 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 94 | + "token": null, | | 95 | + "value": null, | | 96 | + "keyword": null, | | 97 | + "type": 9, | | 98 | + "flags": 0, | | 99 | + "position": null | | 100 | + } | | 101 | + ], | | 102 | + "count": 10, | | 103 | + "idx": 10 | | 104 | + }, | | 105 | + "delimiter": ";", | | 106 | + "delimiterLen": 1, | | 107 | + "strict": false, | | 108 | + "errors": [] | | 109 | + }, | | 110 | + "parser": { | | 111 | + "@type": "PhpMyAdmin\\SqlParser\\Parser", | | 112 | + "list": { | | 113 | + "@type": "@1" | | 114 | + }, | | 115 | + "statements": [ | | 116 | + { | | 117 | + "@type": "PhpMyAdmin\\SqlParser\\Statements\\SetStatement", | | 118 | + "options": { | | 119 | + "@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray", | | 120 | + "options": { | | 121 | + "3": "GLOBAL" | | 122 | + } | | 123 | + }, | | 124 | + "endOptions": null, | | 125 | + "set": [ | | 126 | + { | | 127 | + "@type": "PhpMyAdmin\\SqlParser\\Components\\SetOperation", | | 128 | + "column": "max_connections", | | 129 | + "value": "1" | | 130 | + } | | 131 | + ], | | 132 | + "first": 0, | | 133 | + "last": 8 | | 134 | + } | | 135 | + ], | | 136 | + "brackets": 0, | | 137 | + "strict": false, | | 138 | + "errors": [] | | 139 | + }, | | 140 | + "errors": { | | 141 | + "lexer": [], | | 142 | + "parser": [] | | 143 | + } | | 144 | +} |
Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +SET @foo = 1 |
Collapse file Copy file name to clipboard +124Lines changed: 124 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "query": "SET @foo = 1", | | 3 | + "lexer": { | | 4 | + "@type": "PhpMyAdmin\\SqlParser\\Lexer", | | 5 | + "str": "SET @foo = 1", | | 6 | + "len": 12, | | 7 | + "last": 12, | | 8 | + "list": { | | 9 | + "@type": "PhpMyAdmin\\SqlParser\\TokensList", | | 10 | + "tokens": [ | | 11 | + { | | 12 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 13 | + "token": "SET", | | 14 | + "value": "SET", | | 15 | + "keyword": "SET", | | 16 | + "type": 1, | | 17 | + "flags": 11, | | 18 | + "position": 0 | | 19 | + }, | | 20 | + { | | 21 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 22 | + "token": " ", | | 23 | + "value": " ", | | 24 | + "keyword": null, | | 25 | + "type": 3, | | 26 | + "flags": 0, | | 27 | + "position": 3 | | 28 | + }, | | 29 | + { | | 30 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 31 | + "token": "@foo", | | 32 | + "value": "foo", | | 33 | + "keyword": null, | | 34 | + "type": 8, | | 35 | + "flags": 1, | | 36 | + "position": 4 | | 37 | + }, | | 38 | + { | | 39 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 40 | + "token": " ", | | 41 | + "value": " ", | | 42 | + "keyword": null, | | 43 | + "type": 3, | | 44 | + "flags": 0, | | 45 | + "position": 8 | | 46 | + }, | | 47 | + { | | 48 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 49 | + "token": "=", | | 50 | + "value": "=", | | 51 | + "keyword": null, | | 52 | + "type": 2, | | 53 | + "flags": 2, | | 54 | + "position": 9 | | 55 | + }, | | 56 | + { | | 57 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 58 | + "token": " ", | | 59 | + "value": " ", | | 60 | + "keyword": null, | | 61 | + "type": 3, | | 62 | + "flags": 0, | | 63 | + "position": 10 | | 64 | + }, | | 65 | + { | | 66 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 67 | + "token": "1", | | 68 | + "value": 1, | | 69 | + "keyword": null, | | 70 | + "type": 6, | | 71 | + "flags": 0, | | 72 | + "position": 11 | | 73 | + }, | | 74 | + { | | 75 | + "@type": "PhpMyAdmin\\SqlParser\\Token", | | 76 | + "token": null, | | 77 | + "value": null, | | 78 | + "keyword": null, | | 79 | + "type": 9, | | 80 | + "flags": 0, | | 81 | + "position": null | | 82 | + } | | 83 | + ], | | 84 | + "count": 8, | | 85 | + "idx": 8 | | 86 | + }, | | 87 | + "delimiter": ";", | | 88 | + "delimiterLen": 1, | | 89 | + "strict": false, | | 90 | + "errors": [] | | 91 | + }, | | 92 | + "parser": { | | 93 | + "@type": "PhpMyAdmin\\SqlParser\\Parser", | | 94 | + "list": { | | 95 | + "@type": "@1" | | 96 | + }, | | 97 | + "statements": [ | | 98 | + { | | 99 | + "@type": "PhpMyAdmin\\SqlParser\\Statements\\SetStatement", | | 100 | + "options": { | | 101 | + "@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray", | | 102 | + "options": [] | | 103 | + }, | | 104 | + "endOptions": null, | | 105 | + "set": [ | | 106 | + { | | 107 | + "@type": "PhpMyAdmin\\SqlParser\\Components\\SetOperation", | | 108 | + "column": "@foo", | | 109 | + "value": "1" | | 110 | + } | | 111 | + ], | | 112 | + "first": 0, | | 113 | + "last": 6 | | 114 | + } | | 115 | + ], | | 116 | + "brackets": 0, | | 117 | + "strict": false, | | 118 | + "errors": [] | | 119 | + }, | | 120 | + "errors": { | | 121 | + "lexer": [], | | 122 | + "parser": [] | | 123 | + } | | 124 | +} |
|