Ejemplo n.º 1
0
Datum mol_murckoscaffold(PG_FUNCTION_ARGS) {
  CROMol mol;
  Mol *res;
  fcinfo->flinfo->fn_extra =
      searchMolCache(fcinfo->flinfo->fn_extra, fcinfo->flinfo->fn_mcxt,
                     PG_GETARG_DATUM(0), NULL, &mol, NULL);
  CROMol scaffold = MolMurckoScaffold(mol);
  if (!scaffold) PG_RETURN_NULL();
  res = deconstructROMol(scaffold);
  freeCROMol(scaffold);

  PG_RETURN_MOL_P(res);
}
Ejemplo n.º 2
0
Datum mol_adjust_query_properties(PG_FUNCTION_ARGS) {
  CROMol mol;
  fcinfo->flinfo->fn_extra =
      searchMolCache(fcinfo->flinfo->fn_extra, fcinfo->flinfo->fn_mcxt,
                     PG_GETARG_DATUM(0), NULL, &mol, NULL);
  Assert(mol != 0);
  char *data = PG_GETARG_CSTRING(1);

  CROMol adj = MolAdjustQueryProperties(mol, data);
  if (!adj) PG_RETURN_NULL();
  Mol *res = deconstructROMol(adj);
  freeCROMol(adj);

  PG_RETURN_MOL_P(res);
}
Ejemplo n.º 3
0
Datum
gmol_compress(PG_FUNCTION_ARGS)
{
  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
  GISTENTRY *retval = entry;

  if (entry->leafkey) {
    CROMol m = constructROMol(DatumGetMolP(entry->key));

    retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));

    gistentryinit(*retval, PointerGetDatum(makeMolSignature(m)),
                  entry->rel, entry->page,
                  entry->offset, false);
    freeCROMol(m);
  }       
  else if ( !ISALLTRUE(DatumGetPointer(entry->key)) ) {
    retval = compressAllTrue(entry);
  }
  
  PG_RETURN_POINTER(retval);
}