-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SET statement / SET type #168
Comments
I am also having troubles with the SET-expression in ALTER TABLE-queries: $query = "ALTER TABLE `table_name` ADD `new_column_name` SET ('value1','value2','value3') NOT NULL AFTER `another_column`";
$parser = new \PhpMyAdmin\SqlParser\Parser($query);
var_dump($parser->statements); In the var-dump the I am willing to dig into this problem and submit a PR. Any ideas where to start? array(1) {
[0] =>
class PhpMyAdmin\SqlParser\Statements\AlterStatement#31 (5) {
public $table =>
class PhpMyAdmin\SqlParser\Components\Expression#33 (7) {
public $database =>
NULL
public $table =>
string(10) "table_name"
public $column =>
NULL
public $expr =>
string(12) "`table_name`"
public $alias =>
NULL
public $function =>
NULL
public $subquery =>
NULL
}
public $altered =>
array(3) {
[0] =>
class PhpMyAdmin\SqlParser\Components\AlterOperation#34 (3) {
public $options =>
class PhpMyAdmin\SqlParser\Components\OptionsArray#35 (1) {
public $options =>
array(1) {
[1] =>
string(3) "ADD"
}
}
public $field =>
class PhpMyAdmin\SqlParser\Components\Expression#36 (7) {
public $database =>
NULL
public $table =>
NULL
public $column =>
string(15) "new_column_name"
public $expr =>
string(17) "`new_column_name`"
public $alias =>
NULL
public $function =>
NULL
public $subquery =>
NULL
}
public $unknown =>
array(0) {
}
}
[1] =>
class PhpMyAdmin\SqlParser\Components\AlterOperation#38 (3) {
public $options =>
class PhpMyAdmin\SqlParser\Components\OptionsArray#39 (1) {
public $options =>
array(0) {
}
}
public $field =>
class PhpMyAdmin\SqlParser\Components\Expression#40 (7) {
public $database =>
NULL
public $table =>
NULL
public $column =>
string(6) "value2"
public $expr =>
string(8) "'value2'"
public $alias =>
NULL
public $function =>
NULL
public $subquery =>
NULL
}
public $unknown =>
array(0) {
}
}
[2] =>
class PhpMyAdmin\SqlParser\Components\AlterOperation#42 (3) {
public $options =>
class PhpMyAdmin\SqlParser\Components\OptionsArray#43 (1) {
public $options =>
array(0) {
}
}
public $field =>
class PhpMyAdmin\SqlParser\Components\Expression#44 (7) {
public $database =>
NULL
public $table =>
NULL
public $column =>
string(6) "value3"
public $expr =>
string(8) "'value3'"
public $alias =>
NULL
public $function =>
NULL
public $subquery =>
NULL
}
public $unknown =>
array(7) {
[0] =>
class PhpMyAdmin\SqlParser\Token#23 (6) {
public $token =>
string(1) ")"
public $value =>
string(1) ")"
public $keyword =>
NULL
public $type =>
int(2)
public $flags =>
int(16)
public $position =>
int(78)
}
[1] =>
class PhpMyAdmin\SqlParser\Token#24 (6) {
public $token =>
string(1) " "
public $value =>
string(1) " "
public $keyword =>
NULL
public $type =>
int(3)
public $flags =>
int(0)
public $position =>
int(79)
}
[2] =>
class PhpMyAdmin\SqlParser\Token#26 (6) {
public $token =>
string(8) "NOT NULL"
public $value =>
string(8) "NOT NULL"
public $keyword =>
string(8) "NOT NULL"
public $type =>
int(1)
public $flags =>
int(7)
public $position =>
int(80)
}
[3] =>
class PhpMyAdmin\SqlParser\Token#25 (6) {
public $token =>
string(1) " "
public $value =>
string(1) " "
public $keyword =>
NULL
public $type =>
int(3)
public $flags =>
int(0)
public $position =>
int(88)
}
[4] =>
class PhpMyAdmin\SqlParser\Token#27 (6) {
public $token =>
string(5) "AFTER"
public $value =>
string(5) "AFTER"
public $keyword =>
string(5) "AFTER"
public $type =>
int(1)
public $flags =>
int(1)
public $position =>
int(89)
}
[5] =>
class PhpMyAdmin\SqlParser\Token#28 (6) {
public $token =>
string(1) " "
public $value =>
string(1) " "
public $keyword =>
NULL
public $type =>
int(3)
public $flags =>
int(0)
public $position =>
int(94)
}
[6] =>
class PhpMyAdmin\SqlParser\Token#30 (6) {
public $token =>
string(16) "`another_column`"
public $value =>
string(14) "another_column"
public $keyword =>
NULL
public $type =>
int(8)
public $flags =>
int(2)
public $position =>
int(95)
}
}
}
}
public $options =>
class PhpMyAdmin\SqlParser\Components\OptionsArray#32 (1) {
public $options =>
array(1) {
[3] =>
string(5) "TABLE"
}
}
public $first =>
int(0)
public $last =>
int(25)
}
} |
Also hitting this issue |
If someone can open a PR I will be glad to review and merge it :) |
I'm having the same problem. |
Signed-off-by: William Desportes <[email protected]>
I added test cases for this issue in ded1fea |
Signed-off-by: William Desportes <[email protected]>
Signed-off-by: William Desportes <[email protected]>
Signed-off-by: William Desportes <[email protected]>
Pull-request: #344 Signed-off-by: William Desportes <[email protected]>
Pull-request: #344 Signed-off-by: William Desportes <[email protected]>
Pull-request: #344 Signed-off-by: William Desportes <[email protected]>
Signed-off-by: William Desportes <[email protected]>
Hi @kapersoft |
It seems that the parser seems to treat SET as statement even when it should not:
See phpmyadmin/phpmyadmin#13636
The text was updated successfully, but these errors were encountered: