Skip to content

Commit

Permalink
debug format enhancement
Browse files Browse the repository at this point in the history
also sql docs
  • Loading branch information
mcmonkey4eva committed Jan 1, 2022
1 parent d878adf commit 07f1365
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Expand Up @@ -204,6 +204,29 @@ public static String escapePropertyValue(String input) {
return input;
}

public static String getPropertiesDebuggable(ObjectTag object) {
ClassPropertiesInfo properties = propertiesByClass.get(object.getObjectTagClass());
if (properties == null) {
return "";
}
StringBuilder prop_string = new StringBuilder(properties.propertiesWithMechs.size() * 10);
for (PropertyGetter getter : properties.propertiesWithMechs) {
Property property = getter.get(object);
if (property != null) {
String description = property.getPropertyString();
if (description != null) {
prop_string.append(property.getPropertyId()).append("<G>=<Y>").append(description).append("<G>; <Y>");
}
}
}
if (prop_string.length() > 0) {
return "<G>[<Y>" + prop_string.substring(0, prop_string.length() - "; <Y>".length()) + "<G>]";
}
else {
return "";
}
}

public static String getPropertiesString(ObjectTag object) {
ClassPropertiesInfo properties = propertiesByClass.get(object.getObjectTagClass());
if (properties == null) {
Expand Down
Expand Up @@ -45,10 +45,16 @@ public SQLCommand() {
//
// The general usage order is connect -> update/query -> disconnect.
// It is not required that you disconnect right after using, and in fact encouraged that you keep a connection open where possible.
//
// When connecting, the server format is IP:Port/Database, EG 'localhost:3306/test'.
// You can also append options to the end, like 'localhost:3306/test?autoReconnect=true'
//
// You can switch whether SSL is used for the connection (defaults to false).
//
// Note that when using tag, it is recommended you escape unusual inputs to avoid SQL injection.
//
// The SQL command is merely a wrapper for SQL queries, and further usage details should be gathered from an official MySQL query reference rather than from Denizen command help.
//
// SQL connections are not instant - they can take several seconds, or just never connect at all.
// It is recommended you hold the command by doing "- ~sql ..." rather than just "- sql ..."
// as this will delay the commands following the SQL command until after the SQL operation is complete.
Expand Down

0 comments on commit 07f1365

Please sign in to comment.