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
d8c70089
Commit
d8c70089
authored
Dec 17, 2002
by
hf@deer.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merging&testing
parent
c1e69d2c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
16 deletions
+95
-16
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+77
-1
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+2
-0
sql/ha_myisam.cc
sql/ha_myisam.cc
+1
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-1
sql/protocol.cc
sql/protocol.cc
+4
-14
sql/protocol.h
sql/protocol.h
+9
-0
sql/sql_table.cc
sql/sql_table.cc
+1
-0
No files found.
libmysqld/lib_sql.cc
View file @
d8c70089
...
...
@@ -420,6 +420,82 @@ bool send_fields(THD *thd, List<Item> &list, uint flag)
return
1
;
/* purecov: inspected */
}
bool
Protocol
::
send_fields
(
List
<
Item
>
*
list
,
uint
flag
)
{
List_iterator_fast
<
Item
>
it
(
*
list
);
Item
*
item
;
MEM_ROOT
*
alloc
;
MYSQL_FIELD
*
field
,
*
client_field
;
MYSQL
*
mysql
=
thd
->
mysql
;
set_nfields
(
list
->
elements
);
if
(
!
(
mysql
->
result
=
(
MYSQL_RES
*
)
my_malloc
(
sizeof
(
MYSQL_RES
)
+
sizeof
(
ulong
)
*
(
n_fields
+
1
),
MYF
(
MY_WME
|
MY_ZEROFILL
))))
goto
err
;
mysql
->
result
->
lengths
=
(
ulong
*
)(
mysql
->
result
+
1
);
mysql
->
field_count
=
n_fields
;
alloc
=
&
mysql
->
field_alloc
;
field
=
(
MYSQL_FIELD
*
)
alloc_root
(
alloc
,
sizeof
(
MYSQL_FIELD
)
*
n_fields
);
if
(
!
field
)
goto
err
;
client_field
=
field
;
while
((
item
=
it
++
))
{
Send_field
server_field
;
item
->
make_field
(
&
server_field
);
client_field
->
table
=
strdup_root
(
alloc
,
server_field
.
table_name
);
client_field
->
name
=
strdup_root
(
alloc
,
server_field
.
col_name
);
client_field
->
length
=
server_field
.
length
;
client_field
->
type
=
server_field
.
type
;
client_field
->
flags
=
server_field
.
flags
;
client_field
->
decimals
=
server_field
.
decimals
;
if
(
INTERNAL_NUM_FIELD
(
client_field
))
client_field
->
flags
|=
NUM_FLAG
;
if
(
flag
&
2
)
{
char
buff
[
80
];
String
tmp
(
buff
,
sizeof
(
buff
),
default_charset_info
),
*
res
;
if
(
!
(
res
=
item
->
val_str
(
&
tmp
)))
client_field
->
def
=
strdup_root
(
alloc
,
""
);
else
client_field
->
def
=
strdup_root
(
alloc
,
tmp
.
ptr
());
}
else
client_field
->
def
=
0
;
client_field
->
max_length
=
0
;
++
client_field
;
}
mysql
->
result
->
fields
=
field
;
if
(
!
(
mysql
->
result
->
data
=
(
MYSQL_DATA
*
)
my_malloc
(
sizeof
(
MYSQL_DATA
),
MYF
(
MY_WME
|
MY_ZEROFILL
))))
goto
err
;
init_alloc_root
(
&
mysql
->
result
->
data
->
alloc
,
8192
,
0
);
/* Assume rowlength < 8192 */
mysql
->
result
->
data
->
alloc
.
min_malloc
=
sizeof
(
MYSQL_ROWS
);
mysql
->
result
->
data
->
rows
=
0
;
mysql
->
result
->
data
->
fields
=
n_fields
;
mysql
->
result
->
field_count
=
n_fields
;
mysql
->
result
->
data
->
prev_ptr
=
&
mysql
->
result
->
data
->
data
;
mysql
->
result
->
field_alloc
=
mysql
->
field_alloc
;
mysql
->
result
->
current_field
=
0
;
mysql
->
result
->
current_row
=
0
;
return
0
;
err:
send_error
(
thd
,
ER_OUT_OF_RESOURCES
);
/* purecov: inspected */
return
1
;
/* purecov: inspected */
}
/* Get the length of next field. Change parameter to point at fieldstart */
static
ulong
net_field_length
(
uchar
**
packet
)
...
...
@@ -542,7 +618,7 @@ send_eof(THD *thd, bool no_flush)
}
int
embedded_send_row
(
THD
*
thd
,
int
n_fields
,
char
*
data
,
int
data_len
)
int
embedded_send_row
(
THD
*
thd
,
int
n_fields
,
c
onst
c
har
*
data
,
int
data_len
)
{
MYSQL
*
mysql
=
thd
->
mysql
;
MYSQL_DATA
*
result
=
mysql
->
result
->
data
;
...
...
sql/ha_berkeley.cc
View file @
d8c70089
...
...
@@ -255,6 +255,7 @@ int berkeley_show_logs(Protocol *protocol)
/* Error is 0 here */
if
(
all_logs
)
{
protocol
->
set_nfields
(
3
);
for
(
a
=
all_logs
,
f
=
free_logs
;
*
a
;
++
a
)
{
protocol
->
prepare_for_resend
();
...
...
@@ -2075,6 +2076,7 @@ static void print_msg(THD *thd, const char *table_name, const char *op_name,
msgbuf
[
sizeof
(
msgbuf
)
-
1
]
=
0
;
// healthy paranoia
DBUG_PRINT
(
msg_type
,(
"message: %s"
,
msgbuf
));
protocol
->
set_nfields
(
4
);
protocol
->
prepare_for_resend
();
protocol
->
store
(
table_name
);
protocol
->
store
(
op_name
);
...
...
sql/ha_myisam.cc
View file @
d8c70089
...
...
@@ -76,6 +76,7 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
}
length
=
(
uint
)
(
strxmov
(
name
,
param
->
db_name
,
"."
,
param
->
table_name
,
NullS
)
-
name
);
protocol
->
set_nfields
(
4
);
protocol
->
prepare_for_resend
();
protocol
->
store
(
name
,
length
);
protocol
->
store
(
param
->
op_name
);
...
...
sql/mysql_priv.h
View file @
d8c70089
...
...
@@ -880,7 +880,7 @@ inline void mark_as_null_row(TABLE *table)
}
#ifdef EMBEDDED_LIBRARY
int
embedded_send_row
(
THD
*
thd
,
int
n_fields
,
char
*
data
,
int
data_len
);
int
embedded_send_row
(
THD
*
thd
,
int
n_fields
,
c
onst
c
har
*
data
,
int
data_len
);
#define SEND_ROW(thd, n_fields, data, data_len)\
embedded_send_row(thd, n_fields, data, data_len)
#else
...
...
sql/protocol.cc
View file @
d8c70089
...
...
@@ -455,19 +455,6 @@ char *net_store_data(char *to,longlong from)
Function called by my_net_init() to set some check variables
*/
extern
"C"
{
void
my_net_local_init
(
NET
*
net
)
{
net
->
max_packet
=
(
uint
)
global_system_variables
.
net_buffer_length
;
net
->
read_timeout
=
(
uint
)
global_system_variables
.
net_read_timeout
;
net
->
write_timeout
=
(
uint
)
global_system_variables
.
net_write_timeout
;
net
->
retry_count
=
(
uint
)
global_system_variables
.
net_retry_count
;
net
->
max_packet_size
=
max
(
global_system_variables
.
net_buffer_length
,
global_system_variables
.
max_allowed_packet
);
}
}
/*****************************************************************************
Default Protocol functions
*****************************************************************************/
...
...
@@ -504,6 +491,7 @@ void Protocol::init(THD *thd_arg)
1 Error (Note that in this case the error is not sent to the client)
*/
#ifndef EMBEDDED_LIBRARY
bool
Protocol
::
send_fields
(
List
<
Item
>
*
list
,
uint
flag
)
{
List_iterator_fast
<
Item
>
it
(
*
list
);
...
...
@@ -586,11 +574,12 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
DBUG_RETURN
(
1
);
/* purecov: inspected */
}
#endif
bool
Protocol
::
write
()
{
DBUG_ENTER
(
"Protocol::write"
);
DBUG_RETURN
(
my_net_write
(
&
thd
->
net
,
packet
->
ptr
(),
packet
->
length
()));
DBUG_RETURN
(
SEND_ROW
(
thd
,
n_fields
,
packet
->
ptr
(),
packet
->
length
()));
}
...
...
@@ -828,6 +817,7 @@ bool Protocol_simple::store_time(TIME *tm)
bool
Protocol_prep
::
prepare_for_send
(
List
<
Item
>
*
item_list
)
{
field_count
=
item_list
->
elements
;
set_nfields
(
item_list
->
elements
);
bit_fields
=
(
field_count
+
3
)
/
8
;
if
(
packet
->
alloc
(
bit_fields
))
return
1
;
...
...
sql/protocol.h
View file @
d8c70089
...
...
@@ -33,6 +33,9 @@ class Protocol
#ifndef DEBUG_OFF
enum
enum_field_types
*
field_types
;
#endif
#ifdef EMBEDDED_LIBRARY
uint
n_fields
;
#endif
public:
CONVERT
*
convert
;
...
...
@@ -52,6 +55,12 @@ class Protocol
{
return
store_longlong
((
longlong
)
from
,
0
);
}
inline
bool
store
(
ulonglong
from
)
{
return
store_longlong
((
longlong
)
from
,
1
);
}
#ifdef EMBEDDED_LIBRARY
inline
void
set_nfields
(
uint
fields_count
)
{
n_fields
=
fields_count
;
}
#else
inline
void
set_nfields
(
uint
fields_count
)
{}
#endif
virtual
bool
prepare_for_send
(
List
<
Item
>
*
item_list
)
{
return
0
;}
virtual
void
prepare_for_resend
()
=
0
;
...
...
sql/sql_table.cc
View file @
d8c70089
...
...
@@ -1032,6 +1032,7 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table,
{
Protocol
*
protocol
=
thd
->
protocol
;
protocol
->
set_nfields
(
4
);
protocol
->
prepare_for_resend
();
protocol
->
store
(
table
->
alias
);
protocol
->
store
((
char
*
)
operator_name
);
...
...
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