Permalink
Browse files

version 1.0

  • Loading branch information...
0 parents commit fbca990e23577d452a290d88d93ecbcc70497c00 @ZhengYang committed Jun 3, 2011
Showing with 1,874 additions and 0 deletions.
  1. +38 −0 Makefile
  2. +46 −0 README
  3. +29 −0 couchdb_fdw--1.0.sql
  4. +1,741 −0 couchdb_fdw.c
  5. +19 −0 couchdb_fdw.control
  6. +1 −0 libjson
@@ -0,0 +1,38 @@
+##########################################################################
+#
+# foreign-data wrapper for CouchDB
+#
+# Copyright (c) 2011, PostgreSQL Global Development Group
+#
+# This software is released under the PostgreSQL Licence
+#
+# Author: Zheng Yang <zhengyang4k@gmail.com>
+#
+# IDENTIFICATION
+# couchdb_fdw/Makefile
+#
+##########################################################################
+
+MODULE_big = couchdb_fdw
+OBJS = couchdb_fdw.o
+
+EXTENSION = couchdb_fdw
+DATA = couchdb_fdw--1.0.sql
+
+REGRESS = couchdb_fdw
+
+EXTRA_CLEAN = sql/couchdb_fdw.sql expected/couchdb_fdw.out
+
+SHLIB_LINK = -lcurl -lyajl
+
+ifdef USE_PGXS
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+else
+subdir = contrib/couchdb_fdw
+top_builddir = ../..
+include $(top_builddir)/src/Makefile.global
+include $(top_srcdir)/contrib/contrib-global.mk
+endif
+
@@ -0,0 +1,46 @@
+CouchDB FDW for PostgreSQL 9.1+
+==============================
+
+This PostgreSQL extension implements a Foreign Data Wrapper (FDW) for
+the CouchDB document-oriented database: http://couchdb.apache.org/
+
+Usage
+-----
+
+The following parameters can be set on a CouchDB foreign server:
+
+address: The address or hostname of the CouchDB server.
+ Default: 127.0.0.1
+
+port: The port number on which the CouchDB server is listening.
+ Default: 6379
+
+The following parameter can be set on a CouchDB foreign table:
+
+database: The numeric ID of the CouchDB database to query.
+ Default: 0
+
+The following parameter can be set on a user mapping for a CouchDB
+foreign server:
+
+password: The password to authenticate to the CouchDB server with.
+ Default: <none>
+
+Example
+-------
+
+CREATE SERVER couchdb_server
+ FOREIGN DATA WRAPPER couchdb_fdw
+ OPTIONS (address '127.0.0.1', port '6379');
+
+CREATE FOREIGN TABLE couchdb_db0 (key text, value text)
+ SERVER couchdb_server
+ OPTIONS (database '0');
+
+CREATE USER MAPPING FOR PUBLIC
+ SERVER couchdb_server
+ OPTIONS (password 'secret');
+
+--
+Zheng Yang
+zhengyang4k@gmail.com
@@ -0,0 +1,29 @@
+/*-------------------------------------------------------------------------
+ *
+ * foreign-data wrapper for CouchDB
+ *
+ * Copyright (c) 2011, PostgreSQL Global Development Group
+ *
+ * This software is released under the PostgreSQL Licence
+ *
+ * Author: Zheng Yang <zhengyang4k@gmail.com>
+ *
+ * IDENTIFICATION
+ * couchdb_fdw/couchdb_fdw--1.0.sql
+ *
+ *-------------------------------------------------------------------------
+ */
+
+CREATE FUNCTION couchdb_fdw_handler()
+RETURNS fdw_handler
+AS 'MODULE_PATHNAME'
+LANGUAGE C STRICT;
+
+CREATE FUNCTION couchdb_fdw_validator(text[], oid)
+RETURNS void
+AS 'MODULE_PATHNAME'
+LANGUAGE C STRICT;
+
+CREATE FOREIGN DATA WRAPPER couchdb_fdw
+ HANDLER couchdb_fdw_handler
+ VALIDATOR couchdb_fdw_validator;
Oops, something went wrong.

0 comments on commit fbca990

Please sign in to comment.