Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
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
nexedi
MariaDB
Commits
9f2fc33f
Commit
9f2fc33f
authored
Oct 19, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1
into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1
parents
f0a6f2b6
4c0b22b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
24 deletions
+27
-24
ndb/include/mgmcommon/LocalConfig.hpp
ndb/include/mgmcommon/LocalConfig.hpp
+2
-2
ndb/src/common/mgmcommon/LocalConfig.cpp
ndb/src/common/mgmcommon/LocalConfig.cpp
+25
-22
No files found.
ndb/include/mgmcommon/LocalConfig.hpp
View file @
9f2fc33f
...
...
@@ -53,14 +53,14 @@ struct LocalConfig {
void
printUsage
()
const
;
void
setError
(
int
lineNumber
,
const
char
*
_msg
);
bool
readConnectString
(
const
char
*
);
bool
readConnectString
(
const
char
*
,
const
char
*
info
);
bool
readFile
(
const
char
*
file
,
bool
&
fopenError
);
bool
parseLine
(
char
*
line
,
int
lineNumber
);
bool
parseNodeId
(
const
char
*
buf
);
bool
parseHostName
(
const
char
*
buf
);
bool
parseFileName
(
const
char
*
buf
);
bool
parseString
(
const
char
*
buf
,
char
*
line
);
bool
parseString
(
const
char
*
buf
,
BaseString
&
err
);
};
#endif // LocalConfig_H
...
...
ndb/src/common/mgmcommon/LocalConfig.cpp
View file @
9f2fc33f
...
...
@@ -40,7 +40,7 @@ LocalConfig::init(const char *connectString,
//1. Check connectString
if
(
connectString
!=
0
&&
connectString
[
0
]
!=
0
){
if
(
readConnectString
(
connectString
)){
if
(
readConnectString
(
connectString
,
"connect string"
)){
return
true
;
}
return
false
;
...
...
@@ -59,7 +59,7 @@ LocalConfig::init(const char *connectString,
char
buf
[
255
];
if
(
NdbEnv_GetEnv
(
"NDB_CONNECTSTRING"
,
buf
,
sizeof
(
buf
))
&&
strlen
(
buf
)
!=
0
){
if
(
readConnectString
(
buf
)){
if
(
readConnectString
(
buf
,
"NDB_CONNECTSTRING"
)){
return
true
;
}
return
false
;
...
...
@@ -91,7 +91,7 @@ LocalConfig::init(const char *connectString,
{
char
buf
[
256
];
snprintf
(
buf
,
sizeof
(
buf
),
"host=localhost:%s"
,
NDB_BASE_PORT
);
if
(
readConnectString
(
buf
))
if
(
readConnectString
(
buf
,
"default connect string"
))
return
true
;
}
...
...
@@ -109,8 +109,10 @@ void LocalConfig::setError(int lineNumber, const char * _msg) {
}
void
LocalConfig
::
printError
()
const
{
ndbout
<<
"Local configuration error"
<<
endl
<<
"Line: "
<<
error_line
<<
", "
<<
error_msg
<<
endl
<<
endl
;
ndbout
<<
"Configuration error"
<<
endl
;
if
(
error_line
)
ndbout
<<
"Line: "
<<
error_line
<<
", "
;
ndbout
<<
error_msg
<<
endl
<<
endl
;
}
void
LocalConfig
::
printUsage
()
const
{
...
...
@@ -140,7 +142,7 @@ const char *nodeIdTokens[] = {
const
char
*
hostNameTokens
[]
=
{
"host://%[^:]:%i"
,
"host=%[^:]:%i"
,
"%[^:]:%i"
,
"%[^:
^=^
]:%i"
,
"%s %i"
,
0
};
...
...
@@ -192,7 +194,7 @@ LocalConfig::parseFileName(const char * buf){
}
bool
LocalConfig
::
parseString
(
const
char
*
connectString
,
char
*
line
){
LocalConfig
::
parseString
(
const
char
*
connectString
,
BaseString
&
err
){
char
*
for_strtok
;
char
*
copy
=
strdup
(
connectString
);
NdbAutoPtr
<
char
>
tmp_aptr
(
copy
);
...
...
@@ -212,15 +214,12 @@ LocalConfig::parseString(const char * connectString, char *line){
if
(
found_other
=
parseFileName
(
tok
))
continue
;
if
(
line
)
snprintf
(
line
,
150
,
"Unexpected entry:
\"
%s
\"
"
,
tok
);
err
.
assfmt
(
"Unexpected entry:
\"
%s
\"
"
,
tok
);
return
false
;
}
if
(
!
found_other
)
{
if
(
line
)
snprintf
(
line
,
150
,
"Missing host/file name extry in
\"
%s
\"
"
,
connectString
);
err
.
appfmt
(
"Missing host/file name extry in
\"
%s
\"
"
,
connectString
);
return
false
;
}
...
...
@@ -235,7 +234,8 @@ bool LocalConfig::readFile(const char * filename, bool &fopenError)
FILE
*
file
=
fopen
(
filename
,
"r"
);
if
(
file
==
0
){
snprintf
(
line
,
150
,
"Unable to open local config file: %s"
,
filename
);
snprintf
(
line
,
sizeof
(
line
),
"Unable to open local config file: %s"
,
filename
);
setError
(
0
,
line
);
fopenError
=
true
;
return
false
;
...
...
@@ -243,7 +243,7 @@ bool LocalConfig::readFile(const char * filename, bool &fopenError)
BaseString
theString
;
while
(
fgets
(
line
,
1024
,
file
)){
while
(
fgets
(
line
,
sizeof
(
line
)
,
file
)){
BaseString
tmp
(
line
);
tmp
.
trim
(
"
\t\n\r
"
);
if
(
tmp
.
length
()
>
0
&&
tmp
.
c_str
()[
0
]
!=
'#'
){
...
...
@@ -251,7 +251,7 @@ bool LocalConfig::readFile(const char * filename, bool &fopenError)
break
;
}
}
while
(
fgets
(
line
,
1024
,
file
))
{
while
(
fgets
(
line
,
sizeof
(
line
)
,
file
))
{
BaseString
tmp
(
line
);
tmp
.
trim
(
"
\t\n\r
"
);
if
(
tmp
.
length
()
>
0
&&
tmp
.
c_str
()[
0
]
!=
'#'
){
...
...
@@ -260,11 +260,12 @@ bool LocalConfig::readFile(const char * filename, bool &fopenError)
}
}
bool
return_value
=
parseString
(
theString
.
c_str
(),
line
);
BaseString
err
;
bool
return_value
=
parseString
(
theString
.
c_str
(),
err
);
if
(
!
return_value
)
{
BaseString
tmp
;
tmp
.
assfmt
(
"Reading %s: %s"
,
filename
,
line
);
tmp
.
assfmt
(
"Reading %s: %s"
,
filename
,
err
.
c_str
()
);
setError
(
0
,
tmp
.
c_str
());
}
...
...
@@ -273,12 +274,14 @@ bool LocalConfig::readFile(const char * filename, bool &fopenError)
}
bool
LocalConfig
::
readConnectString
(
const
char
*
connectString
){
char
line
[
150
],
line2
[
150
];
bool
return_value
=
parseString
(
connectString
,
line
);
LocalConfig
::
readConnectString
(
const
char
*
connectString
,
const
char
*
info
){
BaseString
err
;
bool
return_value
=
parseString
(
connectString
,
err
);
if
(
!
return_value
)
{
snprintf
(
line2
,
150
,
"Reading NDB_CONNECTSTRING
\"
%s
\"
: %s"
,
connectString
,
line
);
setError
(
0
,
line2
);
BaseString
err2
;
err2
.
assfmt
(
"Reading %d
\"
%s
\"
: %s"
,
info
,
connectString
,
err
.
c_str
());
setError
(
0
,
err2
.
c_str
());
}
return
return_value
;
}
...
...
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