summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/include')
-rw-r--r--src/interfaces/ecpg/include/Makefile16
-rw-r--r--src/interfaces/ecpg/include/Makefile.in15
-rw-r--r--src/interfaces/ecpg/include/ecpglib.h27
-rw-r--r--src/interfaces/ecpg/include/ecpgtype.h44
-rw-r--r--src/interfaces/ecpg/include/sqlca.h11
5 files changed, 113 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/include/Makefile b/src/interfaces/ecpg/include/Makefile
new file mode 100644
index 00000000000..08bc9df7f2d
--- /dev/null
+++ b/src/interfaces/ecpg/include/Makefile
@@ -0,0 +1,16 @@
+# Generated automatically from Makefile.in by configure.
+SRCDIR= ../../..
+include $(SRCDIR)/Makefile.global
+
+all clean::
+ @echo Nothing to be done.
+
+install::
+ install ecpglib.h $(HEADERDIR)
+ install ecpgtype.h $(HEADERDIR)
+ install sqlca.h $(HEADERDIR)
+
+uninstall::
+ rm -f $(HEADERDIR)/ecpglib.h
+ rm -f $(HEADERDIR)/ecpgtype.h
+ rm -f $(HEADERDIR)/sqlca.h
diff --git a/src/interfaces/ecpg/include/Makefile.in b/src/interfaces/ecpg/include/Makefile.in
new file mode 100644
index 00000000000..2f5c63ab078
--- /dev/null
+++ b/src/interfaces/ecpg/include/Makefile.in
@@ -0,0 +1,15 @@
+SRCDIR= ../../..
+include $(SRCDIR)/Makefile.global
+
+all clean::
+ @echo Nothing to be done.
+
+install::
+ install ecpglib.h $(HEADERDIR)
+ install ecpgtype.h $(HEADERDIR)
+ install sqlca.h $(HEADERDIR)
+
+uninstall::
+ rm -f $(HEADERDIR)/ecpglib.h
+ rm -f $(HEADERDIR)/ecpgtype.h
+ rm -f $(HEADERDIR)/sqlca.h
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h
new file mode 100644
index 00000000000..1fb35f8dfee
--- /dev/null
+++ b/src/interfaces/ecpg/include/ecpglib.h
@@ -0,0 +1,27 @@
+#include <c.h>
+
+void ECPGdebug(int, FILE *);
+bool ECPGconnect(const char * dbname);
+bool ECPGdo(int, char *, ...);
+bool ECPGcommit(int);
+bool ECPGrollback(int);
+bool ECPGfinish();
+bool ECPGstatus();
+
+void ECPGlog(const char * format, ...);
+
+#ifdef LIBPQ_FE_H
+bool ECPGsetdb(PGconn *);
+#endif
+
+/* Here are some methods used by the lib. */
+/* Returns a pointer to a string containing a simple type name. */
+const char * ECPGtype_name(enum ECPGttype);
+
+/* A generic varchar type. */
+struct ECPGgeneric_varchar {
+ int len;
+ char arr[1];
+};
+
+
diff --git a/src/interfaces/ecpg/include/ecpgtype.h b/src/interfaces/ecpg/include/ecpgtype.h
new file mode 100644
index 00000000000..496c934f4f4
--- /dev/null
+++ b/src/interfaces/ecpg/include/ecpgtype.h
@@ -0,0 +1,44 @@
+/*
+ * This file implements a data structure that is built and maintained by the
+ * preprocessor.
+ *
+ * All types that can be handled for host variable declarations has to
+ * be handled eventually.
+ */
+
+/*
+ * Here are all the types that we are to handle. Note that it is the type
+ * that is registered and that has nothing whatsoever to do with the storage
+ * class.
+ *
+ * Simle types
+ * integers: char, short, int, long (signed and unsigned)
+ * floats: float, double
+ *
+ * Complex types:
+ * VARCHAR, VARCHAR2 - Strings with length (maxlen is given in the declaration)
+ * Arrays of simple types and of VARCHAR, VARCHAR2 (size given in declaration)
+ * Records build of simple types, arrays and other records.
+ *
+ * Complicating things:
+ * typedefs and struct names!
+ *
+ * Conclusion:
+ * This is a typically recursive definition. A structure of typed list elements
+ * would probably work fine:
+ */
+#include <stdio.h>
+
+enum ECPGttype {
+ ECPGt_char = 1, ECPGt_unsigned_char, ECPGt_short, ECPGt_unsigned_short,
+ ECPGt_int, ECPGt_unsigned_int, ECPGt_long, ECPGt_unsigned_long,
+ ECPGt_bool,
+ ECPGt_float, ECPGt_double,
+ ECPGt_varchar, ECPGt_varchar2,
+ ECPGt_array,
+ ECPGt_record,
+ ECPGt_EOIT, /* End of insert types. */
+ ECPGt_EORT /* End of result types. */
+};
+
+#define IS_SIMPLE_TYPE(type) ((type) >= ECPGt_char && (type) <= ECPGt_varchar2)
diff --git a/src/interfaces/ecpg/include/sqlca.h b/src/interfaces/ecpg/include/sqlca.h
new file mode 100644
index 00000000000..0e7126e7b36
--- /dev/null
+++ b/src/interfaces/ecpg/include/sqlca.h
@@ -0,0 +1,11 @@
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+struct sqlca {
+ int sqlcode;
+ struct {
+ int sqlerrml;
+ char sqlerrmc[1000];
+ } sqlerrm;
+} sqlca;
+#endif