Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script options:
- $ db url jdbc:mysql://IP:3306/DATABASE
- $ db username USER
- $ db password PASSWORD
- options:
- Table: TABLENAME
- on load:
- update "CREATE TABLE IF NOT EXISTS `{@Table}` (`id` varchar(255),`value` varchar(255))"
- update "ALTER TABLE {@Table} ADD UNIQUE (id, value)"
- function thisMySQLUpdatevalue(id:text, value:text) :: text:
- set {_SetResult::*} to objects in column "id" from result of query "SELECT * FROM {@Table} WHERE id = '%{_id}%'" and close
- set {_GetResult} to false
- loop {_SetResult::*}:
- If loop-value is {_id}:
- set {_GetResult} to true
- If {_GetResult} is false:
- update "INSERT INTO `{@Table}` (`id`,`value`) valueS ('%{_id}%', '%{_value}%')"
- return "&e%{_id}% &ahas been succesfully &5&lCREATED &awith value &e%{_value}% &ain table &b{@Table}"
- else:
- update "UPDATE `{@Table}` SET `value` = '%{_value}%' WHERE `{@Table}`.`id` ='%{_id}%'"
- return "&e%{_id}% &ahas been succesfully &5&lUPDATED &awith value &e%{_value}% &ain table &b{@Table}"
- function thisMySQLRemovevalue(id:text) :: text:
- set {_SetResult::*} to objects in column "id" from result of query "SELECT * FROM {@Table} WHERE id = '%{_id}%'" and close
- set {_GetResult} to false
- loop {_SetResult::*}:
- If loop-value is {_id}:
- set {_GetResult} to true
- If {_GetResult} is true:
- update "DELETE FROM {@Table} WHERE id = '%{_id}%'"
- return "&e%{_id}% &ahas been succesfully &5&lDELETED &afrom table &b{@Table}"
- else:
- return "&cid &e%{_id}% &ccouldn't be found in table &b{@Table}"
- function thisMySQLReadvalue(id:text) :: text:
- set {_SetResult::*} to objects in column "value" from result of query "SELECT * FROM {@Table} WHERE id = '%{_id}%'" and close
- delete {_GetResult}
- loop {_SetResult::*}:
- If loop-value is set:
- set {_GetResult} to loop-value
- If {_GetResult} is set:
- return "&aThe value of &b%{_id}% &ais &b%{_GetResult}% &ain table &b{@Table}"
- else:
- return "&cid &e%{_id}% &ccouldn't be found in table &b{@Table}"
Add Comment
Please, Sign In to add comment