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
10beac8d
Commit
10beac8d
authored
Mar 02, 2012
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sev altering of database engine added to sev_repair
parent
38434254
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
105 additions
and
22 deletions
+105
-22
sev/exe/sev_repair/src/sev_repair.cpp
sev/exe/sev_repair/src/sev_repair.cpp
+44
-2
sev/exe/sev_repair/src/sev_repair.h
sev/exe/sev_repair/src/sev_repair.h
+1
-0
sev/exe/sev_server/src/sev_server.cpp
sev/exe/sev_server/src/sev_server.cpp
+1
-1
sev/exe/sev_xtt/src/xtt_tbl.cpp
sev/exe/sev_xtt/src/xtt_tbl.cpp
+1
-1
sev/lib/sev/src/sev_db.h
sev/lib/sev/src/sev_db.h
+1
-0
sev/lib/sev/src/sev_dbms.cpp
sev/lib/sev/src/sev_dbms.cpp
+44
-6
sev/lib/sev/src/sev_dbms.h
sev/lib/sev/src/sev_dbms.h
+1
-0
src/lib/co/src/co_ccm.c
src/lib/co/src/co_ccm.c
+1
-1
src/lib/co/src/co_cnf.c
src/lib/co/src/co_cnf.c
+3
-3
src/lib/co/src/co_cnf.h
src/lib/co/src/co_cnf.h
+1
-1
wb/lib/wb/src/wb_erep.cpp
wb/lib/wb/src/wb_erep.cpp
+1
-1
wb/lib/wb/src/wb_ldh.cpp
wb/lib/wb/src/wb_ldh.cpp
+1
-1
wb/lib/wb/src/wb_lfu.cpp
wb/lib/wb/src/wb_lfu.cpp
+1
-1
wb/lib/wb/src/wb_pvd_pl.cpp
wb/lib/wb/src/wb_pvd_pl.cpp
+1
-1
xtt/lib/ge/src/ge_graph_javabean.cpp
xtt/lib/ge/src/ge_graph_javabean.cpp
+2
-2
xtt/lib/ge/src/ge_graph_web.cpp
xtt/lib/ge/src/ge_graph_web.cpp
+1
-1
No files found.
sev/exe/sev_repair/src/sev_repair.cpp
View file @
10beac8d
...
...
@@ -36,6 +36,7 @@
#if defined PWRE_CONF_MYSQL
#include <iostream>
#include "pwr.h"
#include "co_cdh.h"
...
...
@@ -46,6 +47,16 @@
#include "rt_sev_msg.h"
static
void
usage
()
{
cout
<<
endl
<<
endl
<<
"sev_repair Maintain sev database"
<<
endl
<<
endl
<<
"> sev_repair [-e] [-r] [-h]"
<<
endl
<<
endl
<<
"-r Repair database"
<<
endl
<<
"-e Alter database engine to engine specified in /etc/proview.cnf, "
<<
endl
<<
" eg
\"
sevMysqlEngine innodb
\"
"
<<
endl
<<
endl
;
}
int
sev_repair
::
init
()
{
sev_dbms_env
*
env
;
...
...
@@ -95,12 +106,43 @@ int sev_repair::check()
return
1
;
}
int
sev_repair
::
alter_engine
()
{
pwr_tStatus
sts
;
int
fail_cnt
=
0
;
printf
(
"-- Number of tables to alter: %u
\n
"
,
m_db
->
m_items
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
m_db
->
m_items
.
size
();
i
++
)
{
printf
(
"
\n
-- Processing %u (%u) %s
\n
"
,
i
,
m_db
->
m_items
.
size
(),
m_db
->
m_items
[
i
].
tablename
);
m_db
->
alter_engine
(
&
sts
,
m_db
->
m_items
[
i
].
tablename
);
if
(
EVEN
(
sts
))
fail_cnt
++
;
}
if
(
fail_cnt
)
printf
(
"** Alter failed on %d tables
\n
"
,
fail_cnt
);
else
printf
(
"-- Tables successfully altered
\n
"
);
return
1
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
sev_repair
rep
;
rep
.
init
();
rep
.
check
();
if
(
argc
>
1
&&
strcmp
(
argv
[
1
],
"-e"
)
==
0
)
{
// Alter engine
rep
.
init
();
rep
.
alter_engine
();
}
else
if
(
argc
>
1
&&
strcmp
(
argv
[
1
],
"-r"
)
==
0
)
{
// Repair
rep
.
init
();
rep
.
check
();
}
else
usage
();
}
#else
int
main
(){}
...
...
sev/exe/sev_repair/src/sev_repair.h
View file @
10beac8d
...
...
@@ -55,5 +55,6 @@ class sev_repair {
int
init
();
int
check
();
int
alter_engine
();
};
#endif
sev/exe/sev_server/src/sev_server.cpp
View file @
10beac8d
...
...
@@ -118,7 +118,7 @@ int sev_server::init( int noneth)
env
=
new
sev_dbms_env
(
envname
);
env
->
open
(
envname
);
if
(
!
env
->
exists
())
{
cnf_get_value
(
"mysqlSocket"
,
socket
);
cnf_get_value
(
"mysqlSocket"
,
socket
,
sizeof
(
socket
)
);
env
->
create
(
envname
,
"localhost"
,
"pwrp"
,
""
,
sev_dbms_env
::
dbName
(),
50
,
socket
);
...
...
sev/exe/sev_xtt/src/xtt_tbl.cpp
View file @
10beac8d
...
...
@@ -78,7 +78,7 @@ XttTbl::XttTbl( void *xn_parent_ctx, sevcli_tCtx xn_sevcli) :
strcpy
(
user
,
""
);
// Get default privilete from proview.cnf
if
(
cnf_get_value
(
"sevXttDefaultPriv"
,
default_priv
))
{
if
(
cnf_get_value
(
"sevXttDefaultPriv"
,
default_priv
,
sizeof
(
default_priv
)
))
{
if
(
cdh_NoCaseStrcmp
(
default_priv
,
"READ"
)
==
0
)
priv
=
pwr_mPrv_SevRead
;
else
if
(
cdh_NoCaseStrcmp
(
default_priv
,
"ADMIN"
)
==
0
)
...
...
sev/lib/sev/src/sev_db.h
View file @
10beac8d
...
...
@@ -134,6 +134,7 @@ class sev_db {
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
{
return
0
;}
virtual
int
handle_objectchange
(
pwr_tStatus
*
sts
,
char
*
tablename
,
unsigned
int
item_idx
,
bool
newObject
)
{
return
0
;}
virtual
int
repair_table
(
pwr_tStatus
*
sts
,
char
*
tablename
)
{
return
0
;}
virtual
int
alter_engine
(
pwr_tStatus
*
sts
,
char
*
tablename
)
{
return
0
;}
};
#endif
sev/lib/sev/src/sev_dbms.cpp
View file @
10beac8d
...
...
@@ -52,6 +52,7 @@
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "co_cnf.h"
#include "rt_load.h"
#include "sev_dbms.h"
#include "rt_sev_msg.h"
...
...
@@ -219,8 +220,8 @@ int sev_dbms_env::open(const char *v_host, const char *v_user, const char *v_pas
}
int
sev_dbms_env
::
create
(
const
char
*
v_fileName
,
const
char
*
v_host
,
const
char
*
v_user
,
const
char
*
v_passwd
,
const
char
*
v_dbName
,
unsigned
int
v_port
,
const
char
*
v_socket
)
const
char
*
v_passwd
,
const
char
*
v_dbName
,
unsigned
int
v_port
,
const
char
*
v_socket
)
{
fileName
(
v_fileName
);
host
(
v_host
);
...
...
@@ -647,6 +648,11 @@ int sev_dbms::create_table( pwr_tStatus *sts, char *tablename, pwr_eType type,
char
jumpstr
[
80
];
char
idtypestr
[
20
];
char
readoptstr
[
80
];
char
engine
[
80
];
char
enginestr
[
100
]
=
""
;
if
(
cnf_get_value
(
"sevMysqlEngine"
,
engine
,
sizeof
(
engine
))
!=
0
)
snprintf
(
enginestr
,
sizeof
(
enginestr
),
" engine=%s"
,
engine
);
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
{
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
...
...
@@ -684,8 +690,8 @@ int sev_dbms::create_table( pwr_tStatus *sts, char *tablename, pwr_eType type,
strcpy
(
jumpstr
,
""
);
sprintf
(
query
,
"create table %s ( %s"
"%s, value %s %s, index (time));"
,
tablename
,
readoptstr
,
timeformatstr
,
pwrtype_to_type
(
type
,
size
),
jumpstr
);
"%s, value %s %s, index (time))
%s
;"
,
tablename
,
readoptstr
,
timeformatstr
,
pwrtype_to_type
(
type
,
size
),
jumpstr
,
enginestr
);
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
...
...
@@ -2096,6 +2102,11 @@ int sev_dbms::create_objecttable( pwr_tStatus *sts, char *tablename, pwr_tMask o
char
jumpstr
[
80
];
char
idtypestr
[
20
];
char
readoptstr
[
80
];
char
engine
[
80
];
char
enginestr
[
100
]
=
""
;
if
(
cnf_get_value
(
"sevMysqlEngine"
,
engine
,
sizeof
(
engine
))
!=
0
)
snprintf
(
enginestr
,
sizeof
(
enginestr
),
" engine=%s"
,
engine
);
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
{
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
...
...
@@ -2133,8 +2144,8 @@ int sev_dbms::create_objecttable( pwr_tStatus *sts, char *tablename, pwr_tMask o
strcpy
(
jumpstr
,
""
);
sprintf
(
query
,
"create table %s ( %s"
"%s %s, index (sev__time) );"
,
tablename
,
readoptstr
,
timeformatstr
,
jumpstr
);
"%s %s, index (sev__time) )
%s
;"
,
tablename
,
readoptstr
,
timeformatstr
,
jumpstr
,
enginestr
);
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
...
...
@@ -3511,6 +3522,33 @@ int sev_dbms::repair_table( pwr_tStatus *sts, char *tablename)
return
ODD
(
*
sts
);
}
int
sev_dbms
::
alter_engine
(
pwr_tStatus
*
sts
,
char
*
tablename
)
{
char
query
[
200
];
int
rc
;
char
engine
[
80
];
if
(
cnf_get_value
(
"sevMysqlEngine"
,
engine
,
sizeof
(
engine
))
==
0
)
{
printf
(
"** No engine specified in /etc/proview.cnf
\n
"
);
return
0
;
}
// Check table
printf
(
"-- Altering engine to %s table %s...
\n
"
,
engine
,
tablename
);
sprintf
(
query
,
"alter table %s engine=%s"
,
tablename
,
engine
);
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
printf
(
"In %s row %d:
\n
"
,
__FILE__
,
__LINE__
);
printf
(
"%s: %s
\n
"
,
__FUNCTION__
,
mysql_error
(
m_env
->
con
()));
*
sts
=
SEV__DBERROR
;
return
0
;
}
*
sts
=
SEV__SUCCESS
;
return
1
;
}
sev_dbms
::~
sev_dbms
()
{
...
...
sev/lib/sev/src/sev_dbms.h
View file @
10beac8d
...
...
@@ -189,6 +189,7 @@ class sev_dbms : public sev_db {
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
);
int
repair_table
(
pwr_tStatus
*
sts
,
char
*
tablename
);
int
alter_engine
(
pwr_tStatus
*
sts
,
char
*
tablename
);
inline
char
*
create_colName
(
unsigned
int
index
,
char
*
attributename
)
{
static
char
colName
[
constMaxColNameLength
];
strncpy
(
colName
,
attributename
,
constMaxColNameLength
);
...
...
src/lib/co/src/co_ccm.c
View file @
10beac8d
...
...
@@ -5044,7 +5044,7 @@ static int ccm_func_get_pwr_config(
if
(
arg_list
->
value_decl
!=
K_DECL_STRING
)
return
CCM__VARTYPE
;
if
(
cnf_get_value
(
arg_list
->
value_string
,
value
))
{
if
(
cnf_get_value
(
arg_list
->
value_string
,
value
,
sizeof
(
value
)
))
{
strncpy
(
return_string
,
value
,
K_STRING_SIZE
);
return_string
[
K_STRING_SIZE
-
1
]
=
0
;
}
...
...
src/lib/co/src/co_cnf.c
View file @
10beac8d
...
...
@@ -58,7 +58,7 @@ char default_values[][2][200] = {
};
char
*
cnf_get_value
(
const
char
*
name
,
char
*
value
)
char
*
cnf_get_value
(
const
char
*
name
,
char
*
value
,
int
size
)
{
FILE
*
fp
;
char
line
[
400
];
...
...
@@ -84,7 +84,7 @@ char *cnf_get_value( const char *name, char *value)
if
(
cdh_NoCaseStrcmp
(
name
,
item_str
[
0
])
==
0
)
{
strcpy
(
ret_value
,
item_str
[
1
]);
if
(
value
)
str
cpy
(
value
,
ret_valu
e
);
str
ncpy
(
value
,
ret_value
,
siz
e
);
fclose
(
fp
);
return
ret_value
;
}
...
...
@@ -97,7 +97,7 @@ char *cnf_get_value( const char *name, char *value)
if
(
strcmp
(
name
,
default_values
[
i
][
0
])
==
0
)
{
strcpy
(
ret_value
,
default_values
[
i
][
1
]);
if
(
value
)
str
cpy
(
value
,
ret_valu
e
);
str
ncpy
(
value
,
ret_value
,
siz
e
);
return
ret_value
;
}
}
...
...
src/lib/co/src/co_cnf.h
View file @
10beac8d
...
...
@@ -45,7 +45,7 @@ extern "C" {
#endif
char
*
cnf_get_value
(
const
char
*
name
,
char
*
value
);
char
*
cnf_get_value
(
const
char
*
name
,
char
*
value
,
int
size
);
#ifdef __cplusplus
}
...
...
wb/lib/wb/src/wb_erep.cpp
View file @
10beac8d
...
...
@@ -1184,7 +1184,7 @@ wb_vrep *wb_erep::createVolume(pwr_tStatus *sts, pwr_tVid vid, pwr_tCid cid,
unsigned
int
port
=
0
;
char
socket
[
80
];
cnf_get_value
(
"mysqlSocket"
,
socket
);
cnf_get_value
(
"mysqlSocket"
,
socket
,
sizeof
(
socket
)
);
*
sts
=
lfu_ParseDbmsServer
(
server
,
user
,
password
,
&
port
,
host
);
if
(
EVEN
(
*
sts
))
return
0
;
...
...
wb/lib/wb/src/wb_ldh.cpp
View file @
10beac8d
...
...
@@ -1997,7 +1997,7 @@ ldh_WbLoad( ldh_tSession session, char *loadfile, int ignore_oix)
sts
=
lfu_ParseDbmsServer
(
server
,
user
,
password
,
&
port
,
host
);
if
(
EVEN
(
sts
))
return
sts
;
cnf_get_value
(
"mysqlSocket"
,
socket
);
cnf_get_value
(
"mysqlSocket"
,
socket
,
sizeof
(
socket
)
);
wb_dbms_env
*
env
=
new
wb_dbms_env
();
env
->
create
(
db_name
,
host
,
user
,
password
,
cdh_Low
(
vname
),
port
,
socket
);
...
...
wb/lib/wb/src/wb_lfu.cpp
View file @
10beac8d
...
...
@@ -2907,7 +2907,7 @@ pwr_tStatus lfu_ParseDbmsServer( char *server, char *user, char *password,
char
lserver
[
80
];
if
(
strcmp
(
server
,
""
)
==
0
)
{
if
(
!
cnf_get_value
(
"mysqlServer"
,
lserver
))
{
if
(
!
cnf_get_value
(
"mysqlServer"
,
lserver
,
sizeof
(
lserver
)
))
{
printf
(
"** mysql Server not defined
\n
"
);
return
LDH__NOSERVER
;
}
...
...
wb/lib/wb/src/wb_pvd_pl.cpp
View file @
10beac8d
...
...
@@ -152,7 +152,7 @@ void wb_pvd_pl::createObject( co_procom *pcom, pwr_tOix destoix, int desttype,
pwr_sClass_ProjectReg
*
body
=
(
pwr_sClass_ProjectReg
*
)
m_list
[
oix
].
body
;
// Set default values to project, version and path
cnf_get_value
(
"defaultProjectRoot"
,
defaultpath
);
cnf_get_value
(
"defaultProjectRoot"
,
defaultpath
,
sizeof
(
defaultpath
)
);
cdh_ToLower
(
lowname
,
m_list
[
oix
].
name
);
strcat
(
defaultpath
,
"/"
);
strcat
(
defaultpath
,
lowname
);
...
...
xtt/lib/ge/src/ge_graph_javabean.cpp
View file @
10beac8d
...
...
@@ -1679,7 +1679,7 @@ int Graph::export_javaframe( char *filename, char *bean_name, int applet,
char
codebase
[
200
];
// Create a html file
cnf_get_value
(
"appletCodebase"
,
codebase
);
cnf_get_value
(
"appletCodebase"
,
codebase
,
sizeof
(
codebase
)
);
grow_MeasureJavaBean
(
grow
->
ctx
,
&
x1
,
&
x0
,
&
y1
,
&
y0
);
fp
.
open
(
fname
);
...
...
@@ -1981,7 +1981,7 @@ int Graph::export_gejava( char *filename, char *bean_name, int applet, int html)
char
codebase
[
200
];
// Create a html file
cnf_get_value
(
"appletCodebase"
,
codebase
);
cnf_get_value
(
"appletCodebase"
,
codebase
,
sizeof
(
codebase
)
);
grow_SetJavaFrame
(
grow
->
ctx
,
&
x1
,
&
x0
,
&
y1
,
&
y0
);
fp
.
open
(
fname
);
...
...
xtt/lib/ge/src/ge_graph_web.cpp
View file @
10beac8d
...
...
@@ -136,7 +136,7 @@ int Graph::generate_web( ldh_tSesContext ldhses)
ge_get_systemname
(
sname
);
// Get codebase for applets from global config file
cnf_get_value
(
"appletCodebase"
,
codebase
);
cnf_get_value
(
"appletCodebase"
,
codebase
,
sizeof
(
codebase
)
);
// Find the WebHandler object
...
...
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