%arg-1% isn't being converted #16

Closed
opened 2022-03-21 22:55:07 +00:00 by QmanRocks · 1 comment

I have a simple command in my script, you just input a text and it'll make a column named that. Here's the code.

command /inserttest <text>:
	trigger:
		execute "ALTER TABLE test ADD COLUMN %arg-1% varchar(255);" in {sql}
		wait 1 tick
		set {_output::*} to the last sql error
		send "%{_output::*}%" to player

However, when I type the command in chat with a simple "word", like test, asdf, or qwerty, I get this error.

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''test' varchar(255)' at line 1

It doesn't add a column to the table at all, and I have a suspicion that it has to do with using %arg-1% in the command.

I have a simple command in my script, you just input a text and it'll make a column named that. Here's the code. ``` command /inserttest <text>: trigger: execute "ALTER TABLE test ADD COLUMN %arg-1% varchar(255);" in {sql} wait 1 tick set {_output::*} to the last sql error send "%{_output::*}%" to player ``` However, when I type the command in chat with a simple "word", like test, asdf, or qwerty, I get this error. ``` You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''test' varchar(255)' at line 1 ``` It doesn't add a column to the table at all, and I have a suspicion that it has to do with using %arg-1% in the command.
Owner

You can go around this by using "execute unsafe", you are getting the issue because of SQL injection protection, unsafe disables that.

You can go around this by using "execute unsafe", you are getting the issue because of SQL injection protection, unsafe disables that.
Govindas added the
wontfix
label 2022-03-22 10:26:02 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Limework/skript-db#16
No description provided.