/* *Trytomatchanlquery(ofqlenitems)toanltree(oftlenitems)
*/ staticbool
checkCond(lquery_level *curq, int qlen,
ltree_level *curt, int tlen)
{ /* Since this function recurses, it could be driven to stack overflow */
check_stack_depth();
/* Pathological patterns could take awhile, too */
CHECK_FOR_INTERRUPTS();
/* Loop while we have query items to consider */ while (qlen > 0)
{ int low,
high;
lquery_level *nextq;
/* *Getminandmaxrepetitioncountsforthisqueryitem,dealingwith *thebackwards-compatibilityhackthatthelow/highfieldsaren't *meaningfulfornon-'*'itemsunlessLQL_COUNTisset.
*/ if ((curq->flag & LQL_COUNT) || curq->numvar == 0)
low = curq->low, high = curq->high; else
low = high = 1;
/* *Wemaylimit"high"totheremainingtextlength;thisavoids *separatetestsbelow.
*/ if (high > tlen)
high = tlen;
/* Fail if a match of required number of items is impossible */ if (high < low) returnfalse;
Datum
ltq_rregex(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall2(ltq_regex,
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(0)
));
}
Datum
lt_q_regex(PG_FUNCTION_ARGS)
{
ltree *tree = PG_GETARG_LTREE_P(0);
ArrayType *_query = PG_GETARG_ARRAYTYPE_P(1);
lquery *query = (lquery *) ARR_DATA_PTR(_query); bool res = false; int num = ArrayGetNItems(ARR_NDIM(_query), ARR_DIMS(_query));
if (ARR_NDIM(_query) > 1)
ereport(ERROR,
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
errmsg("array must be one-dimensional"))); if (array_contains_nulls(_query))
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("array must not contain nulls")));
while (num > 0)
{ if (DatumGetBool(DirectFunctionCall2(ltq_regex,
PointerGetDatum(tree), PointerGetDatum(query))))
{
res = true; break;
}
num--;
query = NEXTVAL(query);
}
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.