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
18f43cda
Commit
18f43cda
authored
Jan 08, 2010
by
Jonas Nylund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SEV No limit in long attribute names anymore
parent
58cca3fd
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
175 additions
and
153 deletions
+175
-153
sev/exe/sev_server/src/sev_server.cpp
sev/exe/sev_server/src/sev_server.cpp
+5
-76
sev/lib/sev/src/sev_db.h
sev/lib/sev/src/sev_db.h
+3
-3
sev/lib/sev/src/sev_dbms.cpp
sev/lib/sev/src/sev_dbms.cpp
+149
-69
sev/lib/sev/src/sev_dbms.h
sev/lib/sev/src/sev_dbms.h
+18
-5
No files found.
sev/exe/sev_server/src/sev_server.cpp
View file @
18f43cda
...
...
@@ -318,73 +318,6 @@ int sev_server::send_itemlist( qcom_sQid tgt)
}
return
1
;
}
/*
int sev_server::send_itemlist( qcom_sQid tgt)
{
int item_cnt = 0;
qcom_sPut put;
pwr_tStatus sts, lsts;
int size;
for ( unsigned int i = 0; i < m_db->m_items.size(); i++) {
if ( m_db->m_items[i].deleted)
continue;
item_cnt++;
}
if ( !item_cnt)
return 1;
size = sizeof(sev_sMsgHistItems) + (item_cnt - 1) * sizeof(sev_sHistItem);
put.size = size;
put.data = qcom_Alloc(&lsts, put.size);
((sev_sMsgHistItems *)put.data)->Type = sev_eMsgType_HistItems;
((sev_sMsgHistItems *)put.data)->NumItems = item_cnt;
int idx = 0;
for ( unsigned int i = 0; i < m_db->m_items.size(); i++) {
if ( m_db->m_items[i].deleted)
continue;
((sev_sMsgHistItems *)put.data)->Items[idx].oid = m_db->m_items[i].oid;
strcpy( ((sev_sMsgHistItems *)put.data)->Items[idx].oname, m_db->m_items[i].oname);
((sev_sMsgHistItems *)put.data)->Items[idx].storagetime =
net_DeltaTimeToNetTime(&m_db->m_items[i].storagetime);
((sev_sMsgHistItems *)put.data)->Items[idx].creatime =
net_TimeToNetTime( &m_db->m_items[i].creatime);
((sev_sMsgHistItems *)put.data)->Items[idx].modtime =
net_TimeToNetTime( &m_db->m_items[i].modtime);
strcpy( ((sev_sMsgHistItems *)put.data)->Items[idx].description, m_db->m_items[i].description);
strcpy( ((sev_sMsgHistItems *)put.data)->Items[idx].attr[0].aname, m_db->m_items[i].attr[0].aname);
((sev_sMsgHistItems *)put.data)->Items[idx].attrnum = m_db->m_items[i].attrnum;
((sev_sMsgHistItems *)put.data)->Items[idx].attr[0].type = m_db->m_items[i].attr[0].type;
((sev_sMsgHistItems *)put.data)->Items[idx].attr[0].size = m_db->m_items[i].attr[0].size;
strcpy( ((sev_sMsgHistItems *)put.data)->Items[idx].attr[0].unit, m_db->m_items[i].attr[0].unit);
((sev_sMsgHistItems *)put.data)->Items[idx].scantime = m_db->m_items[i].scantime;
((sev_sMsgHistItems *)put.data)->Items[idx].deadband = m_db->m_items[i].deadband;
((sev_sMsgHistItems *)put.data)->Items[idx].options = m_db->m_items[i].options;
idx++;
}
if ( !item_cnt)
((sev_sMsgHistItems *)put.data)->Status = SEV__NOITEMS;
else
((sev_sMsgHistItems *)put.data)->Status = SEV__SUCCESS;
put.reply.nid = m_nodes[0].nid;
put.reply.qix = sev_eProcSevServer;
put.type.b = (qcom_eBtype) sev_cMsgClass;
put.type.s = (qcom_eStype) sev_eMsgType_HistItems;
put.msg_id = m_msg_id++;
if ( !qcom_Put( &sts, &tgt, &put)) {
qcom_Free( &sts, put.data);
return 0;
}
return 1;
}
*/
int
sev_server
::
send_server_status
(
qcom_sQid
tgt
)
{
...
...
@@ -584,7 +517,7 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
attributeName
[
0
]
=
'\0'
;
storagetime
=
net_NetTimeToDeltaTime
(
&
buffP
->
storagetime
);
sprintf
(
tablename
,
"
obj_%s"
,
m_db
->
oid_to_table
(
buffP
->
oid
,
attributeName
)
);
sprintf
(
tablename
,
"
HiaHia"
);
//Dummy-name, real name created in add_objectitem
bool
newobject
=
false
;
if
(
!
m_db
->
check_objectitem
(
&
m_sts
,
tablename
,
...
...
@@ -650,7 +583,6 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
//rename the table to something and create a new one.
//this is the only way to do this without hanging the server for several minutes
m_db
->
handle_objectchange
(
&
m_sts
,
tablename
,
idx
,
newobject
);
}
//If node is coming up again we do not want deadband to be active due to init of old_value
...
...
@@ -700,6 +632,7 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
msg
->
Items
[
i
].
deadband
,
msg
->
Items
[
i
].
options
,
&
idx
);
if
(
EVEN
(
m_sts
))
return
m_sts
;
}
if
(
ODD
(
m_sts
)
)
{
//Create space for the old values used if we have deadband active
if
(
m_db
->
m_items
[
idx
].
old_value
!=
0
)
{
...
...
@@ -788,10 +721,8 @@ int sev_server::send_histdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *rmsg,
starttime
=
net_NetTimeToTime
(
&
rmsg
->
StartTime
);
endtime
=
net_NetTimeToTime
(
&
rmsg
->
EndTime
);
sev_item
item
;
char
tablename
[
500
];
strcpy
(
tablename
,
m_db
->
oid_to_table
(
rmsg
->
Oid
,
rmsg
->
AName
)
);
m_db
->
get_item
(
&
m_sts
,
&
item
,
tablen
ame
);
m_db
->
get_item
(
&
m_sts
,
&
item
,
rmsg
->
Oid
,
rmsg
->
AN
ame
);
if
(
ODD
(
m_sts
))
{
m_db
->
get_values
(
&
m_sts
,
rmsg
->
Oid
,
item
.
options
,
item
.
deadband
,
rmsg
->
AName
,
item
.
attr
[
0
].
type
,
item
.
attr
[
0
].
size
,
...
...
@@ -848,10 +779,8 @@ int sev_server::send_objecthistdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *
starttime
=
net_NetTimeToTime
(
&
rmsg
->
StartTime
);
endtime
=
net_NetTimeToTime
(
&
rmsg
->
EndTime
);
sev_item
item
;
char
tablename
[
500
];
sprintf
(
tablename
,
"obj_%s"
,
m_db
->
oid_to_table
(
rmsg
->
Oid
,
rmsg
->
AName
)
);
m_db
->
get_objectitem
(
&
m_sts
,
&
item
,
tablen
ame
);
m_db
->
get_objectitem
(
&
m_sts
,
&
item
,
rmsg
->
Oid
,
rmsg
->
AN
ame
);
if
(
ODD
(
m_sts
))
{
m_db
->
get_objectvalues
(
&
m_sts
,
&
item
,
item
.
value_size
,
&
starttime
,
&
endtime
,
rmsg
->
NumPoints
,
&
tbuf
,
&
vbuf
,
&
rows
);
}
...
...
@@ -959,7 +888,7 @@ void sev_server::garbage_item( int idx)
m_db
->
m_items
[
idx
].
options
,
limit
);
}
else
{
m_db
->
delete_old_data
(
&
m_sts
,
m_db
->
m_items
[
idx
].
oid
,
m_db
->
m_items
[
idx
].
attr
[
0
].
a
name
,
m_db
->
delete_old_data
(
&
m_sts
,
m_db
->
m_items
[
idx
].
table
name
,
m_db
->
m_items
[
idx
].
options
,
limit
);
}
}
...
...
sev/lib/sev/src/sev_db.h
View file @
18f43cda
...
...
@@ -92,7 +92,7 @@ class sev_db {
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
{
return
0
;}
virtual
int
get_items
(
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
int
delete_old_data
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
a
name
,
virtual
int
delete_old_data
(
pwr_tStatus
*
sts
,
char
*
table
name
,
pwr_tMask
options
,
pwr_tTime
limit
)
{
return
0
;}
virtual
char
*
oid_to_table
(
pwr_tOid
oid
,
char
*
aname
)
{
return
0
;}
...
...
@@ -106,8 +106,8 @@ class sev_db {
pwr_tFloat32
deadband
,
pwr_tMask
options
,
unsigned
int
*
idx
)
{
return
0
;}
virtual
int
store_objectitem
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storagetime
,
char
*
description
,
pwr_tFloat32
scantime
,
pwr_tFloat32
deadband
,
pwr_tMask
options
)
{
return
0
;}
virtual
int
get_item
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
char
*
tabl
ename
)
{
return
0
;}
virtual
int
get_objectitem
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
char
*
tabl
ename
)
{
return
0
;}
virtual
int
get_item
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
pwr_tOid
oid
,
char
*
attribut
ename
)
{
return
0
;}
virtual
int
get_objectitem
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
pwr_tOid
oid
,
char
*
attribut
ename
)
{
return
0
;}
virtual
int
get_objectitems
(
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
int
check_objectitemattr
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tOid
oid
,
char
*
aname
,
char
*
oname
,
pwr_eType
type
,
unsigned
int
size
,
unsigned
int
*
idx
)
{
return
0
;}
...
...
sev/lib/sev/src/sev_dbms.cpp
View file @
18f43cda
This diff is collapsed.
Click to expand it.
sev/lib/sev/src/sev_dbms.h
View file @
18f43cda
...
...
@@ -103,6 +103,8 @@ class sev_dbms_env
class
sev_dbms
:
public
sev_db
{
public:
static
const
unsigned
int
constMaxColNameLength
=
64
;
sev_dbms_env
*
m_env
;
sev_dbms
(
sev_dbms_env
*
env
)
:
m_env
(
env
)
{}
...
...
@@ -122,14 +124,14 @@ class sev_dbms : public sev_db {
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
delete_old_data
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
a
name
,
int
delete_old_data
(
pwr_tStatus
*
sts
,
char
*
table
name
,
pwr_tMask
options
,
pwr_tTime
limit
);
int
delete_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
);
int
get_items
(
pwr_tStatus
*
sts
);
int
create_table
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
a
name
,
pwr_eType
type
,
unsigned
int
size
,
int
create_table
(
pwr_tStatus
*
sts
,
char
*
table
name
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tMask
options
,
float
deadband
);
int
delete_table
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
a
name
);
int
delete_table
(
pwr_tStatus
*
sts
,
char
*
table
name
);
int
store_item
(
pwr_tStatus
*
sts
,
char
*
tabelname
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storagetime
,
pwr_eType
vtype
,
unsigned
int
vsize
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
...
...
@@ -152,8 +154,8 @@ class sev_dbms : public sev_db {
int
create_objecttable
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tMask
options
,
float
deadband
);
int
store_objectvalue
(
pwr_tStatus
*
sts
,
int
item_idx
,
int
attr_idx
,
pwr_tTime
time
,
void
*
buf
,
void
*
oldbuf
,
unsigned
int
size
);
int
get_item
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
char
*
tabl
ename
);
int
get_objectitem
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
char
*
tabl
ename
);
int
get_item
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
pwr_tOid
oid
,
char
*
attribut
ename
);
int
get_objectitem
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
pwr_tOid
oid
,
char
*
attribut
ename
);
int
get_objectitems
(
pwr_tStatus
*
sts
);
int
get_objectitemattributes
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
char
*
tablename
);
int
check_objectitemattr
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tOid
oid
,
char
*
aname
,
char
*
oname
,
...
...
@@ -165,8 +167,19 @@ class sev_dbms : public sev_db {
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
pwr_tUInt64
get_minFromIntegerColumn
(
char
*
tablename
,
char
*
colname
);
pwr_tUInt64
get_maxFromIntegerColumn
(
char
*
tablename
,
char
*
colname
);
pwr_tUInt64
get_nextAutoIncrement
(
char
*
tablename
);
int
handle_itemchange
(
pwr_tStatus
*
sts
,
char
*
tablename
,
unsigned
int
item_idx
);
int
handle_objectchange
(
pwr_tStatus
*
sts
,
char
*
tablename
,
unsigned
int
item_idx
,
bool
newObject
);
inline
char
*
create_colName
(
unsigned
int
index
,
char
*
attributename
)
{
static
char
colName
[
constMaxColNameLength
];
strncpy
(
colName
,
attributename
,
constMaxColNameLength
);
if
(
strlen
(
attributename
)
>
constMaxColNameLength
)
{
colName
[
constMaxColNameLength
-
5
]
=
0
;
snprintf
(
&
colName
[
strlen
(
colName
)],
5
,
"_%d"
,
index
);
}
return
colName
;
}
};
#endif
#endif
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