]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
*** empty log message ***
authorhadaq <hadaq>
Fri, 24 Jan 2003 13:03:55 +0000 (13:03 +0000)
committerhadaq <hadaq>
Fri, 24 Jan 2003 13:03:55 +0000 (13:03 +0000)
allParam/psql/Makefile [deleted file]
allParam/psql/README [deleted file]
allParam/psql/psqlParam.c [deleted file]

diff --git a/allParam/psql/Makefile b/allParam/psql/Makefile
deleted file mode 100644 (file)
index 5be04bb..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-CFLAGS = -g -ansi -Wall -I/usr/include/pgsql -I../include
-ARFLAGS = -rc
-
-libpsqlParam.a : psqlParam.o
-       $(AR) $(ARFLAGS) $@ $<
-
-psqlParam.o : psqlParam.c
-
-install : libpsqlParam.a
-       -mkdir -p $(LIBDIR)
-       cp $< $(LIBDIR)
-       -mkdir -p $(INCDIR)
-       cp -f ../include/allParam.h $(INCDIR)
-
-clean :
-       rm -f *.o
-
-lib_clean :
-       rm -f *.o *.a
-
diff --git a/allParam/psql/README b/allParam/psql/README
deleted file mode 100644 (file)
index 9a596d1..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-Author:  Benjamin Sailer
-         TUM/E12
-         Benjamin.Sailer@ph.tum.de
-Version: 0.2
-Date:    2001-05-31
-
-libpsqlParam.a
-==============
-
-Content
--------
-
-1. Compiletime requirements
-2. Linktime requirments
-3. Runtime requirments
-4. Known bugs and further developement perspectives
-
-1. Compiletime requirements
----------------------------
-
-  The PostgreSQL frontend header used here (which is delivered with the
-posrgresql-devel package on actual Linux distributions) is called libpq-fe.h
-and was found in /usr/include/pgsql on my system. As libpsqlParam.a was only
-developed as a side path and is not really useful for the broad hades collab,
-I didn't loos time investigating the situation on other os' or only other
-distributions.
-
-2. Linktime requirments
------------------------
-
-  According to the above said, there is also no information available where to
-find the libpq.[a|so] and the libcrypt.[a|so] on the diverse systems while at
-redhat 6.0 they can be found in the normal library search path (/usr/lib).
-
-3. Runtime requirments
-----------------------
-
-  libpsqlParam.a will try to open a connection to a postgres database located
-on casino.e12.physik.tu-muenchen.de and called 'hadaq'. Note that actual data
-are not likely to be available there, but the testing enviroment should be
-in the current setup. 
-
-4. Known bugs and further developement perspectives
----------------------------------------------------
-
-  As the little database containing all the test values unfortunately
-disappeared, the improvements of the library package are not put into the
-psql-tree at all. It is not clear whether this tree will disappear completely
-in the next version or updated together with a new version of the database.
-So at the end it is strongly recommended not to rely on this part being
-developed anymore at all.
-
-Please send bug reports to
-
-Benjamin.Sailer@ph.tum.de
-
diff --git a/allParam/psql/psqlParam.c b/allParam/psql/psqlParam.c
deleted file mode 100644 (file)
index 1cee36b..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-#define _POSIX_C_SOURCE 199509L
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include <libpq-fe.h>
-
-#include <allParam.h>
-
-#define PG_MAX_QUERY_LEN 1024
-#define PG_MAX_CLAUSE_LEN 256
-
-static void Param_strerror(Param *, const char *);
-
-int conSetupParam(Param *my, const char *setup)
-{
-       my->strerror = NULL;
-       if(setup != NULL) {
-               my->setup = malloc(strlen(setup) + 1);
-               strcpy(my->setup, setup);
-       }
-       return 0;
-}
-
-int conParam(Param *my)
-{
-       return conSetupParam(my, NULL);
-}
-
-void desParam(Param *my)
-{
-       if(my->setup != NULL) {
-               free(my->setup);
-       }
-}
-
-int Param_getInt(const Param *my, const char *name, const char *idx, int *row, unsigned long int *val)
-{
-       return Param_getIntArray(my, name, idx, 1, row, val);
-}
-
-int Param_getString(const Param *my, const char *name, const char *idx, int *row, char *val)
-{
-       return Param_getStringArray(my, name, idx, 1, row, &val);
-}
-
-int Param_getFilename(const Param *my, const char *name, const char *idx, int *row, char *val)
-{
-       return Param_getFilenameArray(my, name, idx, 1, row, &val);
-}
-
-int Param_getIntArray(const Param *my, const char *name, const char *idx, int maxrows, int *rows, unsigned long int *val)
-{
-       int fnum;
-       int i;
-       PGresult *result;
-       PGconn *conn;
-       char whereClause[PG_MAX_CLAUSE_LEN];
-       char query[PG_MAX_QUERY_LEN];
-       char *endptr;
-       char lname[PARAM_MAX_NAME_LEN];
-       char lidx[PARAM_MAX_NAME_LEN];
-
-       for(i = 0 ; i <=strlen(name) ; i++) {
-               lname[i] = tolower(name[i]);
-       }
-       for(i = 0 ; i <=strlen(idx) ; i++) {
-               lidx[i] = tolower(idx[i]);
-       }
-
-       *rows = 0;
-       conn = PQconnectdb("host=casino.e12.physik.tu-muenchen.de dbname=hadaq user=bsailer");
-       if (my->setup == NULL) {
-               sprintf(whereClause, "WHERE name = '%s' AND idx = '%s' ", lname, lidx);
-               sprintf(query, "SELECT * FROM card_params %s UNION SELECT * FROM cpus %s UNION SELECT * FROM crate_params %s UNION SELECT * FROM crate_setup %s ORDER BY seq_num;", whereClause, whereClause, whereClause, whereClause);
-       } else {
-               sprintf(whereClause, "WHERE setup = '%s' AND name = '%s' AND idx = '%s' ", my->setup, lname, lidx);
-               sprintf(query, "SELECT * FROM setup_card_params %s UNION SELECT * FROM setup_cpus %s UNION SELECT * FROM setup_crate_params %s UNION SELECT * FROM setup_crate_setup %s ORDER BY seq_num;", whereClause, whereClause, whereClause, whereClause);
-       }
-
-       result = PQexec(conn, query);
-       if(PQresultStatus(result) != PGRES_TUPLES_OK) {
-               Param_strerror((Param *) my, "The PostgreSQL query result is not correct.");
-               return -1;
-       }
-       fnum = PQfnumber(result, "value");
-
-       if ((*rows = PQntuples(result)) > maxrows) {
-               *rows = maxrows;
-       }
-       for (i = 0 ; i < *rows ; i++) {
-               val[i] = strtoul(PQgetvalue(result, i, fnum), &endptr, 0);
-               if(*endptr != '\0') {
-                       Param_strerror((Param *) my, "Value seems to be no integer.");
-                       *rows = 0;
-                       return -1;
-               }
-       }
-       for (i = *rows ; i < maxrows ; i++) {
-               val[i] = 0;
-       }
-       PQfinish(conn);
-
-       return 0;
-}
-
-int Param_getStringArray(const Param *my, const char *name, const char *idx, int maxrows, int *rows, char **val)
-{
-       int fnum;
-       int i;
-       PGconn *conn;
-       PGresult *result;
-       char whereClause[PG_MAX_CLAUSE_LEN];
-       char query[PG_MAX_QUERY_LEN];
-       char lname[PARAM_MAX_NAME_LEN];
-       char lidx[PARAM_MAX_NAME_LEN];
-
-       for(i = 0 ; i <=strlen(name) ; i++) {
-               lname[i] = tolower(name[i]);
-       }
-       for(i = 0 ; i <=strlen(idx) ; i++) {
-               lidx[i] = tolower(idx[i]);
-       }
-
-       *rows = 0;
-       conn = PQconnectdb("host=casino.e12.physik.tu-muenchen.de dbname=hadaq user=bsailer");
-       if (my->setup == NULL) {
-               sprintf(whereClause, "WHERE name = '%s' AND idx = '%s' ", lname, lidx);
-               sprintf(query, "SELECT * FROM card_params %s UNION SELECT * FROM cpus %s UNION SELECT * FROM crate_params %s UNION SELECT * FROM crate_setup %s ORDER BY seq_num;", whereClause, whereClause, whereClause, whereClause);
-       } else {
-               sprintf(whereClause, "WHERE setup = '%s' AND name = '%s' AND idx = '%s' ", my->setup, lname, lidx);
-               sprintf(query, "SELECT * FROM setup_card_params %s UNION SELECT * FROM setup_cpus %s UNION SELECT * FROM setup_crate_params %s UNION SELECT * FROM setup_crate_setup %s ORDER BY seq_num;", whereClause, whereClause, whereClause, whereClause);
-       }
-
-       result = PQexec(conn, query);
-       if(PQresultStatus(result) != PGRES_TUPLES_OK) {
-               Param_strerror((Param *) my, "The PostgreSQL query result is not correct.");
-               return -1;
-       }
-       fnum = PQfnumber(result, "value");
-
-       if ((*rows = PQntuples(result)) > maxrows) {
-               *rows = maxrows;
-       }
-       for (i = 0 ; i < *rows ; i++) {
-               strcpy(val[i], PQgetvalue(result, i, fnum));
-       }
-       for (i = *rows ; i < maxrows ; i++) {
-               val[i] = NULL;
-       }
-       PQfinish(conn);
-
-       return 0;
-}
-
-int Param_getFilenameArray(const Param *my, const char *name, const char *idx, int maxrows, int *rows, char **val)
-{
-       int retVal = 0;
-       int row = 0;
-       int i;
-       char *value[PARAM_MAX_ARRAY_LEN];
-
-       for (i = 0 ; i < maxrows ; i++) {
-               value[i] = malloc(PARAM_MAX_VALUE_LEN);
-       }
-
-       if (((retVal = Param_getStringArray(my, name, idx, maxrows, rows, value)) == 0) && (*rows > 0)) {
-               char basedir[PARAM_MAX_VALUE_LEN];
-
-               if ((Param_getString(my, "glob", "basedir", &row, basedir) == 0) && (row == 1)) {
-                       strcat(basedir, "/");
-               } else {
-                       strcpy(basedir, "");
-               }
-               for (i = 0 ; i < *rows ; i++) {
-                       if (value[i][0] != '/') {
-                               strcpy(val[i], basedir);
-                       } else {
-                               strcpy(val[i], "");
-                       }
-                       strcat(val[i], value[i]);
-               }
-       } else {
-               *rows = 0;
-       }
-
-       for (i = 0 ; i < maxrows ; i++) {
-               free(value[i]);
-       }
-
-       return retVal;
-}
-
-int Param_getBlob(const Param *my, const char *name, const char *idx, size_t *size, FILE **val)
-{
-       int retVal = 0;
-       char filename[PARAM_MAX_VALUE_LEN];
-       int rows;
-       FILE *stream;
-
-       retVal = Param_getFilename(my, name, idx, &rows, filename);
-       if ((rows == 0) || (stream = fopen(filename, "r")) == NULL) {
-               Param_strerror((Param *) my, strerror(errno));
-               *size = 0;
-               retVal = -1;
-       } else {
-               struct stat fileS, *file = &fileS;
-               stat(filename, file);
-               *size = (size_t) file->st_size;
-               fprintf(stderr, "Result: %d.\n", *size);
-               *val = stream;
-       }
-       return retVal;
-}
-
-int Param_storeInt(const Param *my, const char *name, const char *idx, unsigned long int val)
-{
-       int i;
-       PGresult *result;
-       PGconn *conn;
-       char query[PG_MAX_QUERY_LEN];
-       char lsetup[PARAM_MAX_NAME_LEN];
-       char lname[PARAM_MAX_NAME_LEN];
-       char lidx[PARAM_MAX_NAME_LEN];
-
-       for(i = 0 ; i <=strlen(name) ; i++) {
-               lname[i] = tolower(name[i]);
-       }
-       for(i = 0 ; i <=strlen(idx) ; i++) {
-               lidx[i] = tolower(idx[i]);
-       }
-
-       conn = PQconnectdb("host=casino.e12.physik.tu-muenchen.de dbname=hadaq user=bsailer");
-       if (my->setup == NULL) {
-               sprintf(query, "INSERT INTO store_int VALUES ('%s', '%s', %lu)", lname, lidx, val);
-       } else {
-               for(i = 0 ; i <=strlen(my->setup) ; i++) {
-                       lsetup[i] = tolower(my->setup[i]);
-               }
-               sprintf(query, "INSERT INTO setup_store_int VALUES ('%s', '%s', '%s', %lu)", lsetup, lname, lidx, val);
-       }
-
-       result = PQexec(conn, query);
-       if(PQresultStatus(result) != PGRES_TUPLES_OK) {
-               Param_strerror((Param *) my, "The PostgreSQL query result is not correct.");
-               return -1;
-       }
-
-       PQfinish(conn);
-
-       return 0;
-}
-
-int Param_storeString(const Param *my, const char *name, const char *idx, const char *val)
-{
-       int i;
-       PGresult *result;
-       PGconn *conn;
-       char query[PG_MAX_QUERY_LEN];
-       char lsetup[PARAM_MAX_NAME_LEN];
-       char lname[PARAM_MAX_NAME_LEN];
-       char lidx[PARAM_MAX_NAME_LEN];
-
-       for(i = 0 ; i <=strlen(name) ; i++) {
-               lname[i] = tolower(name[i]);
-       }
-       for(i = 0 ; i <=strlen(idx) ; i++) {
-               lidx[i] = tolower(idx[i]);
-       }
-
-       conn = PQconnectdb("host=casino.e12.physik.tu-muenchen.de dbname=hadaq user=bsailer");
-       if (my->setup == NULL) {
-               sprintf(query, "INSERT INTO store_string VALUES ('%s', '%s', '%s')", lname, lidx, val);
-       } else {
-               for(i = 0 ; i <=strlen(my->setup) ; i++) {
-                       lsetup[i] = tolower(my->setup[i]);
-               }
-               sprintf(query, "INSERT INTO setup_store_string VALUES ('%s', '%s', '%s', '%s')", lsetup, lname, lidx, val);
-       }
-
-       result = PQexec(conn, query);
-       if(PQresultStatus(result) != PGRES_TUPLES_OK) {
-               Param_strerror((Param *) my, "The PostgreSQL query result is not correct.");
-               return -1;
-       }
-
-       PQfinish(conn);
-
-       return 0;
-}
-
-void Param_clearCache(const Param *my)
-{
-}
-
-const char *Param_getErrStr(const Param *my)
-{
-       return my->strerror;
-}
-
-static void Param_strerror(Param *my, const char *strerror)
-{
-       my->strerror = realloc(my->strerror, (strlen(strerror) + 1) * sizeof(char));
-       if(my->strerror != NULL) {
-               strcpy(my->strerror, strerror);
-       }
-}
-