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
#--------------------------------------------------------------------
.PHONY: clean
#--------------------------------------------------------------------
-#database USED POSQL->Postgresql, MYSQL->mysql|mariadb
-DATABASE= POSQL
-#--------------------------------------------------------------------
#definitions
#--------------------------------------------------------------------
CC = gcc
LD = gcc
-CFLAGS = -Wall -D_GNU_SOURCE $(OPTIME) -D$(DATABASE)
+CFLAGS = -Wall -D_GNU_SOURCE $(OPTIME)
LIBMAIL = libmail.a
PAR = -j`/usr/bin/getconf _NPROCESSORS_ONLN`
#--------------------------------------------------------------------
#include "subrou.h"
#include "unipos.h"
-/*
-\f
-*/
-/********************************************************/
-/* */
-/* Procedure to report database is not implemented */
-/* */
-/********************************************************/
-#ifndef POSQL
-static void notavail()
-
-{
-char *cmt="Postgresql Database access is NOT implemented (config?)";
-
-(void) fprintf(stderr,"%s\n",cmt);
-}
-#endif
/*
\f
*/
{
#define OPEP "unipos.c:pos_opensql,"
-POSPTR *posptr;
-
-posptr=(POSPTR *)0;
-#ifdef POSQL
- {
- PGconn *pf;
- char *z; //parameter null
+char *z; //parameter null
+PGconn *pf;
- z=(char *)0;
- pf=PQsetdbLogin(host,sqlport,z,z,dbname,z,z);
- // Check if the connection is successful
- if (PQstatus(pf)!=CONNECTION_OK) {
- (void) rou_alert(0,"%s Connection to database '%s' failed, cause '%s'",
- OPEP,dbname,PQerrorMessage(pf));
- (void) PQfinish(pf);
- pf=(PGconn *)0;
- }
- posptr=(POSPTR *)pf;
- }
-#else
- {
- (void) notavail();
+z=(char *)0;
+pf=PQsetdbLogin(host,sqlport,z,z,dbname,z,z);
+// Check if the connection is successful
+if (PQstatus(pf)!=CONNECTION_OK) {
+ (void) rou_alert(0,"%s Connection to database '%s' failed, cause '%s'",
+ OPEP,dbname,PQerrorMessage(pf));
+ (void) PQfinish(pf);
+ pf=(PGconn *)0;
}
-#endif
-return posptr;
+return (POSPTR *)pf;
#undef OPEP
}
/*
{
#define OPEP "unipos.c:pos_closesql,"
-#ifdef POSQL
- {
- PGconn *pf;
+PGconn *pf;
- pf=(PGconn *)posptr;
- if (pf==(PGconn *)0) {
- (void) rou_alert(0,"%s Database link already closedi (Bug?)",OPEP);
- (void) PQfinish(pf);
- }
- else {
- (void) PQfinish((PGconn *)pf);
- pf=(PGconn *)0;
- }
- posptr=(POSPTR *)pf;
+pf=(PGconn *)posptr;
+if (pf==(PGconn *)0) {
+ (void) rou_alert(0,"%s Database link already closedi (Bug?)",OPEP);
+ (void) PQfinish(pf);
}
-#else
- {
- (void) notavail();
+else {
+ (void) PQfinish((PGconn *)pf);
+ pf=(PGconn *)0;
}
-#endif
-return posptr;
+return (POSPTR *)pf;
#undef OPEP
}
#include "subrou.h"
#include "unisql.h"
-/*
-\f
-*/
-/********************************************************/
-/* */
-/* 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
/*
\f
*/
SQLPTR *sqlptr;
sqlptr=(SQLPTR *)0;
-#ifdef MYSQL
- {
- (void) fprintf(stderr,"%s\n","To be implemented");
- }
-#else
- {
- (void) notavail();
- }
-#endif
+(void) fprintf(stderr,"%s\n","To be implemented");
return sqlptr;
#undef OPEP
}
{
#define OPEP "sqlpos.c:sql_closesql,"
-#ifdef MYSQL
- {
- (void) fprintf(stderr,"%s\n","To be implemented");
- }
-#else
- {
- (void) notavail();
- }
-#endif
+(void) fprintf(stderr,"%s\n","To be implemented");
return sqlptr;
+
#undef OPEP
}