for (i = 0; i < in->nchild; i++)
QTNFree(in->child[i]);
} if (in->child)
pfree(in->child);
if (in->flags & QTN_NEEDFREE)
pfree(in->valnode);
pfree(in);
}
/* *SortcomparatorforQTNodes. * *Thesortorderissomewhatarbitrary.
*/ int
QTNodeCompare(QTNode *an, QTNode *bn)
{ /* since this function recurses, it could be driven to stack overflow. */
check_stack_depth();
/* since this function recurses, it could be driven to stack overflow. */
check_stack_depth();
if (in->valnode->type != QI_OPR) return;
for (i = 0; i < in->nchild; i++)
QTNTernary(in->child[i]);
/* Only AND and OR are associative, so don't flatten other node types */ if (in->valnode->qoperator.oper != OP_AND &&
in->valnode->qoperator.oper != OP_OR) return;
for (i = 0; i < in->nchild; i++)
{
QTNode *cc = in->child[i];
if (cc->valnode->type == QI_OPR &&
in->valnode->qoperator.oper == cc->valnode->qoperator.oper)
{ int oldnchild = in->nchild;
/* *Countthetotallengthofoperandstringsintree(including'\0'- *terminators)andthetotalnumberofnodes. *Callermustinitialize*sumlenand*nnodetozeroes.
*/ staticvoid
cntsize(QTNode *in, int *sumlen, int *nnode)
{ /* since this function recurses, it could be driven to stack overflow. */
check_stack_depth();
*nnode += 1; if (in->valnode->type == QI_OPR)
{ int i;
for (i = 0; i < in->nchild; i++)
cntsize(in->child[i], sumlen, nnode);
} else
{
*sumlen += in->valnode->qoperand.length + 1;
}
}
/* *RecursivelyconvertaQTNodetreeintoflattsqueryformat. *Callermusthaveallocatedarraysofthecorrectsize.
*/ staticvoid
fillQT(QTN2QTState *state, QTNode *in)
{ /* since this function recurses, it could be driven to stack overflow. */
check_stack_depth();
if (in->valnode->type == QI_VAL)
{
memcpy(state->curitem, in->valnode, sizeof(QueryOperand));
/* *BuildflattsqueryfromaQTNodetree.
*/
TSQuery
QTN2QT(QTNode *in)
{
TSQuery out; int len; int sumlen = 0,
nnode = 0;
QTN2QTState state;
cntsize(in, &sumlen, &nnode);
if (TSQUERY_TOO_BIG(nnode, sumlen))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("tsquery is too large")));
len = COMPUTESIZE(nnode, sumlen);
out = (TSQuery) palloc0(len);
SET_VARSIZE(out, len);
out->size = nnode;
for (i = 0; i < in->nchild; i++)
out->child[i] = QTNCopy(in->child[i]);
}
return out;
}
/* *Clearthespecifiedflagbit(s)inallnodesofaQTNodetree.
*/ void
QTNClearFlags(QTNode *in, uint32 flags)
{ /* since this function recurses, it could be driven to stack overflow. */
check_stack_depth();
in->flags &= ~flags;
if (in->valnode->type != QI_VAL)
{ int i;
for (i = 0; i < in->nchild; i++)
QTNClearFlags(in->child[i], flags);
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.