Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
d4ddfc4c
Commit
d4ddfc4c
authored
20 years ago
by
Sebastien Ponce
Browse files
Options
Downloads
Patches
Plain Diff
updateObj implementation, final implementation of updateRep, correct usage of compositions, ...
parent
b9751e66
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
castor/db/ora/OraCnvSvc.cpp
+2
-2
2 additions, 2 deletions
castor/db/ora/OraCnvSvc.cpp
castor/db/ora/OraCuuidCnv.cpp
+52
-1
52 additions, 1 deletion
castor/db/ora/OraCuuidCnv.cpp
castor/db/ora/OraCuuidCnv.hpp
+11
-0
11 additions, 0 deletions
castor/db/ora/OraCuuidCnv.hpp
with
65 additions
and
3 deletions
castor/db/ora/OraCnvSvc.cpp
+
2
−
2
View file @
d4ddfc4c
...
...
@@ -196,7 +196,7 @@ void castor::db::ora::OraCnvSvc::deleteConnection
// createObj
// -----------------------------------------------------------------------
castor
::
IObject
*
castor
::
db
::
ora
::
OraCnvSvc
::
createObj
(
castor
::
IAddress
*
address
,
ObjectCatalog
&
newlyCreated
)
ObjectCatalog
&
newlyCreated
)
throw
(
castor
::
exception
::
Exception
)
{
// If the address has no type, find it out
if
(
OBJ_INVALID
==
address
->
objType
())
{
...
...
@@ -333,7 +333,7 @@ castor::db::ora::OraCnvSvc::getTypeFromId(const unsigned long id)
oracle
::
occi
::
ResultSet
*
rset
=
m_getTypeStatement
->
executeQuery
();
if
(
oracle
::
occi
::
ResultSet
::
END_OF_FETCH
==
rset
->
next
())
{
castor
::
exception
::
NoEntry
ex
;
ex
.
getMessage
()
<<
"No type found for id :"
<<
id
;
ex
.
getMessage
()
<<
"No type found for id :
"
<<
id
;
throw
ex
;
}
return
rset
->
getInt
(
1
);
...
...
This diff is collapsed.
Click to expand it.
castor/db/ora/OraCuuidCnv.cpp
+
52
−
1
View file @
d4ddfc4c
...
...
@@ -202,7 +202,8 @@ void castor::db::ora::OraCuuidCnv::deleteRep(castor::IAddress* address,
// Check whether the statements are ok
if
(
0
==
m_deleteStatement
)
{
m_deleteStatement
=
createStatement
(
s_deleteStatementString
);
}
if
(
0
==
m_deleteTypeStatement
)
{
}
if
(
0
==
m_deleteTypeStatement
)
{
m_deleteTypeStatement
=
createStatement
(
s_deleteTypeStatementString
);
}
// Mark the current object as done
...
...
@@ -280,3 +281,53 @@ castor::IObject* castor::db::ora::OraCuuidCnv::createObj(castor::IAddress* addre
}
}
//------------------------------------------------------------------------------
// updateObj
//------------------------------------------------------------------------------
void
castor
::
db
::
ora
::
OraCuuidCnv
::
updateObj
(
castor
::
IObject
*
obj
,
castor
::
ObjectCatalog
&
alreadyDone
)
throw
(
castor
::
exception
::
Exception
)
{
try
{
// Check whether the statement is ok
if
(
0
==
m_selectStatement
)
{
m_selectStatement
=
createStatement
(
s_selectStatementString
);
}
if
(
0
==
m_selectStatement
)
{
castor
::
exception
::
Internal
ex
;
ex
.
getMessage
()
<<
"Unable to create statement :"
<<
std
::
endl
<<
s_selectStatementString
;
throw
ex
;
}
// retrieve the object from the database
m_selectStatement
->
setInt
(
1
,
obj
->
id
());
oracle
::
occi
::
ResultSet
*
rset
=
m_selectStatement
->
executeQuery
();
if
(
oracle
::
occi
::
ResultSet
::
END_OF_FETCH
==
rset
->
next
())
{
castor
::
exception
::
NoEntry
ex
;
ex
.
getMessage
()
<<
"No object found for id :"
<<
obj
->
id
();
throw
ex
;
}
// Now retrieve and set members
castor
::
stager
::
Cuuid
*
object
=
dynamic_cast
<
castor
::
stager
::
Cuuid
*>
(
obj
);
Cuuid_t
content
;
content
.
time_low
=
rset
->
getInt
(
1
);
content
.
time_mid
=
rset
->
getInt
(
2
);
content
.
time_hi_and_version
=
rset
->
getInt
(
3
);
content
.
clock_seq_hi_and_reserved
=
rset
->
getInt
(
4
);
content
.
clock_seq_low
=
rset
->
getInt
(
5
);
memcpy
(
content
.
node
,
rset
->
getString
(
6
).
data
(),
6
*
sizeof
(
BYTE
));
object
->
setContent
(
content
);
object
->
setId
(
rset
->
getInt
(
7
));
alreadyDone
[
object
->
id
()]
=
object
;
m_selectStatement
->
closeResultSet
(
rset
);
}
catch
(
oracle
::
occi
::
SQLException
e
)
{
cnvSvc
()
->
getConnection
()
->
rollback
();
castor
::
exception
::
InvalidArgument
ex
;
// XXX Fix it, depending on ORACLE error
ex
.
getMessage
()
<<
"Error in update object :"
<<
std
::
endl
<<
e
.
what
()
<<
std
::
endl
<<
"Statement was :"
<<
std
::
endl
<<
s_selectStatementString
<<
std
::
endl
<<
"and id was "
<<
obj
->
id
()
<<
std
::
endl
;;
throw
ex
;
}
}
This diff is collapsed.
Click to expand it.
castor/db/ora/OraCuuidCnv.hpp
+
11
−
0
View file @
d4ddfc4c
...
...
@@ -118,6 +118,17 @@ namespace castor {
castor
::
ObjectCatalog
&
newlyCreated
)
throw
(
castor
::
exception
::
Exception
);
/**
* Updates C++ object from its foreign representation.
* @param object the object to deal with
* @param alreadyDone the set of objects already updated.
* This is needed to avoid looping in case of circular dependencies
* @exception Exception throws an Exception in cas of error
*/
virtual
void
updateObj
(
castor
::
IObject
*
obj
,
castor
::
ObjectCatalog
&
alreadyDone
)
throw
(
castor
::
exception
::
Exception
);
private:
/// SQL statement for request insertion
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment