__device__ void sqlite3ExplainPush(Vdbe *vdbe) { Explain *p; if (vdbe && (p = vdbe->Explain) != 0) { if (p->Str.zText && p->Indents.Length < _lengthof(p->Indents)) { const char *z = p->str.zText; int i = p->str.nChar - 1; int x; while (i >= 0 && z[i] != '\n') { i--; } x = (p->str.nChar - 1) - i; if (p->nIndent && x < p->aIndent[p->nIndent - 1]) { x = p->aIndent[p->nIndent - 1]; } p->aIndent[p->nIndent] = x; } p->nIndent++; } }
__device__ void sqlite3ExplainPop(Vdbe *p) { if (p && p->Explain) { p->Explain->Indents.Length--; } }
__device__ void sqlite3ExplainNL(Vdbe *vdbe) { Explain *p; if (vdbe && (p = vdbe->Explain) != nullptr && !endsWithNL(p)) { p->Str.Append("\n", 1); } }
__device__ void sqlite3ExplainFinish(Vdbe *vdbe) { if (vdbe && vdbe->Explain) { _free(vdbe->ExplainString); sqlite3ExplainNL(vdbe); vdbe->ExplainString = vdbe->Explain->Str.ToString(); _free(vdbe->Explain); vdbe->Explain = nullptr; _benignalloc_end(); } }