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
7f5d2213
Commit
7f5d2213
authored
Jun 15, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename: store_to_string -> store_to_protocol_packet
parent
561ea7c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
48 deletions
+57
-48
server-tools/instance-manager/commands.cc
server-tools/instance-manager/commands.cc
+31
-29
server-tools/instance-manager/protocol.cc
server-tools/instance-manager/protocol.cc
+23
-16
server-tools/instance-manager/protocol.h
server-tools/instance-manager/protocol.h
+3
-3
No files found.
server-tools/instance-manager/commands.cc
View file @
7f5d2213
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
DESCRIPTION
DESCRIPTION
Function to add a string to the buffer. It is different from
Function to add a string to the buffer. It is different from
store_to_
string
, which is used in the protocol.cc. The last
store_to_
protocol_packet
, which is used in the protocol.cc. The last
one also stores the length of the string in a special way.
one also stores the length of the string in a special way.
This is required for MySQL client/server protocol support only.
This is required for MySQL client/server protocol support only.
...
@@ -104,11 +104,12 @@ int Show_instances::execute(struct st_net *net, ulong connection_id)
...
@@ -104,11 +104,12 @@ int Show_instances::execute(struct st_net *net, ulong connection_id)
while
((
instance
=
iterator
.
next
()))
while
((
instance
=
iterator
.
next
()))
{
{
position
=
0
;
position
=
0
;
store_to_string
(
&
send_buff
,
instance
->
options
.
instance_name
,
&
position
);
store_to_protocol_packet
(
&
send_buff
,
instance
->
options
.
instance_name
,
&
position
);
if
(
instance
->
is_running
())
if
(
instance
->
is_running
())
store_to_
string
(
&
send_buff
,
(
char
*
)
"online"
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
"online"
,
&
position
);
else
else
store_to_
string
(
&
send_buff
,
(
char
*
)
"offline"
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
"offline"
,
&
position
);
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
goto
err
;
goto
err
;
}
}
...
@@ -199,18 +200,19 @@ int Show_instance_status::execute(struct st_net *net,
...
@@ -199,18 +200,19 @@ int Show_instance_status::execute(struct st_net *net,
{
{
Instance
*
instance
;
Instance
*
instance
;
store_to_
string
(
&
send_buff
,
(
char
*
)
instance_name
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
instance_name
,
&
position
);
if
(
!
(
instance
=
instance_map
->
find
(
instance_name
,
strlen
(
instance_name
))))
if
(
!
(
instance
=
instance_map
->
find
(
instance_name
,
strlen
(
instance_name
))))
goto
err
;
goto
err
;
if
(
instance
->
is_running
())
if
(
instance
->
is_running
())
store_to_
string
(
&
send_buff
,
(
char
*
)
"online"
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
"online"
,
&
position
);
else
else
store_to_
string
(
&
send_buff
,
(
char
*
)
"offline"
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
"offline"
,
&
position
);
if
(
instance
->
options
.
mysqld_version
)
if
(
instance
->
options
.
mysqld_version
)
store_to_string
(
&
send_buff
,
instance
->
options
.
mysqld_version
,
&
position
);
store_to_protocol_packet
(
&
send_buff
,
instance
->
options
.
mysqld_version
,
&
position
);
else
else
store_to_
string
(
&
send_buff
,
(
char
*
)
"unknown"
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
"unknown"
,
&
position
);
if
(
send_buff
.
is_error
()
||
if
(
send_buff
.
is_error
()
||
...
@@ -272,17 +274,17 @@ int Show_instance_options::execute(struct st_net *net, ulong connection_id)
...
@@ -272,17 +274,17 @@ int Show_instance_options::execute(struct st_net *net, ulong connection_id)
if
(
!
(
instance
=
instance_map
->
find
(
instance_name
,
strlen
(
instance_name
))))
if
(
!
(
instance
=
instance_map
->
find
(
instance_name
,
strlen
(
instance_name
))))
goto
err
;
goto
err
;
store_to_
string
(
&
send_buff
,
(
char
*
)
"instance_name"
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
"instance_name"
,
&
position
);
store_to_
string
(
&
send_buff
,
(
char
*
)
instance_name
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
instance_name
,
&
position
);
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
goto
err
;
goto
err
;
if
((
instance
->
options
.
mysqld_path
))
if
((
instance
->
options
.
mysqld_path
))
{
{
position
=
0
;
position
=
0
;
store_to_
string
(
&
send_buff
,
(
char
*
)
"mysqld-path"
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
"mysqld-path"
,
&
position
);
store_to_
string
(
&
send_buff
,
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
instance
->
options
.
mysqld_path
,
(
char
*
)
instance
->
options
.
mysqld_path
,
&
position
);
&
position
);
if
(
send_buff
.
is_error
()
||
if
(
send_buff
.
is_error
()
||
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
goto
err
;
goto
err
;
...
@@ -291,8 +293,8 @@ int Show_instance_options::execute(struct st_net *net, ulong connection_id)
...
@@ -291,8 +293,8 @@ int Show_instance_options::execute(struct st_net *net, ulong connection_id)
if
((
instance
->
options
.
nonguarded
))
if
((
instance
->
options
.
nonguarded
))
{
{
position
=
0
;
position
=
0
;
store_to_
string
(
&
send_buff
,
(
char
*
)
"nonguarded"
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
"nonguarded"
,
&
position
);
store_to_
string
(
&
send_buff
,
""
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
""
,
&
position
);
if
(
send_buff
.
is_error
()
||
if
(
send_buff
.
is_error
()
||
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
goto
err
;
goto
err
;
...
@@ -310,15 +312,15 @@ int Show_instance_options::execute(struct st_net *net, ulong connection_id)
...
@@ -310,15 +312,15 @@ int Show_instance_options::execute(struct st_net *net, ulong connection_id)
if
(
option_value
!=
NULL
)
if
(
option_value
!=
NULL
)
{
{
*
option_value
=
0
;
*
option_value
=
0
;
store_to_
string
(
&
send_buff
,
tmp_option
+
2
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
tmp_option
+
2
,
&
position
);
store_to_
string
(
&
send_buff
,
option_value
+
1
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
option_value
+
1
,
&
position
);
/* join name and the value into the same option again */
/* join name and the value into the same option again */
*
option_value
=
'='
;
*
option_value
=
'='
;
}
}
else
else
{
{
store_to_
string
(
&
send_buff
,
tmp_option
+
2
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
tmp_option
+
2
,
&
position
);
store_to_
string
(
&
send_buff
,
""
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
""
,
&
position
);
}
}
if
(
send_buff
.
is_error
()
||
if
(
send_buff
.
is_error
()
||
...
@@ -481,7 +483,7 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
...
@@ -481,7 +483,7 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
char
*
bf
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
buff_size
);
char
*
bf
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
buff_size
);
if
((
read_len
=
my_read
(
fd
,
bf
,
buff_size
,
MYF
(
0
)))
<
0
)
if
((
read_len
=
my_read
(
fd
,
bf
,
buff_size
,
MYF
(
0
)))
<
0
)
return
ER_READ_FILE
;
return
ER_READ_FILE
;
store_to_
string
(
&
send_buff
,
(
char
*
)
bf
,
&
position
,
read_len
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
bf
,
&
position
,
read_len
);
close
(
fd
);
close
(
fd
);
}
}
else
else
...
@@ -596,19 +598,19 @@ int Show_instance_log_files::execute(struct st_net *net, ulong connection_id)
...
@@ -596,19 +598,19 @@ int Show_instance_log_files::execute(struct st_net *net, ulong connection_id)
position
=
0
;
position
=
0
;
/* store the type of the log in the send buffer */
/* store the type of the log in the send buffer */
store_to_
string
(
&
send_buff
,
log_files
->
name
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
log_files
->
name
,
&
position
);
if
(
stat
(
log_files
->
value
,
&
file_stat
))
if
(
stat
(
log_files
->
value
,
&
file_stat
))
{
{
store_to_
string
(
&
send_buff
,
""
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
""
,
&
position
);
store_to_
string
(
&
send_buff
,
(
char
*
)
"0"
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
"0"
,
&
position
);
}
}
else
if
(
S_ISREG
(
file_stat
.
st_mode
))
else
if
(
S_ISREG
(
file_stat
.
st_mode
))
{
{
store_to_
string
(
&
send_buff
,
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
log_files
->
value
,
(
char
*
)
log_files
->
value
,
&
position
);
&
position
);
int10_to_str
(
file_stat
.
st_size
,
buff
,
10
);
int10_to_str
(
file_stat
.
st_size
,
buff
,
10
);
store_to_
string
(
&
send_buff
,
(
char
*
)
buff
,
&
position
);
store_to_
protocol_packet
(
&
send_buff
,
(
char
*
)
buff
,
&
position
);
}
}
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
if
(
my_net_write
(
net
,
send_buff
.
buffer
,
(
uint
)
position
))
...
...
server-tools/instance-manager/protocol.cc
View file @
7f5d2213
...
@@ -58,7 +58,7 @@ int net_send_ok(struct st_net *net, unsigned long connection_id,
...
@@ -58,7 +58,7 @@ int net_send_ok(struct st_net *net, unsigned long connection_id,
if
(
message
!=
NULL
)
if
(
message
!=
NULL
)
{
{
buff
.
reserve
(
position
,
9
+
strlen
(
message
));
buff
.
reserve
(
position
,
9
+
strlen
(
message
));
store_to_
string
(
&
buff
,
message
,
&
position
);
store_to_
protocol_packet
(
&
buff
,
message
,
&
position
);
}
}
return
my_net_write
(
net
,
buff
.
buffer
,
position
)
||
net_flush
(
net
);
return
my_net_write
(
net
,
buff
.
buffer
,
position
)
||
net_flush
(
net
);
...
@@ -117,8 +117,8 @@ char *net_store_length(char *pkg, uint length)
...
@@ -117,8 +117,8 @@ char *net_store_length(char *pkg, uint length)
}
}
int
store_to_
string
(
Buffer
*
buf
,
const
char
*
string
,
uint
*
position
,
int
store_to_
protocol_packet
(
Buffer
*
buf
,
const
char
*
string
,
uint
*
position
,
uint
string_len
)
uint
string_len
)
{
{
uint
currpos
;
uint
currpos
;
...
@@ -137,12 +137,12 @@ int store_to_string(Buffer *buf, const char *string, uint *position,
...
@@ -137,12 +137,12 @@ int store_to_string(Buffer *buf, const char *string, uint *position,
}
}
int
store_to_
string
(
Buffer
*
buf
,
const
char
*
string
,
uint
*
position
)
int
store_to_
protocol_packet
(
Buffer
*
buf
,
const
char
*
string
,
uint
*
position
)
{
{
uint
string_len
;
uint
string_len
;
string_len
=
strlen
(
string
);
string_len
=
strlen
(
string
);
return
store_to_
string
(
buf
,
string
,
position
,
string_len
);
return
store_to_
protocol_packet
(
buf
,
string
,
position
,
string_len
);
}
}
...
@@ -176,21 +176,28 @@ int send_fields(struct st_net *net, LIST *fields)
...
@@ -176,21 +176,28 @@ int send_fields(struct st_net *net, LIST *fields)
position
=
0
;
position
=
0
;
field
=
(
NAME_WITH_LENGTH
*
)
tmp
->
data
;
field
=
(
NAME_WITH_LENGTH
*
)
tmp
->
data
;
store_to_string
(
&
send_buff
,
(
char
*
)
""
,
&
position
);
/* catalog name */
store_to_protocol_packet
(
&
send_buff
,
store_to_string
(
&
send_buff
,
(
char
*
)
""
,
&
position
);
/* db name */
(
char
*
)
""
,
&
position
);
/* catalog name */
store_to_string
(
&
send_buff
,
(
char
*
)
""
,
&
position
);
/* table name */
store_to_protocol_packet
(
&
send_buff
,
store_to_string
(
&
send_buff
,
(
char
*
)
""
,
&
position
);
/* table name alias */
(
char
*
)
""
,
&
position
);
/* db name */
store_to_string
(
&
send_buff
,
field
->
name
,
&
position
);
/* column name */
store_to_protocol_packet
(
&
send_buff
,
store_to_string
(
&
send_buff
,
field
->
name
,
&
position
);
/* column name alias */
(
char
*
)
""
,
&
position
);
/* table name */
store_to_protocol_packet
(
&
send_buff
,
(
char
*
)
""
,
&
position
);
/* table name alias */
store_to_protocol_packet
(
&
send_buff
,
field
->
name
,
&
position
);
/* column name */
store_to_protocol_packet
(
&
send_buff
,
field
->
name
,
&
position
);
/* column name alias */
send_buff
.
reserve
(
position
,
12
);
send_buff
.
reserve
(
position
,
12
);
if
(
send_buff
.
is_error
())
if
(
send_buff
.
is_error
())
goto
err
;
goto
err
;
send_buff
.
buffer
[
position
++
]
=
12
;
send_buff
.
buffer
[
position
++
]
=
12
;
int2store
(
send_buff
.
buffer
+
position
,
1
);
/* charsetnr */
int2store
(
send_buff
.
buffer
+
position
,
1
);
/* charsetnr */
int4store
(
send_buff
.
buffer
+
position
+
2
,
field
->
length
);
/* field length */
int4store
(
send_buff
.
buffer
+
position
+
2
,
send_buff
.
buffer
[
position
+
6
]
=
FIELD_TYPE_STRING
;
/* type */
field
->
length
);
/* field length */
int2store
(
send_buff
.
buffer
+
position
+
7
,
0
);
/* flags */
send_buff
.
buffer
[
position
+
6
]
=
FIELD_TYPE_STRING
;
/* type */
send_buff
.
buffer
[
position
+
9
]
=
(
char
)
0
;
/* decimals */
int2store
(
send_buff
.
buffer
+
position
+
7
,
0
);
/* flags */
send_buff
.
buffer
[
position
+
9
]
=
(
char
)
0
;
/* decimals */
send_buff
.
buffer
[
position
+
10
]
=
0
;
send_buff
.
buffer
[
position
+
10
]
=
0
;
send_buff
.
buffer
[
position
+
11
]
=
0
;
send_buff
.
buffer
[
position
+
11
]
=
0
;
position
+=
12
;
position
+=
12
;
...
...
server-tools/instance-manager/protocol.h
View file @
7f5d2213
...
@@ -41,10 +41,10 @@ int send_fields(struct st_net *net, LIST *fields);
...
@@ -41,10 +41,10 @@ int send_fields(struct st_net *net, LIST *fields);
char
*
net_store_length
(
char
*
pkg
,
uint
length
);
char
*
net_store_length
(
char
*
pkg
,
uint
length
);
int
store_to_
string
(
Buffer
*
buf
,
const
char
*
string
,
uint
*
position
);
int
store_to_
protocol_packet
(
Buffer
*
buf
,
const
char
*
string
,
uint
*
position
);
int
store_to_
string
(
Buffer
*
buf
,
const
char
*
string
,
uint
*
position
,
int
store_to_
protocol_packet
(
Buffer
*
buf
,
const
char
*
string
,
uint
*
position
,
uint
string_len
);
uint
string_len
);
int
send_eof
(
struct
st_net
*
net
);
int
send_eof
(
struct
st_net
*
net
);
...
...
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