Placeholder for working with MySQL
A placeholder that allows you to work with MySQL and other external databases.
Meaning
Allows you to work with MySQL and other external databases, using the JDBC link for the connection and performing different queries using PreparedStatement (default queries are suitable too).
Format
%CEP_mysql_<connection_method>_(semi-mandatory) <jdbc_url>_(semi-mandatory) <sql_query>_(semi-mandatory) <param1>,<param2>,<paramN>%<connection_method> – the method to connect to the database through, may be SYNC or ASYNC, in case of "ASYNC" use format "ASYNC:<key>", you can just specify the "key" to get the data by it, or the full placeholder to save the data to this "key" (see more in the hint); (MANDATORY)
<jdbc_url> – the JDBC link to connect to the database (mandatory in case of "SYNC" <connection_method> and optional in case of "ASYNC"); (SEMI-MANDATORY)
<sql_query> – the query to the database (only obtaining the data) (mandatory in case of "SYNC" <connection_method> and optional in case of "ASYNC"); (SEMI-MANDATORY)
<params> – the substitutes for the "?" in the PreparedStatements in the "sql_query" (use it only in case if you are using the PreparedStatements in the "sql_query") (mandatory in case of "SYNC" <connection_method> and optional in case of "ASYNC"). (SEMI-MANDATORY)
Use "ᵕ" symbol instead of underscores and "╵" symbol instead of percents everywhere! Only <connection_method> is unaffectable, do not use underscores and percents in it at all.
"ASYNC" <connection_method> allows you to return data asynchronously, you will get nothing from the common returning placeholder, it will just save the data to the specified key, only on the next time (for example, after one or more ticks delay), using the partial returning placeholder (that is, only <connection_method>) you will get the data by the specified key. "SYNC" <connection_method> works as usual, but it can load the server performance more!
Not only PreparedStatements are available, default queries are suitable too.
Examples
%CEP_mysql_SYNC_jdbc:mysql://u256340ᵕPIuNdnjIDAD:0gwDfoEdN╵44ySggXPCF╵2B56uFLpC39za╵5E@mysql-org-d1.test.xyz:3306/s263450ᵕTESTDB_SELECT * FROM TestTable WHERE Player = ? AND Action = ? ORDER BY ID DESC LIMIT ?_0ptifyne,ObtainingMoney,3% # Get three last entries from the TestTable with player "0ptifyne" and action "ObtainingMoney" in a synchronous way%CEP_mysql_ASYNC:test_jdbc:mysql://u256340ᵕPIuNdnjIDAD:0gwDfoEdN╵44ySggXPCF╵2B56uFLpC39za╵5E@mysql-org-d1.test.xyz:3306/s263450ᵕTESTDB_SELECT * FROM TestTable WHERE Player = ? AND Action = ? ORDER BY ID DESC LIMIT ?_0ptifyne,ObtainingMoney,3% # Save three last entries from the TestTable with player "0ptifyne" and action "ObtainingMoney" to the specified key in a asynchronous way
# After one or more ticks delay
%CEP_mysql_ASYNC:test% # Get the saved value by the specified key in previous placeholderNote that any external databases are suitable, not just MySQL.
Last updated