Beispiel #1
0
static	void
_CheckDBG(
	char		*name,
	DBG_Struct	*dbg,
	char		*red_name)
{
	DBG_Struct	*red_dbg;
	char *src_port, *dsc_port;
	char *dbg_dbname = "", *red_dbg_dbname = "";
	char	*dbname;
ENTER_FUNC;		
	if		(  dbg->redirect  !=  NULL  ) {
		red_dbg = dbg->redirect;
		if ( strcmp(red_dbg->name, red_name ) == 0 ){
			src_port = StrDup(StringPort(GetDB_Port(dbg,DB_UPDATE)));
			dsc_port = StrDup(StringPort(GetDB_Port(red_dbg,DB_UPDATE)));
			if		(  ( dbname = GetDB_DBname(dbg,DB_UPDATE) )  !=  NULL  ) {
				dbg_dbname = dbname;
			}
			if		(  ( dbname = GetDB_DBname(red_dbg,DB_UPDATE) )  !=  NULL  ) {
				red_dbg_dbname = dbname;
			}
			if ( ( strcmp(dbg->type, red_dbg->type ) == 0 )
				 && ( strcmp(dbg_dbname, red_dbg_dbname ) == 0 )
				 && ( strcmp(src_port, dsc_port) == 0 ) ) {
				Error("The connection destination is same DB");
			}
			xfree(src_port);
			xfree(dsc_port);
		}
	}
LEAVE_FUNC;
}
Beispiel #2
0
extern int GetDB_PortMode(DBG_Struct *dbg) {
  Port *port;
  int mode;

  port = GetDB_Port(dbg);
  if ((port != NULL) && port->type == PORT_UNIX) {
    mode = UNIX_MODE(port);
  } else {
    mode = 0;
  }
  return (mode);
}
Beispiel #3
0
extern char *GetDB_Host(DBG_Struct *dbg) {
  char *host;

  if (DB_Host != NULL) {
    host = DB_Host;
  } else {
    if ((host = GetMONDB_ENV(dbg, "HOST")) == NULL) {
      host = IP_HOST((GetDB_Port(dbg)));
    }
  }
  return (host);
}
Beispiel #4
0
extern char *GetDB_PortName(DBG_Struct *dbg) {
  Port *port;
  char *portname;

  if (DB_Port != NULL) {
    portname = DB_Port;
  } else {
    if ((portname = GetMONDB_ENV(dbg, "PORT")) == NULL) {
      port = GetDB_Port(dbg);
      if ((port != NULL) && (port->type == PORT_IP)) {
        portname = IP_PORT(port);
      } else {
        portname = NULL;
      }
    }
  }
  return (portname);
}