From: Jean-Marc Pigeon (Delson) Date: Tue, 17 Jun 2025 00:12:08 +0000 (-0400) Subject: Adding unisql components X-Git-Tag: tag-0.9~146 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=1ea301e94150839f1c5019fc5e9ec4cc68b821d3;p=jmp%2Fmailleur Adding unisql components --- diff --git a/lib/Makefile b/lib/Makefile index 598d980..6742bc2 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -17,16 +17,24 @@ clean : #-------------------------------------------------------------------- #database definition -shared : libposql +shared : libposql libmysql mv -f libposql.so.1.0 ../shared ln -nsf libposql.so.1.0 ../shared/libposql.so.1 + mv -f libmysql.so.1.0 ../shared + ln -nsf libmysql.so.1.0 ../shared/libmysql.so.1 libposql: unipos.o $(CC) -shared -Wl,-soname,$@.so.1 -o $@.so.1.0 unipos.o +libmysql: unisql.o + $(CC) -shared -Wl,-soname,$@.so.1 -o $@.so.1.0 unisql.o + unipos.o: unipos.h $(CC) $(CFLAGS) -c -fPIC -o $@ unipos.c +unisql.o: unisql.h + $(CC) $(CFLAGS) -c -fPIC -o $@ unisql.c + #-------------------------------------------------------------------- #Equivalences #-------------------------------------------------------------------- @@ -152,7 +160,7 @@ toremake: Makefile .PHONY: clean #-------------------------------------------------------------------- #database USED POSQL->Postgresql, MYSQL->mysql|mariadb -DATABASE= MYSQL +DATABASE= POSQL #-------------------------------------------------------------------- #definitions #-------------------------------------------------------------------- diff --git a/lib/unisql.c b/lib/unisql.c new file mode 100644 index 0000000..28615f5 --- /dev/null +++ b/lib/unisql.c @@ -0,0 +1,84 @@ +// vim: smarttab tabstop=8 shiftwidth=2 expandtab +/********************************************************/ +/* */ +/* Low level subroutine implementation */ +/* to handle POSTGRES SQL request */ +/* */ +/********************************************************/ +#include "subrou.h" +#include "unisql.h" + +/* + +*/ +/********************************************************/ +/* */ +/* Procedure to report database is not implemented */ +/* */ +/********************************************************/ +#ifndef MYSQL +static void notavail() + +{ +char *cmt="Postgresql Database access is NOT implemented (config?)"; + +(void) fprintf(stderr,"%s\n",cmt); +} +#endif +/* + +*/ +/********************************************************/ +/* */ +/* Procedure to establish a link with the */ +/* postgresq SQL server. */ +/* */ +/********************************************************/ +PUBLIC SQLPTR *sql_opensql(const char *host,const char *sqlport,const char *dbname) + +{ +#define OPEP "unisql.c:sql_opensql," + +SQLPTR *sqlptr; + +sqlptr=(SQLPTR *)0; +#ifdef MYSQL + { + (void) fprintf(stderr,"%s\n","To be implemented"); + } +#else + { + (void) notavail(); + } +#endif +return sqlptr; +#undef OPEP +} +/* + +*/ +/********************************************************/ +/* */ +/* Procedure to close the link with the designated */ +/* postgresql SQL server. */ +/* */ +/********************************************************/ +PUBLIC SQLPTR *sql_closesql(SQLPTR *sqlptr) + +{ +#define OPEP "sqlpos.c:sql_closesql," + +#ifdef MYSQL + { + (void) fprintf(stderr,"%s\n","To be implemented"); + } +#else + { + (void) notavail(); + } +#endif +return sqlptr; +#undef OPEP +} + + diff --git a/lib/unisql.h b/lib/unisql.h new file mode 100644 index 0000000..0a88104 --- /dev/null +++ b/lib/unisql.h @@ -0,0 +1,20 @@ +// vim: smarttab tabstop=8 shiftwidth=2 expandtab +/********************************************************/ +/* */ +/* Base level subroutine declaration */ +/* to handle MYSQL/MARIADB SQL request. */ +/* */ +/********************************************************/ +#ifndef UNISQL +#define UNISQL + +//reference to a SQL pointer reference +typedef void SQLPTR; + +//Opening a postscript database +extern SQLPTR *sql_opensql(const char *host,const char *sqlport,const char *dbname); + +//closing a postscript database +extern SQLPTR *sql_closesql(SQLPTR *sqlptr); + +#endif