Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
c2716dcd
Commit
c2716dcd
authored
Feb 04, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mysql database added
parent
3e0a9704
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
829 additions
and
307 deletions
+829
-307
wb/lib/wb/src/wb_dbms.cpp
wb/lib/wb/src/wb_dbms.cpp
+42
-7
wb/lib/wb/src/wb_dbms.h
wb/lib/wb/src/wb_dbms.h
+4
-5
wb/lib/wb/src/wb_env.cpp
wb/lib/wb/src/wb_env.cpp
+4
-3
wb/lib/wb/src/wb_env.h
wb/lib/wb/src/wb_env.h
+3
-2
wb/lib/wb/src/wb_erep.cpp
wb/lib/wb/src/wb_erep.cpp
+95
-33
wb/lib/wb/src/wb_erep.h
wb/lib/wb/src/wb_erep.h
+2
-2
wb/lib/wb/src/wb_ldh.cpp
wb/lib/wb/src/wb_ldh.cpp
+56
-15
wb/lib/wb/src/wb_ldh.h
wb/lib/wb/src/wb_ldh.h
+8
-6
wb/lib/wb/src/wb_lfu.cpp
wb/lib/wb/src/wb_lfu.cpp
+285
-45
wb/lib/wb/src/wb_lfu.h
wb/lib/wb/src/wb_lfu.h
+58
-75
wb/lib/wb/src/wb_utl.cpp
wb/lib/wb/src/wb_utl.cpp
+3
-1
wb/lib/wb/src/wb_vrepdbms.cpp
wb/lib/wb/src/wb_vrepdbms.cpp
+239
-108
wb/lib/wb/src/wb_vrepdbms.h
wb/lib/wb/src/wb_vrepdbms.h
+3
-2
wb/lib/wb/src/wb_wnav_command.cpp
wb/lib/wb/src/wb_wnav_command.cpp
+27
-3
No files found.
wb/lib/wb/src/wb_dbms.cpp
View file @
c2716dcd
/*
* Proview $Id: wb_dbms.cpp,v 1.
5 2007-12-06 10:55:04
claes Exp $
* Proview $Id: wb_dbms.cpp,v 1.
6 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -33,6 +33,8 @@
#include "wb_name.h"
#include "wb_export.h"
#include "wb_convert_volume.h"
#include "wb_utl_api.h"
#include "co_cdh.h"
#include <iostream>
wb_dbms
::
wb_dbms
()
:
...
...
@@ -199,6 +201,13 @@ void wb_dbms::create(pwr_tVid vid, pwr_tCid cid, const char *volumeName, const c
importHead
(
oid
,
cid
,
pwr_cNOid
,
pwr_cNOid
,
pwr_cNOid
,
pwr_cNOid
,
pwr_cNOid
,
n
.
name
(),
n
.
normName
(),
flags
,
time
,
time
,
time
,
rbSize
,
0
);
if
(
rbSize
)
{
void
*
body
=
calloc
(
1
,
rbSize
);
importRbody
(
oid
,
rbSize
,
body
);
free
(
body
);
}
wb_dbms_info
i
(
this
);
i
.
get
(
m_txn
);
m_vid
=
i
.
vid
();
...
...
@@ -696,6 +705,27 @@ void wb_dbms_env::fileName(const char *fileName)
strcpy
(
m_fileName
,
fileName
);
}
char
*
wb_dbms_env
::
dbName
(
void
)
{
char
pname
[
80
];
pwr_tStatus
sts
;
static
char
dbname
[
80
];
sts
=
utl_get_projectname
(
pname
);
if
(
EVEN
(
sts
))
{
printf
(
"** Project is not configured
\n
"
);
return
m_dbName
;
}
strcpy
(
dbname
,
"pwrp_"
);
strcat
(
dbname
,
pname
);
strcat
(
dbname
,
"__"
);
strcat
(
dbname
,
m_dbName
);
cdh_ToLower
(
dbname
,
dbname
);
return
dbname
;
}
void
wb_dbms_env
::
port
(
const
unsigned
int
port
)
{
m_port
=
port
;
...
...
@@ -828,8 +858,8 @@ int wb_dbms_env::create()
printf
(
"wb_dbms_env::create: %s
\n
"
,
m_fileName
);
/* Create the directory, read/write/access owner and group. */
if
(
stat
(
n
ame
,
&
sb
)
!=
0
)
{
if
(
mkdir
(
n
ame
,
S_IRWXU
|
S_IRWXG
)
!=
0
)
{
if
(
stat
(
m_fileN
ame
,
&
sb
)
!=
0
)
{
if
(
mkdir
(
m_fileN
ame
,
S_IRWXU
|
S_IRWXG
)
!=
0
)
{
fprintf
(
stderr
,
"wb_dbms_env::create: mkdir: %s, %s
\n
"
,
m_fileName
,
strerror
(
errno
));
return
errno
;
}
...
...
@@ -848,8 +878,11 @@ int wb_dbms_env::create()
fprintf
(
fp
,
"HOST...: %s
\n
"
,
host
());
fprintf
(
fp
,
"USER...: %s
\n
"
,
user
());
fprintf
(
fp
,
"PASSWD.: %s
\n
"
,
passwd
());
fprintf
(
fp
,
"DB_NAME: %s
\n
"
,
dbName
());
if
(
!
passwd
()
||
strcmp
(
passwd
(),
""
)
==
0
)
fprintf
(
fp
,
"PASSWD.: (null)
\n
"
);
else
fprintf
(
fp
,
"PASSWD.: %s
\n
"
,
passwd
());
fprintf
(
fp
,
"DB_NAME: %s
\n
"
,
m_dbName
);
fprintf
(
fp
,
"PORT...: %d
\n
"
,
port
());
fprintf
(
fp
,
"SOCKET.: %s
\n
"
,
socket
());
...
...
@@ -877,7 +910,7 @@ int wb_dbms_env::open(void)
cdh_ToLower
(
m_fileName
,
m_fileName
);
sprintf
(
buf
,
"%s/%s"
,
m_fileName
,
"connection.d
bms
"
);
sprintf
(
buf
,
"%s/%s"
,
m_fileName
,
"connection.d
msql
"
);
FILE
*
fp
=
fopen
(
buf
,
"r"
);
if
(
fp
==
NULL
)
{
...
...
@@ -927,8 +960,10 @@ int wb_dbms_env::open(void)
}
}
printf
(
"ready!!!
\n
"
);
printf
(
"ready!!!
\n
"
);
fclose
(
fp
);
m_exists
=
true
;
return
0
;
}
...
...
wb/lib/wb/src/wb_dbms.h
View file @
c2716dcd
/*
* Proview $Id: wb_dbms.h,v 1.
1 2007-10-18 09:11:01
claes Exp $
* Proview $Id: wb_dbms.h,v 1.
2 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2007 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -163,9 +163,8 @@ public:
MYSQL
*
openDb
(
void
);
bool
exists
()
{
return
m_exists
;}
int
close
(
void
);
int
close
(
void
);
void
fileName
(
const
char
*
fileName
);
void
host
(
const
char
*
host
);
...
...
@@ -175,11 +174,11 @@ public:
void
port
(
unsigned
int
port
);
void
socket
(
const
char
*
socket
);
char
*
dbName
(
void
);
inline
char
*
fileName
(
void
)
{
return
m_fileName
;}
inline
char
*
host
(
void
)
{
return
m_host
;}
inline
char
*
user
(
void
)
{
return
m_user
;}
inline
char
*
passwd
(
void
)
{
return
m_passwd
;}
inline
char
*
dbName
(
void
)
{
return
m_dbName
;}
inline
unsigned
int
port
(
void
)
{
return
m_port
;}
inline
char
*
socket
(
void
)
{
return
m_socket
;}
...
...
wb/lib/wb/src/wb_env.cpp
View file @
c2716dcd
/*
* Proview $Id: wb_env.cpp,v 1.
9 2005-11-22 12:22:2
9 claes Exp $
* Proview $Id: wb_env.cpp,v 1.
10 2008-02-04 13:34:4
9 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -108,9 +108,10 @@ wb_volume wb_env::volume(const char *name)
return
v
;
}
wb_volume
wb_env
::
createVolume
(
pwr_tVid
vid
,
pwr_tCid
cid
,
const
char
*
name
,
bool
add
)
wb_volume
wb_env
::
createVolume
(
pwr_tVid
vid
,
pwr_tCid
cid
,
const
char
*
name
,
ldh_eVolRep
type
,
char
*
server
,
bool
add
)
{
wb_volume
v
(
m_erep
->
createVolume
(
&
m_sts
,
vid
,
cid
,
name
,
add
));
wb_volume
v
(
m_erep
->
createVolume
(
&
m_sts
,
vid
,
cid
,
name
,
type
,
server
,
add
));
return
v
;
}
...
...
wb/lib/wb/src/wb_env.h
View file @
c2716dcd
/*
* Proview $Id: wb_env.h,v 1.
9 2005-11-22 12:22:2
9 claes Exp $
* Proview $Id: wb_env.h,v 1.
10 2008-02-04 13:34:4
9 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -61,7 +61,8 @@ public:
wb_volume
snapshot
(
pwr_tVid
);
wb_volume
createVolume
(
pwr_tVid
vid
,
pwr_tCid
cid
,
const
char
*
name
,
bool
add
=
true
);
wb_volume
createVolume
(
pwr_tVid
vid
,
pwr_tCid
cid
,
const
char
*
name
,
ldh_eVolRep
type
,
char
*
server
,
bool
add
=
true
);
int
nextVolatileVid
(
char
*
name
)
{
return
m_erep
->
nextVolatileVid
(
&
m_sts
,
name
);
}
...
...
wb/lib/wb/src/wb_erep.cpp
View file @
c2716dcd
/*
* Proview $Id: wb_erep.cpp,v 1.5
3 2007-12-21 13:18:01
claes Exp $
* Proview $Id: wb_erep.cpp,v 1.5
4 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -26,7 +26,7 @@
#include "wb_vrepwbl.h"
#include "wb_vrepdbs.h"
#include "wb_vrepdb.h"
//
#include "wb_vrepdbms.h"
#include "wb_vrepdbms.h"
#include "wb_vrepced.h"
#include "wb_vrepref.h"
#include "wb_vrepext.h"
...
...
@@ -36,9 +36,13 @@
#include "wb_adrep.h"
#include "wb_name.h"
#include "wb_dblock.h"
#include "wb_dbms.h"
#include "wb_utl_api.h"
#include "wb_lfu.h"
#include "wb_ldh_msg.h"
#include "co_msgwindow.h"
#include "co_wow.h"
#include "co_cnf.h"
extern
"C"
{
#include "co_dcli.h"
...
...
@@ -701,7 +705,10 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
strcpy
(
vname
,
"$pwrp_db/"
);
strcat
(
vname
,
vol_array
[
0
]);
cdh_ToLower
(
vname
,
vname
);
strcat
(
vname
,
".db"
);
if
(
nr
>=
5
&&
vol_array
[
4
][
0
]
==
'1'
)
strcat
(
vname
,
".dbms"
);
else
strcat
(
vname
,
".db"
);
dcli_translate_filename
(
vname
,
vname
);
sts
=
dcli_search_file
(
vname
,
found_file
,
DCLI_DIR_SEARCH_INIT
);
...
...
@@ -765,12 +772,21 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
}
else
{
// Open db
wb_vrepdb
*
vrepdb
=
new
wb_vrepdb
(
this
,
vname
);
vrepdb
->
name
(
vol_array
[
0
]);
addDb
(
&
sts
,
vrepdb
);
MsgWindow
::
message
(
'I'
,
"Database opened"
,
vname
);
vol_cnt
++
;
}
if
(
nr
>=
5
&&
vol_array
[
4
][
0
]
==
'1'
)
{
wb_vrepdbms
*
vrepdbms
=
new
wb_vrepdbms
(
this
,
vname
);
vrepdbms
->
name
(
vol_array
[
0
]);
addDb
(
&
sts
,
vrepdbms
);
MsgWindow
::
message
(
'I'
,
"Database opened"
,
vname
);
vol_cnt
++
;
}
else
{
wb_vrepdb
*
vrepdb
=
new
wb_vrepdb
(
this
,
vname
);
vrepdb
->
name
(
vol_array
[
0
]);
addDb
(
&
sts
,
vrepdb
);
MsgWindow
::
message
(
'I'
,
"Database opened"
,
vname
);
vol_cnt
++
;
}
}
}
}
}
...
...
@@ -807,19 +823,24 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_No
);
CoWow
*
wow
=
MsgWindow
::
get_wow
();
int
res
=
wow
->
CreateModalDialog
(
"Database Locked"
,
msg
,
"Exit"
,
0
,
"Remove lock"
,
"$pwr_exe/wtt_padlock.png"
);
switch
(
res
)
{
case
wow_eModalDialogReturn_NYI
:
case
wow_eModalDialogReturn_Button2
:
case
wow_eModalDialogReturn_Button1
:
case
wow_eModalDialogReturn_Deleted
:
if
(
wow
)
{
int
res
=
wow
->
CreateModalDialog
(
"Database Locked"
,
msg
,
"Exit"
,
0
,
"Remove lock"
,
"$pwr_exe/wtt_padlock.png"
);
switch
(
res
)
{
case
wow_eModalDialogReturn_NYI
:
case
wow_eModalDialogReturn_Button2
:
case
wow_eModalDialogReturn_Button1
:
case
wow_eModalDialogReturn_Deleted
:
exit
(
0
);
case
wow_eModalDialogReturn_Button3
:
// Remove lock
wb_dblock
::
dbunlock
(
vname
);
break
;
}
}
else
exit
(
0
);
case
wow_eModalDialogReturn_Button3
:
// Remove lock
wb_dblock
::
dbunlock
(
vname
);
break
;
}
}
wb_vrepdb
*
vrepdb
=
new
wb_vrepdb
(
this
,
vname
);
vrepdb
->
name
(
"directory"
);
...
...
@@ -1018,27 +1039,68 @@ int wb_erep::nextVolatileVid( pwr_tStatus *sts, char *name)
}
wb_vrep
*
wb_erep
::
createVolume
(
pwr_tStatus
*
sts
,
pwr_tVid
vid
,
pwr_tCid
cid
,
const
char
*
name
,
bool
add
)
const
char
*
name
,
ldh_eVolRep
type
,
char
*
server
,
bool
add
)
{
char
vname
[
200
];
pwr_tFileName
vname
;
if
(
type
==
ldh_eVolRep_Db
)
{
sprintf
(
vname
,
"$pwrp_db/%s.db"
,
cdh_Low
(
name
));
dcli_translate_filename
(
vname
,
vname
);
vrep_iterator
it
=
m_vrepdb
.
find
(
vid
);
if
(
it
!=
m_vrepdb
.
end
())
{
*
sts
=
LDH__VOLIDALREXI
;
return
0
;
}
sprintf
(
vname
,
"$pwrp_db/%s.db"
,
cdh_Low
(
name
));
dcli_translate_filename
(
vname
,
vname
);
wb_vrepdb
*
vrepdb
=
new
wb_vrepdb
(
this
,
vid
,
cid
,
name
,
vname
);
if
(
add
)
addDb
(
sts
,
vrepdb
);
MsgWindow
::
message
(
'I'
,
"Database created"
,
vname
);
vrep_iterator
it
=
m_vrepdb
.
find
(
vid
);
if
(
it
!=
m_vrepdb
.
end
())
{
*
sts
=
LDH__VOLIDALREXI
;
return
0
;
return
vrepdb
;
}
else
if
(
type
==
ldh_eVolRep_Dbms
)
{
char
host
[
40
]
=
"pwr42"
;
char
user
[
40
]
=
"pwrp"
;
char
password
[
40
]
=
""
;
unsigned
int
port
=
0
;
char
socket
[
80
];
wb_vrepdb
*
vrepdb
=
new
wb_vrepdb
(
this
,
vid
,
cid
,
name
,
vname
);
if
(
add
)
addDb
(
sts
,
vrepdb
);
MsgWindow
::
message
(
'I'
,
"Database created"
,
vname
)
;
cnf_get_value
(
"mysqlSocket"
,
socket
);
*
sts
=
lfu_ParseDbmsServer
(
server
,
user
,
password
,
&
port
,
host
);
if
(
EVEN
(
*
sts
))
return
0
;
return
vrepdb
;
printf
(
"Host:
\"
%s
\"\n
User:
\"
%s
\"\n
Pass:
\"
%s
\"\n
Port: %d
\n
"
,
host
,
user
,
password
,
port
);
sprintf
(
vname
,
"$pwrp_db/%s.dbms"
,
cdh_Low
(
name
));
dcli_translate_filename
(
vname
,
vname
);
vrep_iterator
it
=
m_vrepdb
.
find
(
vid
);
if
(
it
!=
m_vrepdb
.
end
())
{
*
sts
=
LDH__VOLIDALREXI
;
return
0
;
}
wb_dbms_env
*
env
=
new
wb_dbms_env
();
env
->
create
(
vname
,
host
,
user
,
password
,
cdh_Low
(
name
),
port
,
socket
);
// wb_dbms *dbms = new wb_dbms();
// dbms->create( vid, cid, dbname, vname);
wb_vrepdbms
*
vrepdbms
=
new
wb_vrepdbms
(
this
,
vid
,
cid
,
name
,
vname
);
if
(
add
)
addDb
(
sts
,
vrepdbms
);
MsgWindow
::
message
(
'I'
,
"Database created"
,
vname
);
return
vrepdbms
;
}
return
0
;
}
void
wb_erep
::
volumeNameToFilename
(
pwr_tStatus
*
sts
,
char
*
name
,
char
*
filename
)
{
char
found_file
[
200
];
...
...
wb/lib/wb/src/wb_erep.h
View file @
c2716dcd
/*
* Proview $Id: wb_erep.h,v 1.2
4 2007-08-24 13:39:43
claes Exp $
* Proview $Id: wb_erep.h,v 1.2
5 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -68,7 +68,7 @@ public:
wb_vrep
*
volume
(
pwr_tStatus
*
sts
,
pwr_tVid
vid
);
wb_vrep
*
volume
(
pwr_tStatus
*
sts
,
const
char
*
name
);
wb_vrep
*
createVolume
(
pwr_tStatus
*
sts
,
pwr_tVid
vid
,
pwr_tCid
cid
,
const
char
*
name
,
bool
add
=
true
);
ldh_eVolRep
type
,
char
*
server
,
bool
add
=
true
);
wb_vrep
*
nextVolume
(
pwr_tStatus
*
sts
,
pwr_tVid
vid
);
wb_vrep
*
externVolume
(
pwr_tStatus
*
sts
,
pwr_tVid
vid
);
wb_vrep
*
bufferVolume
(
pwr_tStatus
*
sts
);
...
...
wb/lib/wb/src/wb_ldh.cpp
View file @
c2716dcd
/*
* Proview $Id: wb_ldh.cpp,v 1.6
5 2008-01-24 09:47:46
claes Exp $
* Proview $Id: wb_ldh.cpp,v 1.6
6 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -41,6 +41,7 @@
#include "wb_ldh_msg.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_cnf.h"
#include "pwr_vararg.h"
#include "co_ver.h"
#include "rt_gdh.h"
...
...
@@ -58,8 +59,11 @@
#include "wb_vrepdbs.h"
#include "wb_merep.h"
#include "wb_db.h"
#include "wb_dbms.h"
#include "wb_print_wbl.h"
#include "wb_lfu.h"
#include "pwr_baseclasses.h"
#include "rt_load.h"
pwr_dImport
pwr_BindClasses
(
System
);
pwr_dImport
pwr_BindClasses
(
Base
);
...
...
@@ -423,13 +427,13 @@ ldh_CreateObject(ldh_tSession session, pwr_tOid *oid, char *name, pwr_tCid cid,
}
pwr_tStatus
ldh_CreateVolume
(
ldh_tWorkbench
workbench
,
ldh_tSession
*
session
,
pwr_tVid
vid
,
char
*
name
,
pwr_tCid
cid
)
ldh_CreateVolume
(
ldh_tWorkbench
workbench
,
ldh_tSession
*
session
,
pwr_tVid
vid
,
char
*
name
,
pwr_tCid
cid
,
ldh_eVolRep
volrep
,
char
*
server
)
{
wb_env
*
ep
=
(
wb_env
*
)
workbench
;
wb_name
n
(
name
);
wb_volume
v
=
ep
->
createVolume
(
vid
,
cid
,
name
);
wb_volume
v
=
ep
->
createVolume
(
vid
,
cid
,
name
,
volrep
,
server
);
if
(
!
v
)
return
v
.
sts
();
// wb_srep *srep = new wb_srep(v);
...
...
@@ -1959,20 +1963,57 @@ ldh_WbLoad( ldh_tSession session, char *loadfile, int ignore_oix)
vwbl
->
ignoreOix
();
vwbl
->
load
(
fname
);
cdh_ToLower
(
vname
,
vwbl
->
name
());
strcpy
(
db_name
,
"$pwrp_db/"
);
strcat
(
db_name
,
vname
);
strcat
(
db_name
,
".db"
);
dcli_translate_filename
(
db_name
,
db_name
);
// Get database type
pwr_tVid
vid
;
pwr_tCid
cid
;
ldh_eVolRep
volrep
;
char
server
[
80
];
pwr_tStatus
sts
;
sts
=
lfu_GetVolumeCnf
(
(
char
*
)
vwbl
->
name
(),
&
vid
,
&
cid
,
&
volrep
,
server
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
volrep
==
ldh_eVolRep_Db
)
{
cdh_ToLower
(
vname
,
vwbl
->
name
());
strcpy
(
db_name
,
"$pwrp_db/"
);
strcat
(
db_name
,
vname
);
strcat
(
db_name
,
".db"
);
dcli_translate_filename
(
db_name
,
db_name
);
// wb_db db( vwbl->vid());
// db.create( vwbl->vid(), vwbl->cid(), vwbl->name(), db_name);
// db.importVolume( *vwbl);
wb_db
db
(
pwr_cNVid
);
db
.
copy
(
*
vwbl
,
db_name
);
db
.
close
();
erep
->
merep
()
->
copyFiles
(
db_name
);
// wb_db db( vwbl->vid());
// db.create( vwbl->vid(), vwbl->cid(), vwbl->name(), db_name);
// db.importVolume( *vwbl);
wb_db
db
(
pwr_cNVid
);
db
.
copy
(
*
vwbl
,
db_name
);
db
.
close
();
erep
->
merep
()
->
copyFiles
(
db_name
);
}
else
{
char
socket
[
80
];
char
user
[
80
];
char
password
[
80
];
char
host
[
80
];
unsigned
int
port
;
cdh_ToLower
(
vname
,
vwbl
->
name
());
strcpy
(
db_name
,
"$pwrp_db/"
);
strcat
(
db_name
,
vname
);
strcat
(
db_name
,
".dbms"
);
dcli_translate_filename
(
db_name
,
db_name
);
sts
=
lfu_ParseDbmsServer
(
server
,
user
,
password
,
&
port
,
host
);
if
(
EVEN
(
sts
))
return
sts
;
cnf_get_value
(
"mysqlSocket"
,
socket
);
wb_dbms_env
*
env
=
new
wb_dbms_env
();
env
->
create
(
db_name
,
host
,
user
,
password
,
cdh_Low
(
vname
),
port
,
socket
);
wb_dbms
dbms
(
pwr_cNVid
);
dbms
.
copy
(
*
vwbl
,
db_name
);
dbms
.
close
();
erep
->
merep
()
->
copyFiles
(
db_name
);
}
delete
vwbl
;
}
catch
(
wb_error
&
e
)
{
...
...
wb/lib/wb/src/wb_ldh.h
View file @
c2716dcd
/*
* Proview $Id: wb_ldh.h,v 1.4
3 2008-01-24 09:48:28
claes Exp $
* Proview $Id: wb_ldh.h,v 1.4
4 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -548,11 +548,13 @@ pwr_tStatus ldh_CreateObject (
pwr_tStatus
ldh_CreateVolume
(
ldh_tWorkbench
Workbench
,
ldh_tSession
*
Session
,
pwr_tVolumeId
Volume
,
char
*
Name
,
pwr_tClassId
Class
ldh_tWorkbench
workbench
,
ldh_tSession
*
session
,
pwr_tVid
vid
,
char
*
name
,
pwr_tClassId
cid
,
ldh_eVolRep
volrep
,
char
*
server
);
pwr_tStatus
ldh_Cut
(
...
...
wb/lib/wb/src/wb_lfu.cpp
View file @
c2716dcd
This diff is collapsed.
Click to expand it.
wb/lib/wb/src/wb_lfu.h
View file @
c2716dcd
/*
* Proview $Id: wb_lfu.h,v 1.
7 2007-01-04 07:29:03
claes Exp $
* Proview $Id: wb_lfu.h,v 1.
8 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -76,80 +76,63 @@ typedef struct {
char
name
[
80
];
}
lfu_t_volref
;
pwr_tStatus
lfu_volumelist_load
(
char
*
filename
,
lfu_t_volumelist
**
vollist
,
int
*
volcount
);
pwr_tStatus
lfu_create_loadfile
(
ldh_tSesContext
ldhses
);
pwr_tStatus
lfu_create_bootfile
(
char
*
nodeconfigname
,
lfu_t_volumelist
*
volumelist
,
int
volumecount
,
int
debug
);
pwr_tStatus
lfu_GetFileVersion
(
char
*
pattern
,
int
number_of_digits
,
int
*
version
,
pwr_tTime
*
date
);
pwr_tStatus
lfu_GetPlcFileVersion
(
pwr_tVolumeId
volumeid
,
int
*
version
,
pwr_tTime
*
date
);
pwr_tStatus
lfu_IncrementAndGetVersion
(
char
*
filename
,
unsigned
long
*
current_version
);
pwr_tStatus
lfu_SaveDirectoryVolume
(
ldh_tSesContext
ldhses
,
CoWow
*
wow
);
int
lfu_create_bootfiles
(
char
*
nodestr
,
int
debug
,
int
allnodes
);
pwr_tStatus
lfu_ReadBootFile
(
char
*
filename
,
pwr_tTime
*
date
,
char
*
systemname
,
char
*
systemgroup
,
pwr_tVolumeId
**
vollist
,
pwr_tString40
**
volnamelist
,
int
*
volcount
,
char
*
plc_name
);
pwr_tStatus
lfu_ReadSysObjectFile
(
char
*
SystemName
,
char
*
SystemGroup
);
pwr_tStatus
lfu_WriteSysObjectFile
(
ldh_tSesContext
ldhses
);
pwr_tStatus
lfu_GetVolRef
(
char
*
filename
,
lfu_t_volref
**
volref
,
int
*
volref_count
);
pwr_tStatus
lfu_GetVolume
(
char
*
filename
,
char
*
name
,
pwr_tVid
*
vid
,
pwr_tCid
*
cid
,
pwr_tTime
*
time
);
pwr_tStatus
lfu_volumelist_load
(
char
*
filename
,
lfu_t_volumelist
**
vollist
,
int
*
volcount
);
pwr_tStatus
lfu_create_loadfile
(
ldh_tSesContext
ldhses
);
pwr_tStatus
lfu_create_bootfile
(
char
*
nodeconfigname
,
lfu_t_volumelist
*
volumelist
,
int
volumecount
,
int
debug
);
pwr_tStatus
lfu_GetFileVersion
(
char
*
pattern
,
int
number_of_digits
,
int
*
version
,
pwr_tTime
*
date
);
pwr_tStatus
lfu_GetPlcFileVersion
(
pwr_tVolumeId
volumeid
,
int
*
version
,
pwr_tTime
*
date
);
pwr_tStatus
lfu_IncrementAndGetVersion
(
char
*
filename
,
unsigned
long
*
current_version
);
pwr_tStatus
lfu_SaveDirectoryVolume
(
ldh_tSesContext
ldhses
,
CoWow
*
wow
);
int
lfu_create_bootfiles
(
char
*
nodestr
,
int
debug
,
int
allnodes
);
pwr_tStatus
lfu_ReadBootFile
(
char
*
filename
,
pwr_tTime
*
date
,
char
*
systemname
,
char
*
systemgroup
,
pwr_tVolumeId
**
vollist
,
pwr_tString40
**
volnamelist
,
int
*
volcount
,
char
*
plc_name
);
pwr_tStatus
lfu_ReadSysObjectFile
(
char
*
SystemName
,
char
*
SystemGroup
);
pwr_tStatus
lfu_WriteSysObjectFile
(
ldh_tSesContext
ldhses
);
pwr_tStatus
lfu_GetVolRef
(
char
*
filename
,
lfu_t_volref
**
volref
,
int
*
volref_count
);
pwr_tStatus
lfu_GetVolume
(
char
*
filename
,
char
*
name
,
pwr_tVid
*
vid
,
pwr_tCid
*
cid
,
pwr_tTime
*
time
);
pwr_tStatus
lfu_GetVolumeCnf
(
char
*
name
,
pwr_tVid
*
vid
,
pwr_tCid
*
cid
,
ldh_eVolRep
*
volrep
,
char
*
server
);
pwr_tStatus
lfu_ParseDbmsServer
(
char
*
server
,
char
*
user
,
char
*
passw
,
unsigned
int
*
port
,
char
*
host
);
#ifdef __cplusplus
}
...
...
wb/lib/wb/src/wb_utl.cpp
View file @
c2716dcd
/*
* Proview $Id: wb_utl.cpp,v 1.
7 2007-12-06 10:51:57
claes Exp $
* Proview $Id: wb_utl.cpp,v 1.
8 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -3656,6 +3656,7 @@ int utl_show_obj_hier_class_name (
return
FOE__SUCCESS
;
}
#if 0
/*************************************************************************
*
...
...
@@ -3725,6 +3726,7 @@ pwr_tStatus utl_create_volume(
return FOE__SUCCESS;
}
#endif
/*************************************************************************
*
...
...
wb/lib/wb/src/wb_vrepdbms.cpp
View file @
c2716dcd
This diff is collapsed.
Click to expand it.
wb/lib/wb/src/wb_vrepdbms.h
View file @
c2716dcd
/*
* Proview $Id: wb_vrepdbms.h,v 1.
5 2007-12-21 13:18:01
claes Exp $
* Proview $Id: wb_vrepdbms.h,v 1.
6 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2007 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -198,7 +198,8 @@ public:
int
updateArefs
(
pwr_tOid
oid
,
pwr_tCid
cid
);
int
checkClass
(
pwr_tCid
cid
);
void
checkAttributes
(
pwr_tCid
cid
);
void
checkSubClass
(
pwr_tCid
cid
,
unsigned
int
o_offset
,
unsigned
int
n_offset
);
void
checkSubClass
(
pwr_tCid
cid
,
pwr_tCid
subcid
,
unsigned
int
o_offset
,
unsigned
int
n_offset
,
pwr_tCid
body
);
//bool classIsChanged(pwr_tCid cid);
...
...
wb/lib/wb/src/wb_wnav_command.cpp
View file @
c2716dcd
/*
* Proview $Id: wb_wnav_command.cpp,v 1.4
8 2007-12-21 13:18:01
claes Exp $
* Proview $Id: wb_wnav_command.cpp,v 1.4
9 2008-02-04 13:34:49
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -268,7 +268,7 @@ dcli_tCmdTable wnav_command_table[] = {
"/LASTCHILD"
,
"/VOLUME"
,
"/ALL"
,
"/CLASS"
,
"/DEBUG"
,
"/NODECONFIG"
,
"/NAME"
,
"/IDENTITY"
,
"/FILES"
,
"/OUT"
,
"/IGNORE"
,
"/DIRECTORY"
,
"/BUILDVERSION"
,
""
}
"/DIRECTORY"
,
"/BUILDVERSION"
,
"
/DATABASE"
,
"/SERVER"
,
"
"
}
},
{
"NEW"
,
...
...
@@ -3752,13 +3752,37 @@ static int wnav_create_func( void *client_data,
{
pwr_tObjName
namestr
;
pwr_tObjName
classtr
;
pwr_tString40
serverstr
;
char
databasestr
[
80
];
char
identitystr
[
80
];
pwr_tStatus
sts
;
pwr_tCid
cid
;
pwr_tVid
vid
;
ldh_eVolRep
volrep
;
// Command is "CREATE VOLUME"
if
(
ODD
(
dcli_get_qualifier
(
"/DATABASE"
,
databasestr
,
sizeof
(
databasestr
))))
{
if
(
strcmp
(
databasestr
,
"BERKELEYDB"
)
==
0
)
volrep
=
ldh_eVolRep_Db
;
else
if
(
strcmp
(
databasestr
,
"MYSQL"
)
==
0
)
volrep
=
ldh_eVolRep_Dbms
;
else
{
wnav
->
message
(
'E'
,
"Syntax error in database"
);
return
WNAV__QUAL
;
}
}
else
sts
=
0
;
if
(
volrep
==
ldh_eVolRep_Dbms
)
{
if
(
EVEN
(
dcli_get_qualifier
(
"/SERVER"
,
serverstr
,
sizeof
(
serverstr
))))
strcpy
(
serverstr
,
""
);
}
else
strcpy
(
serverstr
,
""
);
if
(
ODD
(
dcli_get_qualifier
(
"/DIRECTORY"
,
0
,
0
)))
{
strcpy
(
namestr
,
"directory"
);
vid
=
ldh_cDirectoryVolume
;
...
...
@@ -3802,7 +3826,7 @@ static int wnav_create_func( void *client_data,
try
{
wb_erep
*
erep
=
*
(
wb_env
*
)
wnav
->
wbctx
;
erep
->
createVolume
(
&
sts
,
vid
,
cid
,
namestr
);
erep
->
createVolume
(
&
sts
,
vid
,
cid
,
namestr
,
volrep
,
serverstr
);
}
catch
(
wb_error
&
e
)
{
sts
=
e
.
sts
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment