use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class QueryArray method toDumpData.
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
DumpTable dt = (DumpTable) super.toDumpData(pageContext, maxlevel, dp);
StringBuilder comment = new StringBuilder();
// table.appendRow(1, new SimpleDumpData("SQL"), new SimpleDumpData(sql.toString()));
String template = getTemplate();
if (!StringUtil.isEmpty(template))
comment.append("Template: ").append(template).append("\n");
int top = dp.getMaxlevel();
comment.append("Execution Time: ").append(Caster.toString(FormatUtil.formatNSAsMSDouble(getExecutionTime()))).append(" ms \n");
comment.append("Record Count: ").append(Caster.toString(size()));
if (size() > top)
comment.append(" (showing top ").append(Caster.toString(top)).append(")");
comment.append("\n");
comment.append("Cached: ").append(isCached() ? "Yes\n" : "No\n");
if (isCached()) {
String ct = getCacheType();
comment.append("Cache Type: ").append(ct).append("\n");
}
SQL sql = getSql();
if (sql != null)
comment.append("SQL: ").append("\n").append(StringUtil.suppressWhiteSpace(sql.toString().trim())).append("\n");
dt.setTitle("Array (from Query)");
if (dp.getMetainfo())
dt.setComment(comment.toString());
return dt;
}
use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class QueryStruct method toDumpData.
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
DumpTable dt = (DumpTable) super.toDumpData(pageContext, maxlevel, dp);
StringBuilder comment = new StringBuilder();
// table.appendRow(1, new SimpleDumpData("SQL"), new SimpleDumpData(sql.toString()));
String template = getTemplate();
if (!StringUtil.isEmpty(template))
comment.append("Template: ").append(template).append("\n");
int top = dp.getMaxlevel();
comment.append("Execution Time: ").append(Caster.toString(FormatUtil.formatNSAsMSDouble(getExecutionTime()))).append(" ms \n");
comment.append("Record Count: ").append(Caster.toString(size()));
if (size() > top)
comment.append(" (showing top ").append(Caster.toString(top)).append(")");
comment.append("\n");
comment.append("Cached: ").append(isCached() ? "Yes\n" : "No\n");
if (isCached()) {
String ct = getCacheType();
comment.append("Cache Type: ").append(ct).append("\n");
}
SQL sql = getSql();
if (sql != null)
comment.append("SQL: ").append("\n").append(StringUtil.suppressWhiteSpace(sql.toString().trim())).append("\n");
dt.setTitle("Struct (from Query)");
if (dp.getMetainfo())
dt.setComment(comment.toString());
return dt;
}
use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class ComponentScopeShadow method toDumpData.
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
DumpTable cp = StructUtil.toDumpTable(this, "Component Variable Scope", pageContext, maxlevel, dp);
cp.setComment("Component: " + component.getPageSource().getComponentName());
return cp;
}
use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class ComponentScopeThis method toDumpData.
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
DumpTable cp = StructUtil.toDumpTable(this, "This Scope", pageContext, maxlevel, dp);
cp.setComment("Component: " + component.getPageSource().getComponentName());
return cp;
}
use of lucee.runtime.dump.DumpTable in project Lucee by lucee.
the class PageExceptionImpl method toDumpData.
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
// FFFFCF
DumpTable htmlBox = new DumpTable("exception", "#ff9900", "#FFCC00", "#000000");
htmlBox.setTitle(Constants.NAME + " [" + pageContext.getConfig().getFactory().getEngine().getInfo().getVersion() + "] - Error (" + StringUtil.ucFirst(getTypeAsString()) + ")");
// Message
htmlBox.appendRow(1, new SimpleDumpData("Message"), new SimpleDumpData(getMessage()));
// Detail
String detail = getDetail();
if (!StringUtil.isEmpty(detail, true))
htmlBox.appendRow(1, new SimpleDumpData("Detail"), new SimpleDumpData(detail));
// additional
Iterator<Key> it = additional.keyIterator();
Collection.Key k;
while (it.hasNext()) {
k = it.next();
htmlBox.appendRow(1, new SimpleDumpData(k.getString()), new SimpleDumpData(additional.get(k, "").toString()));
}
Array tagContext = getTagContext(pageContext.getConfig());
// Context MUSTMUST
if (tagContext.size() > 0) {
// Collection.Key[] keys=tagContext.keys();
Iterator<Object> vit = tagContext.valueIterator();
// Entry<Key, Object> te;
DumpTable context = new DumpTable("#ff9900", "#FFCC00", "#000000");
// context.setTitle("The Error Occurred in");
// context.appendRow(0,new SimpleDumpData("The Error Occurred in"));
context.appendRow(7, new SimpleDumpData(""), new SimpleDumpData("template"), new SimpleDumpData("line"));
try {
boolean first = true;
while (vit.hasNext()) {
Struct struct = (Struct) vit.next();
context.appendRow(1, new SimpleDumpData(first ? "called from " : "occurred in"), new SimpleDumpData(struct.get(KeyConstants._template, "") + ""), new SimpleDumpData(Caster.toString(struct.get(KeyConstants._line, null))));
first = false;
}
htmlBox.appendRow(1, new SimpleDumpData("Context"), context);
// Code
String strCode = ((Struct) tagContext.get(1, null)).get(KeyConstants._codePrintPlain, "").toString();
String[] arrCode = ListUtil.listToStringArray(strCode, '\n');
arrCode = ListUtil.trim(arrCode);
DumpTable code = new DumpTable("#ff9900", "#FFCC00", "#000000");
for (int i = 0; i < arrCode.length; i++) {
code.appendRow(i == 2 ? 1 : 0, new SimpleDumpData(arrCode[i]));
}
htmlBox.appendRow(1, new SimpleDumpData("Code"), code);
} catch (PageException e) {
}
}
// Java Stacktrace
String strST = getStackTraceAsString();
String[] arrST = ListUtil.listToStringArray(strST, '\n');
arrST = ListUtil.trim(arrST);
DumpTable st = new DumpTable("#ff9900", "#FFCC00", "#000000");
for (int i = 0; i < arrST.length; i++) {
st.appendRow(i == 0 ? 1 : 0, new SimpleDumpData(arrST[i]));
}
htmlBox.appendRow(1, new SimpleDumpData("Java Stacktrace"), st);
return htmlBox;
}
Aggregations