do \
$(MAKE) DB=$(DB) -s -C $$i $@ ; \
done
- @ ln -nsf rcvrpsql bin/receiver
- @ ln -nsf sndrpsql bin/sender
- @ ln -nsf srtrpsql bin/sorter
+ @ #ln -nsf rcvrpsql bin/receiver
+ @ #ln -nsf sndrpsql bin/sender
+ @ #ln -nsf srtrpsql bin/sorter
+ @ ln -nsf rcvrmsql bin/receiver
+ @ ln -nsf sndrmsql bin/sender
+ @ ln -nsf srtrmsql bin/sorter
#------------------------------------------------
#Configured for Postgresql database
#DB_TYPE can be either POSTGRESQL,MYSQL, default POSTGRESQL
-DB_TYPE=POSTGRESQL
DB_NAME=mailleur
DB_HOST=localhost
-DB_PORT=5432
+DB_LANG="UTF-8"
+#DB_TYPE=POSTGRESQL
+#DB_PORT=5432
+DB_TYPE=MYSQL
+DB_PORT=3306
+
#------------------------------------------------
#Dovecot storage directory
DOV_MAILDIR="/var/spool/mailleur/mails"
case 1 : //record does not exist
done=false;
if (sql_lock(sqlptr,RMTTBL)==false) {
- (void) rou_alert(0,"%s Unable to dbd_lockhard %s table",OPEP,RMTTBL);
+ (void) rou_alert(0,"%s Unable to lock %s table",OPEP,RMTTBL);
phase=999; //Unable to lock table
}
break;
/* within database. */
/* */
/********************************************************/
-PUBLIC _Bool mar_lock(MARPTR *maerptr,char *tablename)
+PUBLIC _Bool mar_lock(MARPTR *marptr,char *tablename)
{
#define OPEP "unimar.c:mar_lock,"
locked=false;
#ifdef DB_MYSQL
{
- (void) rou_alert(0,"%s not implemented yet",OPEP);
+ static const char *cmd="LOCK TABLE %s WRITE";
+
+ char fullcmd[300];
+ int phase;
+ _Bool proceed;
+
+ (void) snprintf(fullcmd,sizeof(fullcmd),cmd,tablename);
+ phase=0;
+ proceed=true;
+ while (proceed==true) {
+ (void) rou_alert(0,"%s JMPDBG phase='%d'",OPEP,phase);
+ switch (phase) {
+ case 0 : //Starting lock
+ if (mar_request(marptr,"BEGIN")<0) {
+ (void) rou_alert(0,"%s Unable to BEGIN to lock table <%s>",
+ OPEP,tablename);
+ phase=999; //no need to go further
+ }
+ break;
+ case 1 : //lock table itself
+ if (mar_request(marptr,fullcmd)<0) {
+ (void) rou_alert(0,"%s Unable to lock table <%s>",
+ OPEP,tablename);
+ phase=999; //no need to go further
+ }
+ break;
+ case 2 : //lock done
+ locked=true;
+ break;
+ default : //SAFE Guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
}
#endif
return locked;
unlocked=false;
#ifdef DB_MYSQL
{
- (void) rou_alert(0,"%s not implemented yet",OPEP);
+ char *cmd;
+
+ unlocked=true;
+ cmd="ROLLBACK";
+ if (commit==true);
+ cmd="COMMIT";
+ if (mar_request(marptr,cmd)<0) {
+ unlocked=false;
+ (void) rou_alert(0,"%s Unable to commit/rollback table (Bug?) ",OPEP);
+ }
+ if (mar_request(marptr,"UNLOCK TABLE")<0) {
+ unlocked=false;
+ (void) rou_alert(0,"%s Unable to unlock table (Bug?) ",OPEP);
+ }
}
#endif
return unlocked;