aboutsummaryrefslogtreecommitdiff
path: root/src/tutorial/funcs.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-03-14 15:22:15 +0000
committerBruce Momjian <bruce@momjian.us>1999-03-14 15:22:15 +0000
commit344190b7efea9ba2d9e7dcf85f7f40368edca58e (patch)
tree98ded37d3be89d5a3f5d4f5b136168dd7f33ff80 /src/tutorial/funcs.c
parentf6a9ed044517296374e9eec652f72fe3eddae1c7 (diff)
downloadpostgresql-344190b7efea9ba2d9e7dcf85f7f40368edca58e.tar.gz
postgresql-344190b7efea9ba2d9e7dcf85f7f40368edca58e.zip
Fixup for src/tutorial/func.c and src/tutorial/func.source
Removed char16 and replaced with an example using Point as suggested by Tom Lane. The dept field was changed to the cubicle field denoting the row(x) and column(y) of the employee's cube in the corporate jungle. The C function builds a 'compromise' cubicle from two suggested ones. I'll try and patchup the documentation next. Clark
Diffstat (limited to 'src/tutorial/funcs.c')
-rw-r--r--src/tutorial/funcs.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/tutorial/funcs.c b/src/tutorial/funcs.c
index 77eec35b729..cda3ef112a9 100644
--- a/src/tutorial/funcs.c
+++ b/src/tutorial/funcs.c
@@ -8,21 +8,21 @@
#include <string.h>
#include <stdio.h>
-#include "postgres.h" /* for char16, etc. */
+#include "postgres.h" /* for variable length type */
#include "utils/palloc.h" /* for palloc */
-#include "libpq-fe.h" /* for TUPLE */
#include "executor/executor.h" /* for GetAttributeByName() */
+#include "utils/geo_decls.h" /* for point type */
/* The following prototypes declare what we assume the user declares to
Postgres in his CREATE FUNCTION statement.
*/
int add_one(int arg);
-char16 *concat16(char16 * arg1, char16 * arg2);
+Point *makepoint(Point *pointx, Point *pointy );
text *copytext(text *t);
-bool c_overpaid(TUPLE t, /* the current instance of EMP */
- int4 limit);
+bool c_overpaid(TupleTableSlot *t, /* the current instance of EMP */
+ int4 limit);
@@ -32,14 +32,15 @@ add_one(int arg)
return arg + 1;
}
-char16 *
-concat16(char16 * arg1, char16 * arg2)
+Point *
+makepoint(Point *pointx, Point *pointy )
{
- char16 *new_c16 = (char16 *) palloc(sizeof(char16));
+ Point *new_point = (Point *) palloc(sizeof(Point));
- MemSet(new_c16, 0, sizeof(char16));
- strncpy((char *) new_c16, (char *) arg1, 16);
- return (char16 *) (strncat((char *) new_c16, (char *) arg2, 16));
+ new_point->x = pointx->x;
+ new_point->y = pointy->y;
+
+ return new_point;
}
text *
@@ -66,7 +67,7 @@ copytext(text *t)
}
bool
-c_overpaid(TUPLE t, /* the current instance of EMP */
+c_overpaid(TupleTableSlot *t, /* the current instance of EMP */
int4 limit)
{
bool isnull = false;