Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions | Variables

funcs.c File Reference

#include "postgres.h"
#include "executor/executor.h"
#include "utils/geo_decls.h"
Include dependency graph for funcs.c:

Go to the source code of this file.

Functions

int add_one (int arg)
float8add_one_float8 (float8 *arg)
Pointmakepoint (Point *pointx, Point *pointy)
textcopytext (text *t)
textconcat_text (text *arg1, text *arg2)
bool c_overpaid (HeapTupleHeader t, int32 limit)

Variables

 PG_MODULE_MAGIC

Function Documentation

int add_one ( int  arg  ) 

Definition at line 36 of file funcs.c.

{
    return arg + 1;
}

float8 * add_one_float8 ( float8 arg  ) 

Definition at line 44 of file funcs.c.

References palloc().

{
    float8     *result = (float8 *) palloc(sizeof(float8));

    *result = *arg + 1.0;

    return result;
}

bool c_overpaid ( HeapTupleHeader  t,
int32  limit 
)

Definition at line 102 of file funcs.c.

References DatumGetInt32, and GetAttributeByName().

{
    bool        isnull;
    int32       salary;

    salary = DatumGetInt32(GetAttributeByName(t, "salary", &isnull));
    if (isnull)
        return false;
    return salary > limit;
}

text * concat_text ( text arg1,
text arg2 
)

Definition at line 86 of file funcs.c.

References palloc(), SET_VARSIZE, VARDATA, and VARSIZE.

{
    int32       arg1_size = VARSIZE(arg1) - VARHDRSZ;
    int32       arg2_size = VARSIZE(arg2) - VARHDRSZ;
    int32       new_text_size = arg1_size + arg2_size + VARHDRSZ;
    text       *new_text = (text *) palloc(new_text_size);

    SET_VARSIZE(new_text, new_text_size);
    memcpy(VARDATA(new_text), VARDATA(arg1), arg1_size);
    memcpy(VARDATA(new_text) + arg1_size, VARDATA(arg2), arg2_size);
    return new_text;
}

text * copytext ( text t  ) 

Definition at line 67 of file funcs.c.

References palloc(), SET_VARSIZE, VARDATA, VARHDRSZ, and VARSIZE.

{
    /*
     * VARSIZE is the total size of the struct in bytes.
     */
    text       *new_t = (text *) palloc(VARSIZE(t));

    SET_VARSIZE(new_t, VARSIZE(t));

    /*
     * VARDATA is a pointer to the data region of the struct.
     */
    memcpy((void *) VARDATA(new_t),     /* destination */
           (void *) VARDATA(t), /* source */
           VARSIZE(t) - VARHDRSZ);      /* how many bytes */
    return new_t;
}

Point * makepoint ( Point pointx,
Point pointy 
)

Definition at line 54 of file funcs.c.

References palloc(), Point::x, and Point::y.

{
    Point      *new_point = (Point *) palloc(sizeof(Point));

    new_point->x = pointx->x;
    new_point->y = pointy->y;

    return new_point;
}


Variable Documentation

Definition at line 19 of file funcs.c.