LTP GCOV extension - code coverage report
Current view: directory - access/common - scankey.c
Test: unnamed
Date: 2008-07-03 Instrumented lines: 26
Code covered: 100.0 % Executed lines: 26
Legend: not executed executed

       1                 : /*-------------------------------------------------------------------------
       2                 :  *
       3                 :  * scankey.c
       4                 :  *        scan key support code
       5                 :  *
       6                 :  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
       7                 :  * Portions Copyright (c) 1994, Regents of the University of California
       8                 :  *
       9                 :  *
      10                 :  * IDENTIFICATION
      11                 :  *        $PostgreSQL: pgsql/src/backend/access/common/scankey.c,v 1.30 2007/04/06 22:33:41 tgl Exp $
      12                 :  *
      13                 :  *-------------------------------------------------------------------------
      14                 :  */
      15                 : #include "postgres.h"
      16                 : 
      17                 : #include "access/skey.h"
      18                 : 
      19                 : 
      20                 : /*
      21                 :  * ScanKeyEntryInitialize
      22                 :  *              Initializes a scan key entry given all the field values.
      23                 :  *              The target procedure is specified by OID (but can be invalid
      24                 :  *              if SK_SEARCHNULL is set).
      25                 :  *
      26                 :  * Note: CurrentMemoryContext at call should be as long-lived as the ScanKey
      27                 :  * itself, because that's what will be used for any subsidiary info attached
      28                 :  * to the ScanKey's FmgrInfo record.
      29                 :  */
      30                 : void
      31                 : ScanKeyEntryInitialize(ScanKey entry,
      32                 :                                            int flags,
      33                 :                                            AttrNumber attributeNumber,
      34                 :                                            StrategyNumber strategy,
      35                 :                                            Oid subtype,
      36                 :                                            RegProcedure procedure,
      37                 :                                            Datum argument)
      38            5147 : {
      39            5147 :         entry->sk_flags = flags;
      40            5147 :         entry->sk_attno = attributeNumber;
      41            5147 :         entry->sk_strategy = strategy;
      42            5147 :         entry->sk_subtype = subtype;
      43            5147 :         entry->sk_argument = argument;
      44            5147 :         if (RegProcedureIsValid(procedure))
      45            5134 :                 fmgr_info(procedure, &entry->sk_func);
      46                 :         else
      47                 :         {
      48                 :                 Assert(flags & SK_SEARCHNULL);
      49              13 :                 MemSet(&entry->sk_func, 0, sizeof(entry->sk_func));
      50                 :         }
      51            5147 : }
      52                 : 
      53                 : /*
      54                 :  * ScanKeyInit
      55                 :  *              Shorthand version of ScanKeyEntryInitialize: flags and subtype
      56                 :  *              are assumed to be zero (the usual value).
      57                 :  *
      58                 :  * This is the recommended version for hardwired lookups in system catalogs.
      59                 :  * It cannot handle NULL arguments, unary operators, or nondefault operators,
      60                 :  * but we need none of those features for most hardwired lookups.
      61                 :  *
      62                 :  * Note: CurrentMemoryContext at call should be as long-lived as the ScanKey
      63                 :  * itself, because that's what will be used for any subsidiary info attached
      64                 :  * to the ScanKey's FmgrInfo record.
      65                 :  */
      66                 : void
      67                 : ScanKeyInit(ScanKey entry,
      68                 :                         AttrNumber attributeNumber,
      69                 :                         StrategyNumber strategy,
      70                 :                         RegProcedure procedure,
      71                 :                         Datum argument)
      72          128003 : {
      73          128003 :         entry->sk_flags = 0;
      74          128003 :         entry->sk_attno = attributeNumber;
      75          128003 :         entry->sk_strategy = strategy;
      76          128003 :         entry->sk_subtype = InvalidOid;
      77          128003 :         entry->sk_argument = argument;
      78          128003 :         fmgr_info(procedure, &entry->sk_func);
      79          128003 : }
      80                 : 
      81                 : /*
      82                 :  * ScanKeyEntryInitializeWithInfo
      83                 :  *              Initializes a scan key entry using an already-completed FmgrInfo
      84                 :  *              function lookup record.
      85                 :  *
      86                 :  * Note: CurrentMemoryContext at call should be as long-lived as the ScanKey
      87                 :  * itself, because that's what will be used for any subsidiary info attached
      88                 :  * to the ScanKey's FmgrInfo record.
      89                 :  */
      90                 : void
      91                 : ScanKeyEntryInitializeWithInfo(ScanKey entry,
      92                 :                                                            int flags,
      93                 :                                                            AttrNumber attributeNumber,
      94                 :                                                            StrategyNumber strategy,
      95                 :                                                            Oid subtype,
      96                 :                                                            FmgrInfo *finfo,
      97                 :                                                            Datum argument)
      98          388435 : {
      99          388435 :         entry->sk_flags = flags;
     100          388435 :         entry->sk_attno = attributeNumber;
     101          388435 :         entry->sk_strategy = strategy;
     102          388435 :         entry->sk_subtype = subtype;
     103          388435 :         entry->sk_argument = argument;
     104          388435 :         fmgr_info_copy(&entry->sk_func, finfo, CurrentMemoryContext);
     105          388435 : }

Generated by: LTP GCOV extension version 1.5