Commit fe0c9b14 authored by claes's avatar claes

More mysql

parent 5a2f02f3
/*
* Proview $Id: wb_dbms.cpp,v 1.6 2008-02-04 13:34:49 claes Exp $
* Proview $Id: wb_dbms.cpp,v 1.7 2008-02-05 14:53:12 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -26,6 +26,7 @@
#include "pwr.h"
#include "pwr_class.h"
#include "co_dcli.h"
#include "co_syi.h"
#include "wb_ldh.h"
#include "wb_ldh_msg.h"
#include "wb_destination.h"
......@@ -726,6 +727,21 @@ char *wb_dbms_env::dbName(void)
return dbname;
}
char *wb_dbms_env::host(void)
{
char nodename[80];
pwr_tStatus sts;
static char host[80];
syi_NodeName( &sts, nodename, sizeof(nodename));
if ( ODD(sts) && cdh_NoCaseStrcmp( nodename, m_host) == 0)
strcpy( host, "localhost");
else
strcpy( host, m_host);
return host;
}
void wb_dbms_env::port(const unsigned int port)
{
m_port = port;
......@@ -876,7 +892,7 @@ int wb_dbms_env::create()
return errno;
}
fprintf(fp, "HOST...: %s\n", host());
fprintf(fp, "HOST...: %s\n", m_host);
fprintf(fp, "USER...: %s\n", user());
if ( !passwd() || strcmp( passwd(), "") == 0)
fprintf(fp, "PASSWD.: (null)\n");
......
/*
* Proview $Id: wb_dbms.h,v 1.2 2008-02-04 13:34:49 claes Exp $
* Proview $Id: wb_dbms.h,v 1.3 2008-02-05 14:53:12 claes Exp $
* Copyright (C) 2007 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -176,7 +176,7 @@ public:
char *dbName(void);
inline char *fileName(void) { return m_fileName;}
inline char *host(void) { return m_host;}
char *host(void);
inline char *user(void) { return m_user;}
inline char *passwd(void) { return m_passwd;}
inline unsigned int port(void) { return m_port;}
......
/*
* Proview $Id: wb_erep.cpp,v 1.54 2008-02-04 13:34:49 claes Exp $
* Proview $Id: wb_erep.cpp,v 1.55 2008-02-05 14:53:12 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -773,11 +773,13 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
else {
// Open db
if ( nr >= 5 && vol_array[4][0] == '1') {
#if defined PWRE_CONF_MYSQL
wb_vrepdbms *vrepdbms = new wb_vrepdbms( this, vname);
vrepdbms->name(vol_array[0]);
addDb( &sts, vrepdbms);
MsgWindow::message( 'I', "Database opened", vname);
vol_cnt++;
#endif
}
else {
wb_vrepdb *vrepdb = new wb_vrepdb( this, vname);
......@@ -1084,6 +1086,7 @@ wb_vrep *wb_erep::createVolume(pwr_tStatus *sts, pwr_tVid vid, pwr_tCid cid,
return 0;
}
#if defined PWRE_CONF_MYSQL
wb_dbms_env *env = new wb_dbms_env();
env->create( vname, host, user, password, cdh_Low(name), port, socket);
......@@ -1095,7 +1098,9 @@ wb_vrep *wb_erep::createVolume(pwr_tStatus *sts, pwr_tVid vid, pwr_tCid cid,
addDb( sts, vrepdbms);
MsgWindow::message( 'I', "Database created", vname);
return vrepdbms;
#endif
}
return 0;
}
......
/*
* Proview $Id: wb_ldh.cpp,v 1.66 2008-02-04 13:34:49 claes Exp $
* Proview $Id: wb_ldh.cpp,v 1.67 2008-02-05 14:53:12 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1989,6 +1989,7 @@ ldh_WbLoad( ldh_tSession session, char *loadfile, int ignore_oix)
erep->merep()->copyFiles( db_name);
}
else {
#if defined PWRE_CONF_MYSQL
char socket[80];
char user[80];
char password[80];
......@@ -2013,6 +2014,7 @@ ldh_WbLoad( ldh_tSession session, char *loadfile, int ignore_oix)
dbms.copy( *vwbl, db_name);
dbms.close();
erep->merep()->copyFiles( db_name);
#endif
}
delete vwbl;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment