backend...
+++ /dev/null
-#-------------------------------------------------------------------------
-#
-# Makefile--
-# Makefile for new sequence functions.
-#
-#-------------------------------------------------------------------------
-
-PGDIR = ../..
-SRCDIR = $(PGDIR)/src
-
-include $(SRCDIR)/Makefile.global
-
-INCLUDE_OPT = -I ./ \
- -I $(SRCDIR)/ \
- -I $(SRCDIR)/include \
- -I $(SRCDIR)/port/$(PORTNAME)
-
-CFLAGS += $(INCLUDE_OPT)
-
-ifeq ($(PORTNAME), linux)
- ifdef LINUX_ELF
- ifeq ($(CC), gcc)
- CFLAGS += -fPIC
- endif
- endif
-endif
-
-ifeq ($(PORTNAME), i386_solaris)
- CFLAGS+= -fPIC
-endif
-
-MODNAME = set_sequence
-
-MODULE = $(MODNAME)$(DLSUFFIX)
-
-all: module sql
-
-module: $(MODULE)
-
-sql: $(MODNAME).sql
-
-install: $(MODULE)
- cp -p $(MODULE) $(LIBDIR)/modules
- cd $(LIBDIR)/modules; strip $(MODULE)
-
-%.sql: %.sql.in
- sed "s|MODULE_PATHNAME|$(LIBDIR)/modules/$(MODULE)|" < $< > $@
-
-.SUFFIXES: $(DLSUFFIX)
-
-%$(DLSUFFIX): %.c
- $(CC) $(CFLAGS) -shared -o $@ $<
-
-depend dep:
- $(CC) -MM $(INCLUDE_OPT) *.c >depend
-
-clean:
- rm -f $(MODULE) $(MODNAME).sql
-
-ifeq (depend,$(wildcard depend))
-include depend
-endif
+++ /dev/null
-/*
- * set_sequence.c --
- *
- * Set a new sequence value.
- *
- * Copyright (c) 1996, Massimo Dal Zotto <dz@cs.unitn.it>
- */
-
-#include "postgres.h"
-#include "nodes/parsenodes.h"
-#include "commands/sequence.h"
-
-#include "set_sequence.h"
-
-extern int setval(struct varlena * seqin, int4 val);
-
-int
-set_currval(struct varlena * sequence, int4 nextval)
-{
- return setval(sequence, nextval);
-}
-
-int
-next_id(struct varlena * sequence)
-{
- return nextval(sequence);
-}
-
-int
-last_id(struct varlena * sequence)
-{
- return currval(sequence);
-}
-
-int
-set_last_id(struct varlena * sequence, int4 nextval)
-{
- return setval(sequence, nextval);
-}
-
-/* end of file */
+++ /dev/null
-#ifndef SET_SEQUENCE_H
-#define SET_SEQUENCE_H
-
-int set_currval(struct varlena * sequence, int4 nextval);
-int next_id(struct varlena * sequence);
-int last_id(struct varlena * sequence);
-int set_last_id(struct varlena * sequence, int4 nextval);
-
-#endif
+++ /dev/null
--- SQL code to define new sequence utilities
-
--- Set a new sequence value
---
-create function set_currval(text, int4) returns int4
- as 'MODULE_PATHNAME'
- language 'C';
-
--- Increment the value of sequence
---
--- select next_id('sequence_name');
---
-create function next_id(text) returns int4
- as 'MODULE_PATHNAME'
- language 'C';
-
--- Return the last value set for a sequence
---
--- select last_id('sequence_name');
---
-create function last_id(text) returns int4
- as 'MODULE_PATHNAME'
- language 'C';
-
--- Set the current value of a sequence
---
--- select set_last_id('sequence_name', 1);
---
-create function set_last_id(text,int4) returns int4
- as 'MODULE_PATHNAME'
- language 'C';
-
--- end of file