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
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
/*
* Proview $Id: wb_lfu.cpp,v 1.
9 2007-12-21 13:18:01
claes Exp $
* Proview $Id: wb_lfu.cpp,v 1.
10 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
...
...
@@ -52,9 +52,10 @@
#include "wb.h"
#include "wb_gcg.h"
#include "wb_trv.h"
#include "wb_lfu.h"
#include "co_dbs.h"
#include "co_msgwindow.h"
#include "
wb_lfu
.h"
#include "
co_cnf
.h"
#include "wb_env.h"
#include "wb_erep.h"
...
...
@@ -85,6 +86,8 @@ typedef struct {
char
name
[
32
];
pwr_tVid
vid
;
pwr_tCid
cid
;
ldh_eVolRep
volrep
;
char
server
[
80
];
ldh_tSesContext
ldhses
;
}
lfu_sCreaDb
;
...
...
@@ -897,55 +900,136 @@ pwr_tStatus lfu_SaveDirectoryVolume(
case
pwr_cClass_SubVolumeConfig
:
case
pwr_cClass_SharedVolumeConfig
:
{
/* Check if the databas is created */
sprintf
(
filename
,
"$pwrp_db/%s.db/info"
,
volume_name
);
cdh_ToLower
(
filename
,
filename
);
dcli_translate_filename
(
filename
,
filename
);
sts
=
dcli_search_file
(
filename
,
found_file
,
DCLI_DIR_SEARCH_INIT
);
dcli_search_file
(
filename
,
found_file
,
DCLI_DIR_SEARCH_END
);
if
(
EVEN
(
sts
))
{
if
(
wow
)
{
lfu_sCreaDb
*
data
;
data
=
(
lfu_sCreaDb
*
)
calloc
(
1
,
sizeof
(
*
data
));
strcpy
(
data
->
name
,
volumelist_ptr
->
volume_name
);
data
->
vid
=
volumelist_ptr
->
volume_id
;
switch
(
cid
)
{
case
pwr_cClass_RootVolumeConfig
:
data
->
cid
=
pwr_eClass_RootVolume
;
break
;
case
pwr_cClass_SubVolumeConfig
:
data
->
cid
=
pwr_eClass_SubVolume
;
break
;
case
pwr_cClass_SharedVolumeConfig
:
data
->
cid
=
pwr_eClass_SharedVolume
;
break
;
default:
;
}
data
->
ldhses
=
ldhses
;
sprintf
(
text
,
" Volume '%s' is not yet created.
\n
\n
\
int
*
dbenum_p
=
0
;
char
*
server_p
=
0
;
ldh_eVolRep
volrep
;
pwr_tCid
vcid
;
pwr_tString40
server
=
""
;
switch
(
cid
)
{
case
pwr_cClass_RootVolumeConfig
:
vcid
=
pwr_eClass_RootVolume
;
break
;
case
pwr_cClass_SubVolumeConfig
:
vcid
=
pwr_eClass_SubVolume
;
break
;
case
pwr_cClass_SharedVolumeConfig
:
vcid
=
pwr_eClass_SharedVolume
;
break
;
default:
;
}
sts
=
ldh_GetObjectPar
(
ldhses
,
envobjid
,
"RtBody"
,
"Database"
,
(
char
**
)
&
dbenum_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
*
dbenum_p
==
pwr_eVolumeDatabaseEnum_BerkeleyDb
)
volrep
=
ldh_eVolRep_Db
;
else
if
(
*
dbenum_p
==
pwr_eVolumeDatabaseEnum_MySql
)
volrep
=
ldh_eVolRep_Dbms
;
else
{
free
(
dbenum_p
);
break
;
}
free
(
dbenum_p
);
if
(
volrep
==
ldh_eVolRep_Db
)
{
sprintf
(
filename
,
"$pwrp_db/%s.db/info"
,
volume_name
);
cdh_ToLower
(
filename
,
filename
);
dcli_translate_filename
(
filename
,
filename
);
sts
=
dcli_search_file
(
filename
,
found_file
,
DCLI_DIR_SEARCH_INIT
);
dcli_search_file
(
filename
,
found_file
,
DCLI_DIR_SEARCH_END
);
if
(
EVEN
(
sts
))
{
if
(
wow
)
{
lfu_sCreaDb
*
data
;
data
=
(
lfu_sCreaDb
*
)
calloc
(
1
,
sizeof
(
*
data
));
strcpy
(
data
->
name
,
volumelist_ptr
->
volume_name
);
data
->
vid
=
volumelist_ptr
->
volume_id
;
data
->
cid
=
vcid
;
data
->
ldhses
=
ldhses
;
data
->
volrep
=
volrep
;
strcpy
(
data
->
server
,
""
);
sprintf
(
text
,
" Volume '%s' is not yet created.
\n
\n
\
Do you want to create this volume.
\n
"
,
volume_name
);
wow
->
DisplayQuestion
(
NULL
,
"Create volume"
,
text
,
lfu_creadb_qb_yes
,
NULL
,
(
void
*
)
data
);
volume_name
);
wow
->
DisplayQuestion
(
NULL
,
"Create volume"
,
text
,
lfu_creadb_qb_yes
,
NULL
,
(
void
*
)
data
);
}
else
{
char
msg
[
200
];
sprintf
(
msg
,
"Error, Volume '%s' is not yet created."
,
volume_name
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_Default
);
}
}
else
{
char
msg
[
200
];
sprintf
(
msg
,
"Error, Volume '%s' is not yet created."
,
volume_name
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_Default
);
}
if
(
volrep
==
ldh_eVolRep_Dbms
)
{
sts
=
ldh_GetObjectPar
(
ldhses
,
envobjid
,
"RtBody"
,
"Server"
,
(
char
**
)
&
server_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
strcpy
(
server
,
server_p
);
free
(
server_p
);
sprintf
(
filename
,
"$pwrp_db/%s.dbms/connection.dmsql"
,
volume_name
);
cdh_ToLower
(
filename
,
filename
);
dcli_translate_filename
(
filename
,
filename
);
sts
=
dcli_search_file
(
filename
,
found_file
,
DCLI_DIR_SEARCH_INIT
);
dcli_search_file
(
filename
,
found_file
,
DCLI_DIR_SEARCH_END
);
if
(
EVEN
(
sts
))
{
if
(
wow
)
{
lfu_sCreaDb
*
data
;
data
=
(
lfu_sCreaDb
*
)
calloc
(
1
,
sizeof
(
*
data
));
strcpy
(
data
->
name
,
volumelist_ptr
->
volume_name
);
data
->
vid
=
volumelist_ptr
->
volume_id
;
data
->
cid
=
vcid
;
data
->
ldhses
=
ldhses
;
data
->
volrep
=
volrep
;
strcpy
(
data
->
server
,
server
);
sprintf
(
text
,
" Volume '%s' is not yet created.
\n
\n
\
Do you want to create this volume.
\n
"
,
volume_name
);
wow
->
DisplayQuestion
(
NULL
,
"Create volume"
,
text
,
lfu_creadb_qb_yes
,
NULL
,
(
void
*
)
data
);
}
else
{
char
msg
[
200
];
sprintf
(
msg
,
"Error, Volume '%s' is not yet created."
,
volume_name
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_Default
);
}
}
}
break
;
}
case
pwr_cClass_ClassVolumeConfig
:
{
int
*
dbenum
=
0
;
int
*
dbenum_p
=
0
;
char
*
server_p
=
0
;
ldh_eVolRep
volrep
;
pwr_tString40
server
=
""
;
sts
=
ldh_GetObjectPar
(
ldhses
,
envobjid
,
"RtBody"
,
"Database"
,
(
char
**
)
&
dbenum
,
&
size
);
"Database"
,
(
char
**
)
&
dbenum
_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
*
dbenum
==
1
)
{
if
(
*
dbenum_p
==
pwr_eClassVolumeDatabaseEnum_WbLoad
)
volrep
=
ldh_eVolRep_Wbl
;
if
(
*
dbenum_p
==
pwr_eClassVolumeDatabaseEnum_BerkeleyDb
)
volrep
=
ldh_eVolRep_Db
;
else
if
(
*
dbenum_p
==
pwr_eClassVolumeDatabaseEnum_MySql
)
volrep
=
ldh_eVolRep_Dbms
;
else
{
free
(
dbenum_p
);
break
;
}
free
(
dbenum_p
);
if
(
volrep
==
ldh_eVolRep_Db
)
{
/* Check if the databas is created */
sprintf
(
filename
,
"$pwrp_db/%s.db/info"
,
volume_name
);
cdh_ToLower
(
filename
,
filename
);
...
...
@@ -960,6 +1044,8 @@ pwr_tStatus lfu_SaveDirectoryVolume(
data
->
vid
=
volumelist_ptr
->
volume_id
;
data
->
cid
=
pwr_eClass_ClassVolume
;
data
->
ldhses
=
ldhses
;
data
->
volrep
=
volrep
;
strcpy
(
data
->
server
,
""
);
sprintf
(
text
,
" ClassVolume '%s' is not yet created.
\n
\n
\
Do you want to create this volume.
\n
"
,
...
...
@@ -970,10 +1056,41 @@ pwr_tStatus lfu_SaveDirectoryVolume(
}
}
}
else
if
(
*
dbenum
==
2
)
{
else
if
(
volrep
==
ldh_eVolRep_Dbms
)
{
// MySql...
sts
=
ldh_GetObjectPar
(
ldhses
,
envobjid
,
"RtBody"
,
"Server"
,
(
char
**
)
&
server_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
strcpy
(
server
,
server_p
);
free
(
server_p
);
sprintf
(
filename
,
"$pwrp_db/%s.dbms/connection.dmsql"
,
volume_name
);
cdh_ToLower
(
filename
,
filename
);
dcli_translate_filename
(
filename
,
filename
);
sts
=
dcli_search_file
(
filename
,
found_file
,
DCLI_DIR_SEARCH_INIT
);
dcli_search_file
(
filename
,
found_file
,
DCLI_DIR_SEARCH_END
);
if
(
EVEN
(
sts
))
{
if
(
wow
)
{
lfu_sCreaDb
*
data
;
data
=
(
lfu_sCreaDb
*
)
calloc
(
1
,
sizeof
(
*
data
));
strcpy
(
data
->
name
,
volumelist_ptr
->
volume_name
);
data
->
vid
=
volumelist_ptr
->
volume_id
;
data
->
cid
=
pwr_eClass_ClassVolume
;
data
->
ldhses
=
ldhses
;
data
->
volrep
=
volrep
;
strcpy
(
data
->
server
,
server
);
sprintf
(
text
,
" ClassVolume '%s' is not yet created.
\n
\n
\
Do you want to create this volume.
\n
"
,
volume_name
);
wow
->
DisplayQuestion
(
NULL
,
"Create Classvolume"
,
text
,
lfu_creadb_qb_yes
,
NULL
,
(
void
*
)
data
);
}
}
}
else
{
else
if
(
volrep
==
ldh_eVolRep_Wbl
)
{
// Check wbload-file...
FILE
*
wblfile
;
...
...
@@ -995,7 +1112,6 @@ pwr_tStatus lfu_SaveDirectoryVolume(
fclose
(
wblfile
);
}
}
free
(
dbenum
);
break
;
}
}
...
...
@@ -2054,7 +2170,8 @@ static void lfu_creadb_qb_yes( void *ctx, void *d)
try
{
wb_env
env
=
sp
->
env
();
wb_volume
vdb
=
env
.
createVolume
(
data
->
vid
,
data
->
cid
,
data
->
name
,
false
);
wb_volume
vdb
=
env
.
createVolume
(
data
->
vid
,
data
->
cid
,
data
->
name
,
data
->
volrep
,
data
->
server
,
false
);
}
catch
(
wb_error
&
e
)
{
MsgWindow
::
message
(
'E'
,
"Unable to create volume"
,
msgw_ePop_Default
);
...
...
@@ -2323,9 +2440,132 @@ pwr_tStatus lfu_GetVolume( char *filename,
return
LFU__SUCCESS
;
}
pwr_tStatus
lfu_GetVolumeCnf
(
char
*
name
,
pwr_tVid
*
vid
,
pwr_tCid
*
cid
,
ldh_eVolRep
*
volrep
,
char
*
server
)
{
pwr_tStatus
sts
;
pwr_tFileName
fname
;
char
line
[
200
];
char
vol_array
[
7
][
80
];
strcpy
(
fname
,
load_cNameVolumeList
);
dcli_translate_filename
(
fname
,
fname
);
*
volrep
=
ldh_eVolRep_Db
;
ifstream
fpm
(
fname
,
ios
::
in
);
if
(
fpm
)
{
while
(
fpm
.
getline
(
line
,
sizeof
(
line
)))
{
int
nr
;
if
(
line
[
0
]
==
'#'
)
continue
;
nr
=
dcli_parse
(
line
,
" "
,
""
,
(
char
*
)
vol_array
,
sizeof
(
vol_array
)
/
sizeof
(
vol_array
[
0
]),
sizeof
(
vol_array
[
0
]),
0
);
sts
=
cdh_StringToVolumeId
(
vol_array
[
1
],
vid
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
cdh_NoCaseStrcmp
(
vol_array
[
2
],
"RootVolume"
)
==
0
)
*
cid
=
pwr_eClass_RootVolume
;
else
if
(
cdh_NoCaseStrcmp
(
vol_array
[
2
],
"SubVolume"
)
==
0
)
*
cid
=
pwr_eClass_SubVolume
;
else
if
(
cdh_NoCaseStrcmp
(
vol_array
[
2
],
"SharedVolume"
)
==
0
)
*
cid
=
pwr_eClass_SharedVolume
;
else
if
(
cdh_NoCaseStrcmp
(
vol_array
[
2
],
"ClassVolume"
)
==
0
)
*
cid
=
pwr_eClass_ClassVolume
;
switch
(
*
cid
)
{
case
pwr_eClass_RootVolume
:
case
pwr_eClass_SubVolume
:
case
pwr_eClass_SharedVolume
:
*
volrep
=
ldh_eVolRep_Db
;
if
(
cdh_NoCaseStrcmp
(
vol_array
[
0
],
name
)
==
0
)
{
if
(
nr
>
4
&&
strcmp
(
vol_array
[
4
],
"1"
)
==
0
)
{
*
volrep
=
ldh_eVolRep_Dbms
;
if
(
nr
>
5
)
strcpy
(
server
,
vol_array
[
5
]);
}
break
;
}
case
pwr_eClass_ClassVolume
:
*
volrep
=
ldh_eVolRep_Wbl
;
if
(
cdh_NoCaseStrcmp
(
vol_array
[
0
],
name
)
==
0
)
{
if
(
nr
>
4
&&
strcmp
(
vol_array
[
4
],
"1"
)
==
0
)
*
volrep
=
ldh_eVolRep_Db
;
else
if
(
nr
>
4
&&
strcmp
(
vol_array
[
4
],
"2"
)
==
0
)
{
*
volrep
=
ldh_eVolRep_Dbms
;
if
(
nr
>
5
)
strcpy
(
server
,
vol_array
[
5
]);
}
break
;
}
default:
;
}
}
fpm
.
close
();
}
return
LFU__SUCCESS
;
}
pwr_tStatus
lfu_ParseDbmsServer
(
char
*
server
,
char
*
user
,
char
*
password
,
unsigned
int
*
port
,
char
*
host
)
{
if
(
strcmp
(
server
,
""
)
==
0
)
{
if
(
!
cnf_get_value
(
"mysqlServer"
,
host
))
{
printf
(
"** mysql Server not defined
\n
"
);
return
LDH__NOSERVER
;
}
}
// Parse server string: username:password@port:host
char
lhost
[
80
];
char
luser
[
80
]
=
"pwrp"
;
char
lpassword
[
80
]
=
""
;
char
str1
[
2
][
80
];
char
str2
[
2
][
80
];
int
nr
;
nr
=
dcli_parse
(
server
,
"@"
,
""
,
(
char
*
)
str1
,
sizeof
(
str1
)
/
sizeof
(
str1
[
0
]),
sizeof
(
str1
[
0
]),
0
);
if
(
nr
==
1
)
strncpy
(
lhost
,
server
,
sizeof
(
lhost
));
else
if
(
nr
>=
2
)
{
strncpy
(
lhost
,
str1
[
1
],
sizeof
(
lhost
));
nr
=
dcli_parse
(
str1
[
0
],
":"
,
""
,
(
char
*
)
str2
,
sizeof
(
str2
)
/
sizeof
(
str2
[
0
]),
sizeof
(
str2
[
0
]),
0
);
if
(
nr
==
1
)
strncpy
(
luser
,
str1
[
0
],
sizeof
(
luser
));
else
if
(
nr
>=
2
)
{
strncpy
(
luser
,
str2
[
0
],
sizeof
(
luser
));
strncpy
(
lpassword
,
str2
[
1
],
sizeof
(
lpassword
));
}
}
nr
=
dcli_parse
(
host
,
":"
,
""
,
(
char
*
)
str1
,
sizeof
(
str1
)
/
sizeof
(
str1
[
0
]),
sizeof
(
str1
[
0
]),
0
);
if
(
nr
>=
2
)
{
nr
=
sscanf
(
str1
[
0
],
"%u"
,
port
);
if
(
nr
!=
1
)
{
printf
(
"** Syntax error in mysql Server port
\n
"
);
return
LDH__NOSERVER
;
}
strncpy
(
lhost
,
str1
[
1
],
sizeof
(
lhost
));
}
if
(
strcmp
(
host
,
"localhost"
)
==
0
)
strcpy
(
lhost
,
""
);
strcpy
(
host
,
lhost
);
strcpy
(
user
,
luser
);
strcpy
(
password
,
lpassword
);
return
LFU__SUCCESS
;
}
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
/*
* Proview $Id: wb_vrepdbms.cpp,v 1.
5 2007-12-21 13:18:01
claes Exp $
* Proview $Id: wb_vrepdbms.cpp,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
...
...
@@ -38,6 +38,7 @@
#include "wb_dblock.h"
#include "co_msgwindow.h"
#include "wb_vrepwbl.h"
#include "wb_volume.h"
typedef
struct
sArefKey
{
...
...
@@ -79,6 +80,8 @@ typedef struct sClass
pwr_tObjName
name
;
pwr_tTime
o_time
;
pwr_tTime
n_time
;
size_t
o_rbsize
;
size_t
n_rbsize
;
pwr_tUInt32
count
;
}
sClass
;
...
...
@@ -341,7 +344,7 @@ wb_orep* wb_vrepdbms::object(pwr_tStatus *sts, const wb_orep *parent, wb_name &n
}
}
wb_orep
*
wb_vrepdbms
::
copyObject
(
pwr_tStatus
*
sts
,
const
wb_orep
*
orep
,
wb_destination
&
d
,
wb_name
&
name
)
wb_orep
*
wb_vrepdbms
::
copyObject
(
pwr_tStatus
*
sts
,
const
wb_orep
*
orep
,
wb_destination
&
d
,
wb_name
&
name
,
pwr_tOix
oix
)
{
*
sts
=
LDH__SUCCESS
;
wb_dbms_txn
*
txn
=
m_db
->
subBegin
(
m_db
->
m_txn
);
...
...
@@ -1837,6 +1840,7 @@ int wb_vrepdbms::updateArefs(pwr_tOid oid, pwr_tCid cid)
{
pwr_tStatus
sts
;
sArefKey
ak
;
int
nAref
[
2
]
=
{
0
,
0
};
int
rbSize
=
0
;
int
dbSize
=
0
;
...
...
@@ -1891,56 +1895,64 @@ int wb_vrepdbms::updateArefs(pwr_tOid oid, pwr_tCid cid)
try
{
pwr_sAttrRef
*
arp
=
(
pwr_sAttrRef
*
)(
p
+
ap
->
key
.
offset
);
wb_db_ohead
aohead
(
m_db
,
m_db
->
m_txn
,
arp
->
Objid
);
wb_cdrep
*
n_cdrep
=
m_erep
->
merep
()
->
cdrep
(
&
sts
,
aohead
.
cid
());
wb_bdrep
*
n_bdrep
;
if
(
EVEN
(
sts
))
printf
(
"cdrep sts %d"
,
sts
);
pwr_tCid
arp_cid
;
if
(
cdh_ObjidIsEqual
(
arp
->
Objid
,
pwr_cNObjid
))
{
ap
=
(
sAref
*
)
tree_FindSuccessor
(
&
sts
,
m_aref_th
,
&
ap
->
key
);
continue
;
}
if
(
arp
->
Objid
.
vid
==
m_vid
)
{
wb_dbms_ohead
aohead
(
m_db
,
m_db
->
m_txn
,
arp
->
Objid
);
arp_cid
=
aohead
.
cid
();
}
else
if
(
ldh_isSymbolicVid
(
arp
->
Objid
.
vid
))
arp_cid
=
arp
->
Objid
.
oix
;
else
n_bdrep
=
n_cdrep
->
bdrep
(
&
sts
,
ap
->
key
.
bix
);
arp_cid
=
arp
->
Body
&
~
7
;
wb_cdrep
*
n_cdrep
=
m_erep
->
merep
()
->
cdrep
(
&
sts
,
arp_cid
);
wb_bdrep
*
n_bdrep
;
pwr_eBix
bix
=
pwr_eBix_rt
;
if
(
EVEN
(
sts
))
{
pwr_tAttrRef
a
;
a
.
Objid
=
oid
;
a
.
Offset
=
ap
->
key
.
offset
;
a
.
Size
=
sizeof
(
pwr_tAttrRef
);
a
.
Body
=
cid
|
bix
;
wb_volume
v
(
this
);
wb_attribute
attr
=
v
.
attribute
(
&
a
);
if
(
attr
)
printf
(
"** Corrupt reference in %s
\n
"
,
attr
.
longName
().
c_str
());
}
else
{
bix
=
(
pwr_eBix
)(
arp
->
Body
&
7
);
if
(
bix
!=
pwr_eBix_dev
)
bix
=
pwr_eBix_rt
;
n_bdrep
=
n_cdrep
->
bdrep
(
&
sts
,
bix
);
}
if
(
EVEN
(
sts
))
{
ap
=
(
sAref
*
)
tree_FindSuccessor
(
&
sts
,
m_aref_th
,
&
ap
->
key
);
continue
;
}
if
(
arp
->
Flags
.
b
.
Object
)
{
// Check if rbody size of changed
pwr_tCid
cid
=
aohead
.
cid
();
sClass
*
cp
=
(
sClass
*
)
tree_Find
(
&
sts
,
m_class_th
,
&
cid
);
sAttributeKey
k
;
k
.
cid
=
arp_cid
;
k
.
bix
=
bix
;
k
.
oStart
=
arp
->
Offset
;
k
.
oEnd
=
arp
->
Offset
+
arp
->
Size
-
1
;
sAttribute
*
cap
=
(
sAttribute
*
)
tree_Find
(
&
sts
,
m_attribute_th
,
&
k
);
if
(
cp
&&
cp
->
n_rbsize
!=
cp
->
o_rbsize
)
{
arp
->
Size
=
cp
->
n_rbsize
;
nAref
[
ap
->
key
.
bix
-
1
]
++
;
if
(
cap
!=
0
)
{
nAref
[
ap
->
key
.
bix
-
1
]
++
;
if
(
arp
->
Size
>
cap
->
o
.
aref
.
Size
)
{
arp
->
Offset
=
0
;
arp
->
Size
=
n_bdrep
->
size
();
}
}
else
{
sAttributeKey
k
;
k
.
cid
=
aohead
.
cid
();
k
.
bix
=
ap
->
key
.
bix
;
k
.
oStart
=
arp
->
Offset
;
k
.
oEnd
=
arp
->
Offset
+
arp
->
Size
-
1
;
sAttribute
*
cap
=
(
sAttribute
*
)
tree_Find
(
&
sts
,
m_attribute_th
,
&
k
);
if
(
cap
!=
0
)
{
nAref
[
ap
->
key
.
bix
-
1
]
++
;
if
(
arp
->
Size
>
cap
->
o
.
aref
.
Size
)
{
arp
->
Offset
=
0
;
arp
->
Size
=
n_bdrep
->
size
();
}
else
if
(
arp
->
Offset
==
cap
->
o
.
aref
.
Offset
&&
arp
->
Size
==
cap
->
o
.
aref
.
Size
)
{
arp
->
Offset
=
cap
->
n
.
aref
.
Offset
;
arp
->
Size
=
cap
->
n
.
aref
.
Size
;
}
else
if
(
cap
->
o
.
aref
.
Flags
.
b
.
Array
)
{
pwr_tUInt32
oElementSize
=
cap
->
o
.
aref
.
Size
/
cap
->
o
.
nElement
;
pwr_tUInt32
oOffset
=
arp
->
Offset
-
cap
->
o
.
aref
.
Offset
;
pwr_tUInt32
index
=
oOffset
/
oElementSize
;
pwr_tUInt32
nElementSize
=
cap
->
n
.
aref
.
Size
/
cap
->
n
.
nElement
;
if
(
index
>=
cap
->
n
.
nElement
)
{
index
=
cap
->
n
.
nElement
-
1
;
}
arp
->
Offset
=
cap
->
n
.
aref
.
Offset
+
(
index
*
nElementSize
);
arp
->
Size
=
nElementSize
;
}
else
if
(
arp
->
Offset
==
cap
->
o
.
aref
.
Offset
&&
arp
->
Size
==
cap
->
o
.
aref
.
Size
)
{
arp
->
Offset
=
cap
->
n
.
aref
.
Offset
;
arp
->
Size
=
cap
->
n
.
aref
.
Size
;
}
}
}
catch
(
wb_dbms_error
&
e
)
{
...
...
@@ -2260,17 +2272,47 @@ void wb_vrepdbms::checkAttributes(pwr_tCid cid)
if
(
ODD
(
sts
))
{
wb_bdrep
*
o_bdrep
=
o_cdrep
->
bdrep
(
&
sts
,
bix
);
if
(
ODD
(
sts
))
{
pwr_tCid
body
=
o_cdrep
->
cid
()
|
o_bdrep
->
bix
();
if
(
o_bdrep
->
size
()
!=
n_bdrep
->
size
())
{
sAttributeKey
ak
;
sAttribute
*
ap
;
ak
.
cid
=
cid
;
ak
.
bix
=
bix
;
ak
.
oStart
=
0
;
ak
.
oEnd
=
o_bdrep
->
size
()
-
1
;
ap
=
(
sAttribute
*
)
tree_Insert
(
&
sts
,
m_attribute_th
,
&
ak
);
ap
->
o
.
aref
.
Size
=
o_bdrep
->
size
();
ap
->
o
.
aref
.
Offset
=
0
;
ap
->
o
.
aref
.
Body
=
bix
;
ap
->
o
.
aref
.
Flags
.
b
.
Object
=
1
;
ap
->
n
.
aref
.
Size
=
n_bdrep
->
size
();
ap
->
n
.
aref
.
Offset
=
0
;
ap
->
n
.
aref
.
Body
=
bix
;
ap
->
n
.
aref
.
Flags
.
b
.
Object
=
1
;
}
wb_adrep
*
o_adrep
=
o_bdrep
->
adrep
(
&
sts
);
while
(
ODD
(
sts
))
{
if
(
o_adrep
->
type
()
==
pwr_eType_AttrRef
)
{
sArefKey
a
;
a
.
cid
=
cid
;
a
.
bix
=
bix
;
a
.
offset
=
o_adrep
->
offset
();
tree_Insert
(
&
sts
,
m_aref_th
,
&
a
);
sArefKey
a
;
if
(
o_adrep
->
isArray
())
{
for
(
int
j
=
0
;
j
<
o_adrep
->
nElement
();
j
++
)
{
a
.
cid
=
cid
;
a
.
bix
=
bix
;
a
.
offset
=
o_adrep
->
offset
()
+
j
*
o_adrep
->
size
()
/
o_adrep
->
nElement
();
tree_Insert
(
&
sts
,
m_aref_th
,
&
a
);
}
}
else
{
a
.
cid
=
cid
;
a
.
bix
=
bix
;
a
.
offset
=
o_adrep
->
offset
();
tree_Insert
(
&
sts
,
m_aref_th
,
&
a
);
}
}
// Indentify attribute with the same aix
...
...
@@ -2286,32 +2328,67 @@ void wb_vrepdbms::checkAttributes(pwr_tCid cid)
delete
prev
;
}
if
(
found
)
{
if
(
(
o_adrep
->
offset
()
!=
n_adrep
->
offset
())
||
(
o_adrep
->
size
()
!=
n_adrep
->
size
())
||
(
o_adrep
->
type
()
!=
n_adrep
->
type
())
||
//(o_adrep->tid() != n_adrep->tid()) ||
(
o_adrep
->
nElement
()
!=
n_adrep
->
nElement
())
||
(
o_adrep
->
index
()
!=
n_adrep
->
index
())
)
{
sAttributeKey
ak
;
sAttribute
*
ap
;
if
(
(
o_adrep
->
offset
()
!=
n_adrep
->
offset
())
||
(
o_adrep
->
size
()
!=
n_adrep
->
size
())
||
(
o_adrep
->
type
()
!=
n_adrep
->
type
())
||
//(o_adrep->tid() != n_adrep->tid()) ||
(
o_adrep
->
nElement
()
!=
n_adrep
->
nElement
())
||
(
o_adrep
->
index
()
!=
n_adrep
->
index
()))
{
sAttributeKey
ak
;
sAttribute
*
ap
;
ak
.
cid
=
cid
;
ak
.
bix
=
bix
;
ak
.
oStart
=
o_adrep
->
offset
();
ak
.
oEnd
=
o_adrep
->
offset
()
+
o_adrep
->
size
()
-
1
;
ap
=
(
sAttribute
*
)
tree_Insert
(
&
sts
,
m_attribute_th
,
&
ak
);
ap
->
o
.
aref
=
o_adrep
->
aref
();
ap
->
n
.
aref
=
n_adrep
->
aref
();
ap
->
o
.
aix
=
o_adrep
->
aix
();
ap
->
n
.
aix
=
n_adrep
->
aix
();
ap
->
o
.
nElement
=
o_adrep
->
nElement
();
ap
->
n
.
nElement
=
n_adrep
->
nElement
();
}
ak
.
cid
=
cid
;
ak
.
bix
=
bix
;
ak
.
oStart
=
o_adrep
->
offset
();
ak
.
oEnd
=
ak
.
oStart
+
o_adrep
->
size
()
-
1
;
ap
=
(
sAttribute
*
)
tree_Insert
(
&
sts
,
m_attribute_th
,
&
ak
);
ap
->
o
.
aref
=
o_adrep
->
aref
();
ap
->
n
.
aref
=
n_adrep
->
aref
();
ap
->
o
.
aix
=
o_adrep
->
aix
();
ap
->
n
.
aix
=
n_adrep
->
aix
();
ap
->
o
.
nElement
=
o_adrep
->
nElement
();
ap
->
n
.
nElement
=
n_adrep
->
nElement
();
if
(
o_adrep
->
isArray
())
{
// Insert each element
for
(
int
j
=
0
;
j
<
MIN
(
o_adrep
->
nElement
(),
n_adrep
->
nElement
());
j
++
)
{
sAttributeKey
ak
;
sAttribute
*
ap
;
int
esize
=
o_adrep
->
size
()
/
o_adrep
->
nElement
();
ak
.
cid
=
cid
;
ak
.
bix
=
bix
;
ak
.
oStart
=
o_adrep
->
offset
()
+
j
*
esize
;
ak
.
oEnd
=
ak
.
oStart
+
esize
-
1
;
ap
=
(
sAttribute
*
)
tree_Insert
(
&
sts
,
m_attribute_th
,
&
ak
);
ap
->
o
.
aref
=
o_adrep
->
aref
();
ap
->
n
.
aref
=
n_adrep
->
aref
();
ap
->
o
.
aref
.
Size
=
o_adrep
->
size
()
/
o_adrep
->
nElement
();
ap
->
n
.
aref
.
Size
=
n_adrep
->
size
()
/
n_adrep
->
nElement
();
ap
->
o
.
aref
.
Offset
+=
j
*
ap
->
o
.
aref
.
Size
;
ap
->
n
.
aref
.
Offset
+=
j
*
ap
->
n
.
aref
.
Size
;
ap
->
n
.
aref
.
Flags
.
b
.
Array
=
0
;
ap
->
o
.
aref
.
Flags
.
b
.
Array
=
0
;
ap
->
o
.
aix
=
o_adrep
->
aix
();
ap
->
n
.
aix
=
n_adrep
->
aix
();
ap
->
o
.
nElement
=
o_adrep
->
nElement
();
ap
->
n
.
nElement
=
n_adrep
->
nElement
();
}
}
}
if
(
o_adrep
->
isClass
()
&&
n_adrep
->
subClass
()
==
o_adrep
->
subClass
())
{
checkSubClass
(
cid
,
o_adrep
->
subClass
(),
o_adrep
->
offset
(),
n_adrep
->
offset
());
if
(
o_adrep
->
isArray
())
{
for
(
int
j
=
0
;
j
<
MIN
(
o_adrep
->
nElement
(),
n_adrep
->
nElement
());
j
++
)
{
checkSubClass
(
cid
,
o_adrep
->
subClass
(),
o_adrep
->
offset
()
+
j
*
o_adrep
->
size
()
/
o_adrep
->
nElement
(),
n_adrep
->
offset
()
+
j
*
n_adrep
->
size
()
/
n_adrep
->
nElement
(),
body
);
}
}
else
checkSubClass
(
cid
,
o_adrep
->
subClass
(),
o_adrep
->
offset
(),
n_adrep
->
offset
(),
body
);
}
delete
n_adrep
;
}
...
...
@@ -2327,7 +2404,8 @@ void wb_vrepdbms::checkAttributes(pwr_tCid cid)
}
}
void
wb_vrepdbms
::
checkSubClass
(
pwr_tCid
cid
,
pwr_tCid
subcid
,
unsigned
int
o_offset
,
unsigned
int
n_offset
)
void
wb_vrepdbms
::
checkSubClass
(
pwr_tCid
cid
,
pwr_tCid
subcid
,
unsigned
int
o_offset
,
unsigned
int
n_offset
,
pwr_tCid
body
)
{
pwr_tStatus
sts
;
wb_cdrep
*
o_cdrep
=
m_merep
->
cdrep
(
&
sts
,
subcid
);
...
...
@@ -2346,52 +2424,105 @@ void wb_vrepdbms::checkSubClass(pwr_tCid cid, pwr_tCid subcid, unsigned int o_of
while
(
ODD
(
sts
))
{
bool
found
=
false
;
wb_adrep
*
n_adrep
=
n_bdrep
->
adrep
(
&
sts
);
while
(
ODD
(
sts
))
{
if
(
o_adrep
->
aix
()
==
n_adrep
->
aix
())
{
found
=
true
;
break
;
found
=
true
;
break
;
}
wb_adrep
*
prev
=
n_adrep
;
n_adrep
=
n_adrep
->
next
(
&
sts
);
delete
prev
;
}
if
(
found
)
{
if
(
(
o_adrep
->
offset
()
!=
n_adrep
->
offset
())
||
(
o_adrep
->
size
()
!=
n_adrep
->
size
())
||
(
o_adrep
->
type
()
!=
n_adrep
->
type
())
||
//(o_adrep->tid() != n_adrep->tid()) ||
(
o_adrep
->
nElement
()
!=
n_adrep
->
nElement
())
||
(
o_adrep
->
index
()
!=
n_adrep
->
index
()))
{
sAttributeKey
ak
;
sAttribute
*
ap
;
if
(
((
o_adrep
->
offset
()
+
o_offset
)
!=
(
n_adrep
->
offset
()
+
n_offset
))
||
(
o_adrep
->
size
()
!=
n_adrep
->
size
())
||
(
o_adrep
->
type
()
!=
n_adrep
->
type
())
||
//(o_adrep->tid() != n_adrep->tid()) ||
(
o_adrep
->
nElement
()
!=
n_adrep
->
nElement
())
||
(
o_adrep
->
index
()
!=
n_adrep
->
index
()))
{
sAttributeKey
ak
;
sAttribute
*
ap
;
ak
.
cid
=
cid
;
ak
.
bix
=
bix
;
ak
.
oStart
=
o_adrep
->
offset
()
+
o_offset
;
ak
.
oEnd
=
ak
.
oStart
+
o_adrep
->
size
()
-
1
;
ap
=
(
sAttribute
*
)
tree_Insert
(
&
sts
,
m_attribute_th
,
&
ak
);
ap
->
o
.
aref
=
o_adrep
->
aref
();
ap
->
n
.
aref
=
n_adrep
->
aref
();
ap
->
o
.
aix
=
o_adrep
->
aix
();
ap
->
n
.
aix
=
n_adrep
->
aix
();
ap
->
o
.
nElement
=
o_adrep
->
nElement
();
ap
->
n
.
nElement
=
n_adrep
->
nElement
();
ak
.
cid
=
cid
;
ak
.
bix
=
bix
;
ak
.
oStart
=
o_adrep
->
offset
()
+
o_offset
;
ak
.
oEnd
=
ak
.
oStart
+
o_adrep
->
size
()
-
1
;
ap
=
(
sAttribute
*
)
tree_Insert
(
&
sts
,
m_attribute_th
,
&
ak
);
ap
->
o
.
aref
=
o_adrep
->
aref
();
ap
->
n
.
aref
=
n_adrep
->
aref
();
ap
->
o
.
aref
.
Offset
+=
o_offset
;
ap
->
n
.
aref
.
Offset
+=
n_offset
;
ap
->
o
.
aref
.
Body
=
body
;
ap
->
n
.
aref
.
Body
=
body
;
ap
->
o
.
aix
=
o_adrep
->
aix
();
ap
->
n
.
aix
=
n_adrep
->
aix
();
ap
->
o
.
nElement
=
o_adrep
->
nElement
();
ap
->
n
.
nElement
=
n_adrep
->
nElement
();
if
(
o_adrep
->
isArray
())
{
for
(
int
j
=
0
;
j
<
MIN
(
o_adrep
->
nElement
(),
n_adrep
->
nElement
());
j
++
)
{
int
esize
=
o_adrep
->
size
()
/
o_adrep
->
nElement
();
sAttributeKey
ak
;
sAttribute
*
ap
;
ak
.
cid
=
cid
;
ak
.
bix
=
bix
;
ak
.
oStart
=
o_adrep
->
offset
()
+
o_offset
+
j
*
esize
;
ak
.
oEnd
=
ak
.
oStart
+
esize
-
1
;
ap
=
(
sAttribute
*
)
tree_Insert
(
&
sts
,
m_attribute_th
,
&
ak
);
ap
->
o
.
aref
=
o_adrep
->
aref
();
ap
->
n
.
aref
=
n_adrep
->
aref
();
ap
->
o
.
aref
.
Size
=
o_adrep
->
size
()
/
o_adrep
->
nElement
();
ap
->
n
.
aref
.
Size
=
n_adrep
->
size
()
/
n_adrep
->
nElement
();
ap
->
o
.
aref
.
Offset
+=
o_offset
+
j
*
ap
->
o
.
aref
.
Size
;
ap
->
n
.
aref
.
Offset
+=
n_offset
+
j
*
ap
->
n
.
aref
.
Size
;
ap
->
n
.
aref
.
Flags
.
b
.
Array
=
0
;
ap
->
o
.
aref
.
Flags
.
b
.
Array
=
0
;
ap
->
o
.
aref
.
Body
=
body
;
ap
->
n
.
aref
.
Body
=
body
;
ap
->
o
.
aix
=
o_adrep
->
aix
();
ap
->
n
.
aix
=
n_adrep
->
aix
();
ap
->
o
.
nElement
=
o_adrep
->
nElement
();
ap
->
n
.
nElement
=
n_adrep
->
nElement
();
}
}
}
if
(
o_adrep
->
isClass
()
&&
o_adrep
->
subClass
()
==
n_adrep
->
subClass
())
{
checkSubClass
(
cid
,
n_adrep
->
subClass
(),
o_adrep
->
offset
(),
n_adrep
->
offset
());
}
else
if
(
o_adrep
->
type
()
==
pwr_eType_AttrRef
)
{
sArefKey
a
;
a
.
cid
=
subcid
;
a
.
bix
=
bix
;
a
.
offset
=
o_adrep
->
offset
();
tree_Insert
(
&
sts
,
m_aref_th
,
&
a
);
if
(
o_adrep
->
isArray
())
{
for
(
int
j
=
0
;
j
<
MIN
(
o_adrep
->
nElement
(),
n_adrep
->
nElement
());
j
++
)
{
checkSubClass
(
cid
,
n_adrep
->
subClass
(),
o_adrep
->
offset
()
+
o_offset
+
j
*
o_adrep
->
size
()
/
o_adrep
->
nElement
(),
n_adrep
->
offset
()
+
n_offset
+
j
*
n_adrep
->
size
()
/
n_adrep
->
nElement
(),
body
);
}
}
else
checkSubClass
(
cid
,
n_adrep
->
subClass
(),
o_adrep
->
offset
()
+
o_offset
,
n_adrep
->
offset
()
+
n_offset
,
body
);
}
else
if
(
o_adrep
->
type
()
==
pwr_eType_AttrRef
)
{
sArefKey
a
;
if
(
o_adrep
->
isArray
())
{
for
(
int
j
=
0
;
j
<
o_adrep
->
nElement
();
j
++
)
{
a
.
cid
=
cid
;
a
.
bix
=
bix
;
a
.
offset
=
o_adrep
->
offset
()
+
o_offset
+
j
*
o_adrep
->
size
()
/
o_adrep
->
nElement
();
tree_Insert
(
&
sts
,
m_aref_th
,
&
a
);
}
}
else
{
a
.
cid
=
cid
;
a
.
bix
=
bix
;
a
.
offset
=
o_adrep
->
offset
()
+
o_offset
;
tree_Insert
(
&
sts
,
m_aref_th
,
&
a
);
}
}
if
(
n_adrep
)
delete
n_adrep
;
}
wb_adrep
*
prev
=
o_adrep
;
...
...
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