本文整理汇总了C++中PG_RETURN_BOOL函数的典型用法代码示例。如果您正苦于以下问题:C++ PG_RETURN_BOOL函数的具体用法?C++ PG_RETURN_BOOL怎么用?C++ PG_RETURN_BOOL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PG_RETURN_BOOL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spherecircle_cont_poly_com_neg
Datum spherecircle_cont_poly_com_neg (PG_FUNCTION_ARGS)
{
SPOLY * poly = PG_GETARG_SPOLY( 0 ) ;
SCIRCLE * circ = ( SCIRCLE * ) PG_GETARG_POINTER ( 1 ) ;
PG_RETURN_BOOL ( poly_circle_pos ( poly, circ ) != PGS_CIRCLE_CONT_POLY );
}
示例2: weak_input_status
Datum
weak_input_status(PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(g_weak);
}
示例3: g_int_consistent
/*
** The GiST Consistent method for _intments
** Should return false if for all data items x below entry,
** the predicate x op query == FALSE, where op is the oper
** corresponding to strategy in the pg_amop table.
*/
Datum
g_int_consistent(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
ArrayType *query = PG_GETARG_ARRAYTYPE_P_COPY(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
/* Oid subtype = PG_GETARG_OID(3); */
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool retval;
/* this is exact except for RTSameStrategyNumber */
*recheck = (strategy == RTSameStrategyNumber);
if (strategy == BooleanSearchStrategy)
{
retval = execconsistent((QUERYTYPE *) query,
(ArrayType *) DatumGetPointer(entry->key),
GIST_LEAF(entry));
pfree(query);
PG_RETURN_BOOL(retval);
}
/* sort query for fast search, key is already sorted */
CHECKARRVALID(query);
PREPAREARR(query);
switch (strategy)
{
case RTOverlapStrategyNumber:
retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key),
query);
break;
case RTSameStrategyNumber:
if (GIST_LEAF(entry))
DirectFunctionCall3(g_int_same,
entry->key,
PointerGetDatum(query),
PointerGetDatum(&retval));
else
retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
query);
break;
case RTContainsStrategyNumber:
case RTOldContainsStrategyNumber:
retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
query);
break;
case RTContainedByStrategyNumber:
case RTOldContainedByStrategyNumber:
if (GIST_LEAF(entry))
retval = inner_int_contains(query,
(ArrayType *) DatumGetPointer(entry->key));
else
retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key),
query);
break;
default:
retval = FALSE;
}
pfree(query);
PG_RETURN_BOOL(retval);
}
示例4: ssl_is_used
Datum
ssl_is_used(PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(MyProcPort->ssl != NULL);
}
示例5: cdb_heap_test
//.........这里部分代码省略.........
// Now allocate nSlots arrays for the sorted ints, and an array for the counts
values = (HeapValue *)palloc0( nToGenerate * sizeof(HeapValue));
slotcounts = (int *)palloc0( nSlots * sizeof(int) );
slotpositions = (int *)palloc0( nSlots * sizeof(int) );
// Now randomly assign the values to nSlots, preserving order
for ( i=0; i<nToGenerate; i++ )
{
int slot = floor( ((double)rand() / ((double)RAND_MAX + 1 )) * nSlots);
Assert( slot >= 0 && slot < nSlots);
values[i].source = slot;
values[i].value = intvals + i;
slotcounts[slot]++;
}
elog( DEBUG4, "Slot counts follow" );
int sum = 0;
for ( i=0; i<nSlots; i++ )
{
if ( slotcounts[i] == 0 )
{
ereport(NOTICE,
(errcode(ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH),
errmsg("Function cdb_heap_test() cannot proceed, because not all slots got values."))
);
result = false;
goto end;
}
sum += slotcounts[i];
elog( DEBUG4, "slotcount[%d] = %d" , i, slotcounts[i]);
}
elog( DEBUG4, "slotcount total = %d" , sum);
// Now add the first element from each slot to the heap.
for ( i=0; i<nSlots; i++ )
{
int index = GetNextValueForSlot( values, i, slotpositions[i], nToGenerate );
SetCdbHeapInitialValue( cdbheap, &values[index] );
slotpositions[i] = index+1;
}
// Now grab lowest element from heap, and ask for the next element from the
// same slot
int lastval = INT_MIN;
int lastslot;
for ( i=0; i<nToGenerate; i++ )
{
HeapValue *phv = (HeapValue *)GetLowestValueFromCdbHeap( cdbheap );
Assert( phv != NULL );
if ( phv->value == NULL )
{
ereport(NOTICE,
(errcode(ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH),
errmsg("Function cdb_heap_test() failed. At index %d, value was NULL",
i ))
);
result = false;
goto end;
}
if ( lastval > *phv->value )
{
ereport(NOTICE,
(errcode(ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH),
errmsg("Function cdb_heap_test() failed. At index %d, value %d was smaller than previous value %d",
i, *phv->value, lastval ))
);
result = false;
goto end;
}
lastval = *phv->value;
lastslot = phv->source;
int index = GetNextValueForSlot( values, lastslot, slotpositions[lastslot], nToGenerate );
if ( index == -1 )
phv->value = NULL;
else
{
phv = &values[index];
slotpositions[lastslot] = index + 1;
}
MergeNewValueIntoCdbHeap( cdbheap, phv );
}
phv = GetLowestValueFromCdbHeap( cdbheap );
Assert( phv != NULL && phv->value == NULL );
end:
if ( cdbheap != NULL )
DestroyCdbHeap( cdbheap );
PG_RETURN_BOOL(result);
}
示例6: plvdate_using_easter
Datum
plvdate_using_easter (PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(use_easter);
}
示例7: spg_text_leaf_consistent
//.........这里部分代码省略.........
bool res;
int j;
/* all tests are exact */
out->recheck = false;
leafValue = DatumGetTextPP(in->leafDatum);
if (DatumGetPointer(in->reconstructedValue))
reconstrValue = DatumGetTextP(in->reconstructedValue);
Assert(level == 0 ? reconstrValue == NULL :
VARSIZE_ANY_EXHDR(reconstrValue) == level);
/* Reconstruct the full string represented by this leaf tuple */
fullLen = level + VARSIZE_ANY_EXHDR(leafValue);
if (VARSIZE_ANY_EXHDR(leafValue) == 0 && level > 0)
{
fullValue = VARDATA(reconstrValue);
out->leafValue = PointerGetDatum(reconstrValue);
}
else
{
text *fullText = palloc(VARHDRSZ + fullLen);
SET_VARSIZE(fullText, VARHDRSZ + fullLen);
fullValue = VARDATA(fullText);
if (level)
memcpy(fullValue, VARDATA(reconstrValue), level);
if (VARSIZE_ANY_EXHDR(leafValue) > 0)
memcpy(fullValue + level, VARDATA_ANY(leafValue),
VARSIZE_ANY_EXHDR(leafValue));
out->leafValue = PointerGetDatum(fullText);
}
/* Perform the required comparison(s) */
res = true;
for (j = 0; j < in->nkeys; j++)
{
StrategyNumber strategy = in->scankeys[j].sk_strategy;
text *query = DatumGetTextPP(in->scankeys[j].sk_argument);
int queryLen = VARSIZE_ANY_EXHDR(query);
int r;
if (strategy > 10)
{
/* Collation-aware comparison */
strategy -= 10;
/* If asserts enabled, verify encoding of reconstructed string */
Assert(pg_verifymbstr(fullValue, fullLen, false));
r = varstr_cmp(fullValue, Min(queryLen, fullLen),
VARDATA_ANY(query), Min(queryLen, fullLen),
PG_GET_COLLATION());
}
else
{
/* Non-collation-aware comparison */
r = memcmp(fullValue, VARDATA_ANY(query), Min(queryLen, fullLen));
}
if (r == 0)
{
if (queryLen > fullLen)
r = -1;
else if (queryLen < fullLen)
r = 1;
}
switch (strategy)
{
case BTLessStrategyNumber:
res = (r < 0);
break;
case BTLessEqualStrategyNumber:
res = (r <= 0);
break;
case BTEqualStrategyNumber:
res = (r == 0);
break;
case BTGreaterEqualStrategyNumber:
res = (r >= 0);
break;
case BTGreaterStrategyNumber:
res = (r > 0);
break;
default:
elog(ERROR, "unrecognized strategy number: %d",
in->scankeys[j].sk_strategy);
res = false;
break;
}
if (!res)
break; /* no need to consider remaining conditions */
}
PG_RETURN_BOOL(res);
}
示例8: spherepoly_cont_ellipse_com
Datum spherepoly_cont_ellipse_com (PG_FUNCTION_ARGS)
{
SELLIPSE * ell = ( SELLIPSE * ) PG_GETARG_POINTER ( 0 ) ;
SPOLY * poly = PG_GETARG_SPOLY( 1 ) ;
PG_RETURN_BOOL ( poly_ellipse_pos ( poly, ell ) == PGS_POLY_CONT_ELLIPSE );
}
示例9: pg_is_in_backup
/*
* Returns bool with current on-line backup mode, a global state.
*/
Datum
pg_is_in_backup(PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(BackupInProgress());
}
示例10: spherepoly_cont_poly_com_neg
Datum spherepoly_cont_poly_com_neg (PG_FUNCTION_ARGS)
{
SPOLY * poly1 = PG_GETARG_SPOLY( 1 ) ;
SPOLY * poly2 = PG_GETARG_SPOLY( 0 ) ;
PG_RETURN_BOOL ( poly_poly_pos ( poly1, poly2, FALSE ) != PGS_POLY_CONT );
}
示例11: spherepoly_overlap_poly_neg
Datum spherepoly_overlap_poly_neg (PG_FUNCTION_ARGS)
{
SPOLY * poly1 = PG_GETARG_SPOLY( 0 ) ;
SPOLY * poly2 = PG_GETARG_SPOLY( 1 ) ;
PG_RETURN_BOOL ( poly_poly_pos ( poly1, poly2, FALSE ) == PGS_POLY_AVOID );
}
示例12: spherepoly_overlap_line_com_neg
Datum spherepoly_overlap_line_com_neg (PG_FUNCTION_ARGS)
{
SPOLY * poly = PG_GETARG_SPOLY( 1 ) ;
SLine * line = ( SLine * ) PG_GETARG_POINTER ( 0 ) ;
PG_RETURN_BOOL ( poly_line_pos ( poly, line ) == PGS_LINE_POLY_AVOID );
}
示例13: spherepoly_cont_line_com_neg
Datum spherepoly_cont_line_com_neg (PG_FUNCTION_ARGS)
{
SPOLY * poly = PG_GETARG_SPOLY( 1 ) ;
SLine * line = ( SLine * ) PG_GETARG_POINTER ( 0 ) ;
PG_RETURN_BOOL ( poly_line_pos ( poly, line ) != PGS_POLY_CONT_LINE );
}
示例14: spherepoly_overlap_circle_com_neg
Datum spherepoly_overlap_circle_com_neg (PG_FUNCTION_ARGS)
{
SPOLY * poly = PG_GETARG_SPOLY( 1 ) ;
SCIRCLE * circ = ( SCIRCLE * ) PG_GETARG_POINTER ( 0 ) ;
PG_RETURN_BOOL ( poly_circle_pos ( poly, circ ) == PGS_CIRCLE_POLY_AVOID );
}
示例15: gp_add_persistent_database_node_entry
Datum
gp_add_persistent_database_node_entry(PG_FUNCTION_ARGS)
{
NYI;
PG_RETURN_BOOL(true);
}