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
303b366b
Commit
303b366b
authored
Dec 07, 2003
by
lw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding wb_vrepdb::copy() and changed semantics of wb_vrepdb::create()
parent
d90f3734
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
154 additions
and
5 deletions
+154
-5
wb/exe/wb_wbltest/src/wb_wbltest.cpp
wb/exe/wb_wbltest/src/wb_wbltest.cpp
+48
-1
wb/lib/wb/src/wb_db.cpp
wb/lib/wb/src/wb_db.cpp
+89
-2
wb/lib/wb/src/wb_db.h
wb/lib/wb/src/wb_db.h
+1
-0
wb/lib/wb/src/wb_import.h
wb/lib/wb/src/wb_import.h
+0
-2
wb/lib/wb/src/wb_vrepdb.cpp
wb/lib/wb/src/wb_vrepdb.cpp
+15
-0
wb/lib/wb/src/wb_vrepdb.h
wb/lib/wb/src/wb_vrepdb.h
+1
-0
No files found.
wb/exe/wb_wbltest/src/wb_wbltest.cpp
View file @
303b366b
...
...
@@ -19,6 +19,53 @@
#if 1
int
main
(
int
argc
,
char
*
argv
[])
{
//pwr_tStatus sts;
//dbs_sEnv env;
//dbs_sEnv *ep;
wb_erep
*
erep
=
new
wb_erep
();
if
(
argc
<=
2
)
exit
(
0
);
// ep = dbs_Map(&sts, &env, argv[1]);
wb_vrepdbs
*
vdbs
=
new
wb_vrepdbs
(
erep
,
argv
[
1
]);
vdbs
->
load
();
wb_dbs
dbs
(
vdbs
);
dbs
.
setFileName
(
"lasse.dbs"
);
dbs
.
importVolume
(
*
vdbs
);
//wb_orepdbs *op = (wb_orepdbs *)vdbs->object(&sts);
wb_db
db
(
pwr_cNVid
);
db
.
copy
(
*
vdbs
,
argv
[
2
]);
//db.importVolume(*vdbs);
db
.
close
();
wb_vrepdb
vdb
(
erep
,
argv
[
2
]);
wb_dbs
adbs
(
vdbs
);
adbs
.
setFileName
(
"alasse.dbs"
);
adbs
.
importVolume
(
vdb
);
}
#elif 0
int
main
(
int
argc
,
char
*
argv
[])
{
//pwr_tStatus sts;
//dbs_sEnv env;
//dbs_sEnv *ep;
wb_erep
*
erep
=
new
wb_erep
();
if
(
argc
<=
2
)
exit
(
0
);
//wb_vrepdb vdb(erep, argv[2]);
wb_vrepdb
vdb
(
erep
,
1000
,
pwr_eClass_RootVolume
,
"Lasse"
,
argv
[
2
]);
}
#elif 0
int
main
(
int
argc
,
char
*
argv
[])
{
pwr_tStatus
sts
;
//dbs_sEnv env;
...
...
@@ -34,7 +81,7 @@ int main( int argc, char *argv[])
dbs
.
setFileName
(
"lasse.dbs"
);
dbs
.
importVolume
(
*
vdbs
);
wb_orepdbs
*
op
=
(
wb_orepdbs
*
)
vdbs
->
object
(
&
sts
);
//
wb_orepdbs *op = (wb_orepdbs *)vdbs->object(&sts);
wb_db
db
(
vdbs
->
vid
());
db
.
create
(
vdbs
->
vid
(),
vdbs
->
cid
(),
vdbs
->
name
(),
argv
[
2
]);
...
...
wb/lib/wb/src/wb_db.cpp
View file @
303b366b
...
...
@@ -692,7 +692,8 @@ void wb_db_dbody::iter(wb_import &i)
m_dbc
->
close
();
}
wb_db
::
wb_db
()
wb_db
::
wb_db
()
:
m_vid
(
pwr_cNVid
)
{
}
...
...
@@ -720,15 +721,101 @@ void wb_db::close()
m_env
->
close
(
0
);
}
void
wb_db
::
copy
(
wb_export
&
e
,
const
char
*
fileName
)
{
dcli_translate_filename
(
m_fileName
,
fileName
);
//int rc = m_env->txn_begin(0, (DbTxn **)&m_txn, 0);
openDb
(
false
);
importVolume
(
e
);
close
();
openDb
(
true
);
try
{
m_env
->
txn_begin
(
0
,
(
DbTxn
**
)
&
m_txn
,
0
);
wb_db_info
i
(
this
);
i
.
get
(
m_txn
);
m_vid
=
i
.
vid
();
m_cid
=
i
.
cid
();
strcpy
(
m_volumeName
,
i
.
name
());
}
catch
(
DbException
&
e
)
{
//txn->abort();
printf
(
"exeption: %s
\n
"
,
e
.
what
());
}
}
void
wb_db
::
create
(
pwr_tVid
vid
,
pwr_tCid
cid
,
const
char
*
volumeName
,
const
char
*
fileName
)
{
m_vid
=
vid
;
m_cid
=
cid
;
pwr_tStatus
sts
;
strcpy
(
m_volumeName
,
volumeName
);
dcli_translate_filename
(
m_fileName
,
fileName
);
//int rc = m_env->txn_begin(0, (DbTxn **)&m_txn, 0);
size_t
rbSize
=
0
;
pwr_uVolume
volume
;
pwr_tTime
time
;
pwr_tOid
oid
;
openDb
(
false
);
openDb
(
true
);
memset
(
&
volume
,
0
,
sizeof
(
volume
));
switch
(
cid
)
{
case
pwr_eClass_RootVolume
:
rbSize
=
sizeof
(
pwr_sRootVolume
);
break
;
case
pwr_eClass_SubVolume
:
rbSize
=
sizeof
(
pwr_sSubVolume
);
break
;
case
pwr_eClass_SystemVolume
:
rbSize
=
sizeof
(
pwr_sSystemVolume
);
break
;
case
pwr_eClass_ClassVolume
:
rbSize
=
sizeof
(
pwr_sClassVolume
);
break
;
case
pwr_eClass_WorkBenchVolume
:
rbSize
=
sizeof
(
pwr_sWorkBenchVolume
);
break
;
case
pwr_eClass_DirectoryVolume
:
rbSize
=
sizeof
(
pwr_sDirectoryVolume
);
break
;
case
pwr_eClass_SharedVolume
:
case
pwr_eClass_CreateVolume
:
case
pwr_eClass_MountVolume
:
case
pwr_eClass_MountObject
:
case
pwr_eClass_VolatileVolume
:
case
pwr_eClass_DynamicVolume
:
default:
break
;
}
oid
.
vid
=
vid
;
oid
.
oix
=
pwr_cNOix
;
wb_name
n
(
volumeName
);
pwr_mClassDef
flags
;
try
{
m_env
->
txn_begin
(
0
,
(
DbTxn
**
)
&
m_txn
,
0
);
importHead
(
oid
,
cid
,
pwr_cNOid
,
pwr_cNOid
,
pwr_cNOid
,
pwr_cNOid
,
pwr_cNOid
,
n
.
name
(),
n
.
normName
(),
flags
,
time
,
time
,
time
,
rbSize
,
0
);
wb_db_info
i
(
this
);
i
.
get
(
m_txn
);
m_vid
=
i
.
vid
();
m_cid
=
i
.
cid
();
strcpy
(
m_volumeName
,
i
.
name
());
commit
(
&
sts
);
}
catch
(
DbException
&
e
)
{
//txn->abort();
printf
(
"exeption: %s
\n
"
,
e
.
what
());
}
}
wb_db_txn
*
wb_db
::
begin
(
wb_db_txn
*
txn
)
...
...
wb/lib/wb/src/wb_db.h
View file @
303b366b
...
...
@@ -65,6 +65,7 @@ public:
void
open
(
const
char
*
fileName
);
void
openDb
(
bool
useTxn
);
void
copy
(
wb_export
&
e
,
const
char
*
fileName
);
void
create
(
pwr_tVid
vid
,
pwr_tCid
cid
,
const
char
*
volumeName
,
const
char
*
fileName
);
int
del_family
(
wb_db_txn
*
txn
,
Dbc
*
cp
,
pwr_tOid
poid
);
...
...
wb/lib/wb/src/wb_import.h
View file @
303b366b
...
...
@@ -27,5 +27,3 @@ public:
};
#endif
wb/lib/wb/src/wb_vrepdb.cpp
View file @
303b366b
...
...
@@ -37,6 +37,21 @@ wb_vrepdb::wb_vrepdb(wb_erep *erep, const char *fileName) :
m_merep
=
m_erep
->
merep
();
}
wb_vrepdb
::
wb_vrepdb
(
wb_erep
*
erep
,
pwr_tVid
vid
,
pwr_tCid
cid
,
const
char
*
volumeName
,
const
char
*
fileName
)
:
m_erep
(
erep
),
m_nRef
(
0
),
m_ohead
()
{
strcpy
(
m_fileName
,
fileName
);
m_db
=
new
wb_db
();
m_db
->
create
(
vid
,
cid
,
volumeName
,
fileName
);
m_ohead
.
setDb
(
m_db
);
strcpy
(
m_name
,
m_db
->
volumeName
());
m_vid
=
m_db
->
vid
();
m_cid
=
m_db
->
cid
();
m_merep
=
m_erep
->
merep
();
}
wb_erep
*
wb_vrepdb
::
erep
()
{
return
m_erep
;
...
...
wb/lib/wb/src/wb_vrepdb.h
View file @
303b366b
...
...
@@ -25,6 +25,7 @@ public:
wb_db_ohead
m_ohead
;
wb_vrepdb
(
wb_erep
*
erep
,
const
char
*
fileName
);
wb_vrepdb
(
wb_erep
*
erep
,
pwr_tVid
,
pwr_tCid
,
const
char
*
volumeName
,
const
char
*
fileName
);
virtual
void
unref
();
virtual
wb_vrep
*
ref
();
...
...
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