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
8efe1b1f
Commit
8efe1b1f
authored
Mar 09, 2007
by
guilhem@gbichot3.local
Browse files
Options
Browse Files
Download
Plain Diff
manual merge
parents
b641bd7b
be389f62
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
69 deletions
+69
-69
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+6
-6
sql/protocol.cc
sql/protocol.cc
+34
-34
sql/protocol.h
sql/protocol.h
+6
-6
sql/set_var.cc
sql/set_var.cc
+2
-2
sql/sql_class.cc
sql/sql_class.cc
+3
-3
sql/sql_class.h
sql/sql_class.h
+2
-2
sql/sql_prepare.cc
sql/sql_prepare.cc
+16
-16
No files found.
libmysqld/lib_sql.cc
View file @
8efe1b1f
...
@@ -822,7 +822,7 @@ int Protocol::begin_dataset()
...
@@ -822,7 +822,7 @@ int Protocol::begin_dataset()
remove last row of current recordset
remove last row of current recordset
SYNOPSIS
SYNOPSIS
Protocol_
simple
::remove_last_row()
Protocol_
text
::remove_last_row()
NOTES
NOTES
does the loop from the beginning of the current recordset to
does the loop from the beginning of the current recordset to
...
@@ -830,12 +830,12 @@ int Protocol::begin_dataset()
...
@@ -830,12 +830,12 @@ int Protocol::begin_dataset()
Not supposed to be frequently called.
Not supposed to be frequently called.
*/
*/
void
Protocol_
simple
::
remove_last_row
()
void
Protocol_
text
::
remove_last_row
()
{
{
MYSQL_DATA
*
data
=
thd
->
cur_data
;
MYSQL_DATA
*
data
=
thd
->
cur_data
;
MYSQL_ROWS
**
last_row_hook
=
&
data
->
data
;
MYSQL_ROWS
**
last_row_hook
=
&
data
->
data
;
uint
count
=
data
->
rows
;
uint
count
=
data
->
rows
;
DBUG_ENTER
(
"Protocol_
simple
::remove_last_row"
);
DBUG_ENTER
(
"Protocol_
text
::remove_last_row"
);
while
(
--
count
)
while
(
--
count
)
last_row_hook
=
&
(
*
last_row_hook
)
->
next
;
last_row_hook
=
&
(
*
last_row_hook
)
->
next
;
...
@@ -964,7 +964,7 @@ bool Protocol::write()
...
@@ -964,7 +964,7 @@ bool Protocol::write()
return
false
;
return
false
;
}
}
bool
Protocol_
prep
::
write
()
bool
Protocol_
binary
::
write
()
{
{
MYSQL_ROWS
*
cur
;
MYSQL_ROWS
*
cur
;
MYSQL_DATA
*
data
=
thd
->
cur_data
;
MYSQL_DATA
*
data
=
thd
->
cur_data
;
...
@@ -1031,7 +1031,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
...
@@ -1031,7 +1031,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
}
}
void
Protocol_
simple
::
prepare_for_resend
()
void
Protocol_
text
::
prepare_for_resend
()
{
{
MYSQL_ROWS
*
cur
;
MYSQL_ROWS
*
cur
;
MYSQL_DATA
*
data
=
thd
->
cur_data
;
MYSQL_DATA
*
data
=
thd
->
cur_data
;
...
@@ -1056,7 +1056,7 @@ void Protocol_simple::prepare_for_resend()
...
@@ -1056,7 +1056,7 @@ void Protocol_simple::prepare_for_resend()
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
bool
Protocol_
simple
::
store_null
()
bool
Protocol_
text
::
store_null
()
{
{
*
(
next_field
++
)
=
NULL
;
*
(
next_field
++
)
=
NULL
;
++
next_mysql_field
;
++
next_mysql_field
;
...
...
sql/protocol.cc
View file @
8efe1b1f
...
@@ -35,7 +35,7 @@ static void write_eof_packet(THD *thd, NET *net);
...
@@ -35,7 +35,7 @@ static void write_eof_packet(THD *thd, NET *net);
#ifndef EMBEDDED_LIBRARY
#ifndef EMBEDDED_LIBRARY
bool
Protocol
::
net_store_data
(
const
char
*
from
,
uint
length
)
bool
Protocol
::
net_store_data
(
const
char
*
from
,
uint
length
)
#else
#else
bool
Protocol_
prep
::
net_store_data
(
const
char
*
from
,
uint
length
)
bool
Protocol_
binary
::
net_store_data
(
const
char
*
from
,
uint
length
)
#endif
#endif
{
{
ulong
packet_length
=
packet
->
length
();
ulong
packet_length
=
packet
->
length
();
...
@@ -557,7 +557,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
...
@@ -557,7 +557,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
Item
*
item
;
Item
*
item
;
char
buff
[
80
];
char
buff
[
80
];
String
tmp
((
char
*
)
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
String
tmp
((
char
*
)
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
Protocol_
simple
prot
(
thd
);
Protocol_
text
prot
(
thd
);
String
*
local_packet
=
prot
.
storage_packet
();
String
*
local_packet
=
prot
.
storage_packet
();
CHARSET_INFO
*
thd_charset
=
thd
->
variables
.
character_set_results
;
CHARSET_INFO
*
thd_charset
=
thd
->
variables
.
character_set_results
;
DBUG_ENTER
(
"send_fields"
);
DBUG_ENTER
(
"send_fields"
);
...
@@ -760,7 +760,7 @@ bool Protocol::store(I_List<i_string>* str_list)
...
@@ -760,7 +760,7 @@ bool Protocol::store(I_List<i_string>* str_list)
****************************************************************************/
****************************************************************************/
#ifndef EMBEDDED_LIBRARY
#ifndef EMBEDDED_LIBRARY
void
Protocol_
simple
::
prepare_for_resend
()
void
Protocol_
text
::
prepare_for_resend
()
{
{
packet
->
length
(
0
);
packet
->
length
(
0
);
#ifndef DBUG_OFF
#ifndef DBUG_OFF
...
@@ -768,7 +768,7 @@ void Protocol_simple::prepare_for_resend()
...
@@ -768,7 +768,7 @@ void Protocol_simple::prepare_for_resend()
#endif
#endif
}
}
bool
Protocol_
simple
::
store_null
()
bool
Protocol_
text
::
store_null
()
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
field_pos
++
;
field_pos
++
;
...
@@ -801,7 +801,7 @@ bool Protocol::store_string_aux(const char *from, uint length,
...
@@ -801,7 +801,7 @@ bool Protocol::store_string_aux(const char *from, uint length,
}
}
bool
Protocol_
simple
::
store
(
const
char
*
from
,
uint
length
,
bool
Protocol_
text
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
fromcs
,
CHARSET_INFO
*
tocs
)
CHARSET_INFO
*
fromcs
,
CHARSET_INFO
*
tocs
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
...
@@ -817,7 +817,7 @@ bool Protocol_simple::store(const char *from, uint length,
...
@@ -817,7 +817,7 @@ bool Protocol_simple::store(const char *from, uint length,
}
}
bool
Protocol_
simple
::
store
(
const
char
*
from
,
uint
length
,
bool
Protocol_
text
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
fromcs
)
CHARSET_INFO
*
fromcs
)
{
{
CHARSET_INFO
*
tocs
=
this
->
thd
->
variables
.
character_set_results
;
CHARSET_INFO
*
tocs
=
this
->
thd
->
variables
.
character_set_results
;
...
@@ -834,7 +834,7 @@ bool Protocol_simple::store(const char *from, uint length,
...
@@ -834,7 +834,7 @@ bool Protocol_simple::store(const char *from, uint length,
}
}
bool
Protocol_
simple
::
store_tiny
(
longlong
from
)
bool
Protocol_
text
::
store_tiny
(
longlong
from
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
field_types
[
field_pos
]
==
MYSQL_TYPE_TINY
);
DBUG_ASSERT
(
field_types
==
0
||
field_types
[
field_pos
]
==
MYSQL_TYPE_TINY
);
...
@@ -846,7 +846,7 @@ bool Protocol_simple::store_tiny(longlong from)
...
@@ -846,7 +846,7 @@ bool Protocol_simple::store_tiny(longlong from)
}
}
bool
Protocol_
simple
::
store_short
(
longlong
from
)
bool
Protocol_
text
::
store_short
(
longlong
from
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -860,7 +860,7 @@ bool Protocol_simple::store_short(longlong from)
...
@@ -860,7 +860,7 @@ bool Protocol_simple::store_short(longlong from)
}
}
bool
Protocol_
simple
::
store_long
(
longlong
from
)
bool
Protocol_
text
::
store_long
(
longlong
from
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -874,7 +874,7 @@ bool Protocol_simple::store_long(longlong from)
...
@@ -874,7 +874,7 @@ bool Protocol_simple::store_long(longlong from)
}
}
bool
Protocol_
simple
::
store_longlong
(
longlong
from
,
bool
unsigned_flag
)
bool
Protocol_
text
::
store_longlong
(
longlong
from
,
bool
unsigned_flag
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -889,7 +889,7 @@ bool Protocol_simple::store_longlong(longlong from, bool unsigned_flag)
...
@@ -889,7 +889,7 @@ bool Protocol_simple::store_longlong(longlong from, bool unsigned_flag)
}
}
bool
Protocol_
simple
::
store_decimal
(
const
my_decimal
*
d
)
bool
Protocol_
text
::
store_decimal
(
const
my_decimal
*
d
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -903,7 +903,7 @@ bool Protocol_simple::store_decimal(const my_decimal *d)
...
@@ -903,7 +903,7 @@ bool Protocol_simple::store_decimal(const my_decimal *d)
}
}
bool
Protocol_
simple
::
store
(
float
from
,
uint32
decimals
,
String
*
buffer
)
bool
Protocol_
text
::
store
(
float
from
,
uint32
decimals
,
String
*
buffer
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -915,7 +915,7 @@ bool Protocol_simple::store(float from, uint32 decimals, String *buffer)
...
@@ -915,7 +915,7 @@ bool Protocol_simple::store(float from, uint32 decimals, String *buffer)
}
}
bool
Protocol_
simple
::
store
(
double
from
,
uint32
decimals
,
String
*
buffer
)
bool
Protocol_
text
::
store
(
double
from
,
uint32
decimals
,
String
*
buffer
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -927,7 +927,7 @@ bool Protocol_simple::store(double from, uint32 decimals, String *buffer)
...
@@ -927,7 +927,7 @@ bool Protocol_simple::store(double from, uint32 decimals, String *buffer)
}
}
bool
Protocol_
simple
::
store
(
Field
*
field
)
bool
Protocol_
text
::
store
(
Field
*
field
)
{
{
if
(
field
->
is_null
())
if
(
field
->
is_null
())
return
store_null
();
return
store_null
();
...
@@ -961,7 +961,7 @@ bool Protocol_simple::store(Field *field)
...
@@ -961,7 +961,7 @@ bool Protocol_simple::store(Field *field)
*/
*/
bool
Protocol_
simple
::
store
(
TIME
*
tm
)
bool
Protocol_
text
::
store
(
TIME
*
tm
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -984,7 +984,7 @@ bool Protocol_simple::store(TIME *tm)
...
@@ -984,7 +984,7 @@ bool Protocol_simple::store(TIME *tm)
}
}
bool
Protocol_
simple
::
store_date
(
TIME
*
tm
)
bool
Protocol_
text
::
store_date
(
TIME
*
tm
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -1003,7 +1003,7 @@ bool Protocol_simple::store_date(TIME *tm)
...
@@ -1003,7 +1003,7 @@ bool Protocol_simple::store_date(TIME *tm)
we support 0-6 decimals for time.
we support 0-6 decimals for time.
*/
*/
bool
Protocol_
simple
::
store_time
(
TIME
*
tm
)
bool
Protocol_
text
::
store_time
(
TIME
*
tm
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -1043,7 +1043,7 @@ bool Protocol_simple::store_time(TIME *tm)
...
@@ -1043,7 +1043,7 @@ bool Protocol_simple::store_time(TIME *tm)
[..]..[[length]data] data
[..]..[[length]data] data
****************************************************************************/
****************************************************************************/
bool
Protocol_
prep
::
prepare_for_send
(
List
<
Item
>
*
item_list
)
bool
Protocol_
binary
::
prepare_for_send
(
List
<
Item
>
*
item_list
)
{
{
Protocol
::
prepare_for_send
(
item_list
);
Protocol
::
prepare_for_send
(
item_list
);
bit_fields
=
(
field_count
+
9
)
/
8
;
bit_fields
=
(
field_count
+
9
)
/
8
;
...
@@ -1054,7 +1054,7 @@ bool Protocol_prep::prepare_for_send(List<Item> *item_list)
...
@@ -1054,7 +1054,7 @@ bool Protocol_prep::prepare_for_send(List<Item> *item_list)
}
}
void
Protocol_
prep
::
prepare_for_resend
()
void
Protocol_
binary
::
prepare_for_resend
()
{
{
packet
->
length
(
bit_fields
+
1
);
packet
->
length
(
bit_fields
+
1
);
bzero
((
char
*
)
packet
->
ptr
(),
1
+
bit_fields
);
bzero
((
char
*
)
packet
->
ptr
(),
1
+
bit_fields
);
...
@@ -1062,21 +1062,21 @@ void Protocol_prep::prepare_for_resend()
...
@@ -1062,21 +1062,21 @@ void Protocol_prep::prepare_for_resend()
}
}
bool
Protocol_
prep
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
fromcs
)
bool
Protocol_
binary
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
fromcs
)
{
{
CHARSET_INFO
*
tocs
=
thd
->
variables
.
character_set_results
;
CHARSET_INFO
*
tocs
=
thd
->
variables
.
character_set_results
;
field_pos
++
;
field_pos
++
;
return
store_string_aux
(
from
,
length
,
fromcs
,
tocs
);
return
store_string_aux
(
from
,
length
,
fromcs
,
tocs
);
}
}
bool
Protocol_
prep
::
store
(
const
char
*
from
,
uint
length
,
bool
Protocol_
binary
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
fromcs
,
CHARSET_INFO
*
tocs
)
CHARSET_INFO
*
fromcs
,
CHARSET_INFO
*
tocs
)
{
{
field_pos
++
;
field_pos
++
;
return
store_string_aux
(
from
,
length
,
fromcs
,
tocs
);
return
store_string_aux
(
from
,
length
,
fromcs
,
tocs
);
}
}
bool
Protocol_
prep
::
store_null
()
bool
Protocol_
binary
::
store_null
()
{
{
uint
offset
=
(
field_pos
+
2
)
/
8
+
1
,
bit
=
(
1
<<
((
field_pos
+
2
)
&
7
));
uint
offset
=
(
field_pos
+
2
)
/
8
+
1
,
bit
=
(
1
<<
((
field_pos
+
2
)
&
7
));
/* Room for this as it's allocated in prepare_for_send */
/* Room for this as it's allocated in prepare_for_send */
...
@@ -1087,7 +1087,7 @@ bool Protocol_prep::store_null()
...
@@ -1087,7 +1087,7 @@ bool Protocol_prep::store_null()
}
}
bool
Protocol_
prep
::
store_tiny
(
longlong
from
)
bool
Protocol_
binary
::
store_tiny
(
longlong
from
)
{
{
char
buff
[
1
];
char
buff
[
1
];
field_pos
++
;
field_pos
++
;
...
@@ -1096,7 +1096,7 @@ bool Protocol_prep::store_tiny(longlong from)
...
@@ -1096,7 +1096,7 @@ bool Protocol_prep::store_tiny(longlong from)
}
}
bool
Protocol_
prep
::
store_short
(
longlong
from
)
bool
Protocol_
binary
::
store_short
(
longlong
from
)
{
{
field_pos
++
;
field_pos
++
;
char
*
to
=
packet
->
prep_append
(
2
,
PACKET_BUFFER_EXTRA_ALLOC
);
char
*
to
=
packet
->
prep_append
(
2
,
PACKET_BUFFER_EXTRA_ALLOC
);
...
@@ -1107,7 +1107,7 @@ bool Protocol_prep::store_short(longlong from)
...
@@ -1107,7 +1107,7 @@ bool Protocol_prep::store_short(longlong from)
}
}
bool
Protocol_
prep
::
store_long
(
longlong
from
)
bool
Protocol_
binary
::
store_long
(
longlong
from
)
{
{
field_pos
++
;
field_pos
++
;
char
*
to
=
packet
->
prep_append
(
4
,
PACKET_BUFFER_EXTRA_ALLOC
);
char
*
to
=
packet
->
prep_append
(
4
,
PACKET_BUFFER_EXTRA_ALLOC
);
...
@@ -1118,7 +1118,7 @@ bool Protocol_prep::store_long(longlong from)
...
@@ -1118,7 +1118,7 @@ bool Protocol_prep::store_long(longlong from)
}
}
bool
Protocol_
prep
::
store_longlong
(
longlong
from
,
bool
unsigned_flag
)
bool
Protocol_
binary
::
store_longlong
(
longlong
from
,
bool
unsigned_flag
)
{
{
field_pos
++
;
field_pos
++
;
char
*
to
=
packet
->
prep_append
(
8
,
PACKET_BUFFER_EXTRA_ALLOC
);
char
*
to
=
packet
->
prep_append
(
8
,
PACKET_BUFFER_EXTRA_ALLOC
);
...
@@ -1128,7 +1128,7 @@ bool Protocol_prep::store_longlong(longlong from, bool unsigned_flag)
...
@@ -1128,7 +1128,7 @@ bool Protocol_prep::store_longlong(longlong from, bool unsigned_flag)
return
0
;
return
0
;
}
}
bool
Protocol_
prep
::
store_decimal
(
const
my_decimal
*
d
)
bool
Protocol_
binary
::
store_decimal
(
const
my_decimal
*
d
)
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
DBUG_ASSERT
(
field_types
==
0
||
DBUG_ASSERT
(
field_types
==
0
||
...
@@ -1141,7 +1141,7 @@ bool Protocol_prep::store_decimal(const my_decimal *d)
...
@@ -1141,7 +1141,7 @@ bool Protocol_prep::store_decimal(const my_decimal *d)
return
store
(
str
.
ptr
(),
str
.
length
(),
str
.
charset
());
return
store
(
str
.
ptr
(),
str
.
length
(),
str
.
charset
());
}
}
bool
Protocol_
prep
::
store
(
float
from
,
uint32
decimals
,
String
*
buffer
)
bool
Protocol_
binary
::
store
(
float
from
,
uint32
decimals
,
String
*
buffer
)
{
{
field_pos
++
;
field_pos
++
;
char
*
to
=
packet
->
prep_append
(
4
,
PACKET_BUFFER_EXTRA_ALLOC
);
char
*
to
=
packet
->
prep_append
(
4
,
PACKET_BUFFER_EXTRA_ALLOC
);
...
@@ -1152,7 +1152,7 @@ bool Protocol_prep::store(float from, uint32 decimals, String *buffer)
...
@@ -1152,7 +1152,7 @@ bool Protocol_prep::store(float from, uint32 decimals, String *buffer)
}
}
bool
Protocol_
prep
::
store
(
double
from
,
uint32
decimals
,
String
*
buffer
)
bool
Protocol_
binary
::
store
(
double
from
,
uint32
decimals
,
String
*
buffer
)
{
{
field_pos
++
;
field_pos
++
;
char
*
to
=
packet
->
prep_append
(
8
,
PACKET_BUFFER_EXTRA_ALLOC
);
char
*
to
=
packet
->
prep_append
(
8
,
PACKET_BUFFER_EXTRA_ALLOC
);
...
@@ -1163,7 +1163,7 @@ bool Protocol_prep::store(double from, uint32 decimals, String *buffer)
...
@@ -1163,7 +1163,7 @@ bool Protocol_prep::store(double from, uint32 decimals, String *buffer)
}
}
bool
Protocol_
prep
::
store
(
Field
*
field
)
bool
Protocol_
binary
::
store
(
Field
*
field
)
{
{
/*
/*
We should not increment field_pos here as send_binary() will call another
We should not increment field_pos here as send_binary() will call another
...
@@ -1175,7 +1175,7 @@ bool Protocol_prep::store(Field *field)
...
@@ -1175,7 +1175,7 @@ bool Protocol_prep::store(Field *field)
}
}
bool
Protocol_
prep
::
store
(
TIME
*
tm
)
bool
Protocol_
binary
::
store
(
TIME
*
tm
)
{
{
char
buff
[
12
],
*
pos
;
char
buff
[
12
],
*
pos
;
uint
length
;
uint
length
;
...
@@ -1201,15 +1201,15 @@ bool Protocol_prep::store(TIME *tm)
...
@@ -1201,15 +1201,15 @@ bool Protocol_prep::store(TIME *tm)
return
packet
->
append
(
buff
,
length
+
1
,
PACKET_BUFFER_EXTRA_ALLOC
);
return
packet
->
append
(
buff
,
length
+
1
,
PACKET_BUFFER_EXTRA_ALLOC
);
}
}
bool
Protocol_
prep
::
store_date
(
TIME
*
tm
)
bool
Protocol_
binary
::
store_date
(
TIME
*
tm
)
{
{
tm
->
hour
=
tm
->
minute
=
tm
->
second
=
0
;
tm
->
hour
=
tm
->
minute
=
tm
->
second
=
0
;
tm
->
second_part
=
0
;
tm
->
second_part
=
0
;
return
Protocol_
prep
::
store
(
tm
);
return
Protocol_
binary
::
store
(
tm
);
}
}
bool
Protocol_
prep
::
store_time
(
TIME
*
tm
)
bool
Protocol_
binary
::
store_time
(
TIME
*
tm
)
{
{
char
buff
[
13
],
*
pos
;
char
buff
[
13
],
*
pos
;
uint
length
;
uint
length
;
...
...
sql/protocol.h
View file @
8efe1b1f
...
@@ -103,11 +103,11 @@ class Protocol
...
@@ -103,11 +103,11 @@ class Protocol
/* Class used for the old (MySQL 4.0 protocol) */
/* Class used for the old (MySQL 4.0 protocol) */
class
Protocol_
simple
:
public
Protocol
class
Protocol_
text
:
public
Protocol
{
{
public:
public:
Protocol_
simple
()
{}
Protocol_
text
()
{}
Protocol_
simple
(
THD
*
thd_arg
)
:
Protocol
(
thd_arg
)
{}
Protocol_
text
(
THD
*
thd_arg
)
:
Protocol
(
thd_arg
)
{}
virtual
void
prepare_for_resend
();
virtual
void
prepare_for_resend
();
virtual
bool
store_null
();
virtual
bool
store_null
();
virtual
bool
store_tiny
(
longlong
from
);
virtual
bool
store_tiny
(
longlong
from
);
...
@@ -130,13 +130,13 @@ class Protocol_simple :public Protocol
...
@@ -130,13 +130,13 @@ class Protocol_simple :public Protocol
};
};
class
Protocol_
prep
:
public
Protocol
class
Protocol_
binary
:
public
Protocol
{
{
private:
private:
uint
bit_fields
;
uint
bit_fields
;
public:
public:
Protocol_
prep
()
{}
Protocol_
binary
()
{}
Protocol_
prep
(
THD
*
thd_arg
)
:
Protocol
(
thd_arg
)
{}
Protocol_
binary
(
THD
*
thd_arg
)
:
Protocol
(
thd_arg
)
{}
virtual
bool
prepare_for_send
(
List
<
Item
>
*
item_list
);
virtual
bool
prepare_for_send
(
List
<
Item
>
*
item_list
);
virtual
void
prepare_for_resend
();
virtual
void
prepare_for_resend
();
#ifdef EMBEDDED_LIBRARY
#ifdef EMBEDDED_LIBRARY
...
...
sql/set_var.cc
View file @
8efe1b1f
...
@@ -2739,8 +2739,8 @@ int set_var_collation_client::update(THD *thd)
...
@@ -2739,8 +2739,8 @@ int set_var_collation_client::update(THD *thd)
thd
->
variables
.
character_set_results
=
character_set_results
;
thd
->
variables
.
character_set_results
=
character_set_results
;
thd
->
variables
.
collation_connection
=
collation_connection
;
thd
->
variables
.
collation_connection
=
collation_connection
;
thd
->
update_charset
();
thd
->
update_charset
();
thd
->
protocol_
simple
.
init
(
thd
);
thd
->
protocol_
text
.
init
(
thd
);
thd
->
protocol_
prep
.
init
(
thd
);
thd
->
protocol_
binary
.
init
(
thd
);
return
0
;
return
0
;
}
}
...
...
sql/sql_class.cc
View file @
8efe1b1f
...
@@ -301,9 +301,9 @@ THD::THD()
...
@@ -301,9 +301,9 @@ THD::THD()
bzero
((
char
*
)
&
user_var_events
,
sizeof
(
user_var_events
));
bzero
((
char
*
)
&
user_var_events
,
sizeof
(
user_var_events
));
/* Protocol */
/* Protocol */
protocol
=
&
protocol_
simple
;
// Default protocol
protocol
=
&
protocol_
text
;
// Default protocol
protocol_
simple
.
init
(
this
);
protocol_
text
.
init
(
this
);
protocol_
prep
.
init
(
this
);
protocol_
binary
.
init
(
this
);
tablespace_op
=
FALSE
;
tablespace_op
=
FALSE
;
tmp
=
sql_rnd_with_mutex
();
tmp
=
sql_rnd_with_mutex
();
...
...
sql/sql_class.h
View file @
8efe1b1f
...
@@ -904,8 +904,8 @@ class THD :public Statement,
...
@@ -904,8 +904,8 @@ class THD :public Statement,
NET
net
;
// client connection descriptor
NET
net
;
// client connection descriptor
MEM_ROOT
warn_root
;
// For warnings and errors
MEM_ROOT
warn_root
;
// For warnings and errors
Protocol
*
protocol
;
// Current protocol
Protocol
*
protocol
;
// Current protocol
Protocol_
simple
protocol_simple
;
// Normal protocol
Protocol_
text
protocol_text
;
// Normal protocol
Protocol_
prep
protocol_prep
;
// Binary protocol
Protocol_
binary
protocol_binary
;
// Binary protocol
HASH
user_vars
;
// hash for user variables
HASH
user_vars
;
// hash for user variables
String
packet
;
// dynamic buffer for network I/O
String
packet
;
// dynamic buffer for network I/O
String
convert_buffer
;
// buffer for charset conversions
String
convert_buffer
;
// buffer for charset conversions
...
...
sql/sql_prepare.cc
View file @
8efe1b1f
...
@@ -93,11 +93,11 @@ When one supplies long data for a placeholder:
...
@@ -93,11 +93,11 @@ When one supplies long data for a placeholder:
/* A result class used to send cursor rows using the binary protocol. */
/* A result class used to send cursor rows using the binary protocol. */
class
Select_fetch_protocol_
prep
:
public
select_send
class
Select_fetch_protocol_
binary
:
public
select_send
{
{
Protocol_
prep
protocol
;
Protocol_
binary
protocol
;
public:
public:
Select_fetch_protocol_
prep
(
THD
*
thd
);
Select_fetch_protocol_
binary
(
THD
*
thd
);
virtual
bool
send_fields
(
List
<
Item
>
&
list
,
uint
flags
);
virtual
bool
send_fields
(
List
<
Item
>
&
list
,
uint
flags
);
virtual
bool
send_data
(
List
<
Item
>
&
items
);
virtual
bool
send_data
(
List
<
Item
>
&
items
);
virtual
bool
send_eof
();
virtual
bool
send_eof
();
...
@@ -125,7 +125,7 @@ class Prepared_statement: public Statement
...
@@ -125,7 +125,7 @@ class Prepared_statement: public Statement
};
};
THD
*
thd
;
THD
*
thd
;
Select_fetch_protocol_
prep
result
;
Select_fetch_protocol_
binary
result
;
Protocol
*
protocol
;
Protocol
*
protocol
;
Item_param
**
param_array
;
Item_param
**
param_array
;
uint
param_count
;
uint
param_count
;
...
@@ -247,9 +247,9 @@ static bool send_prep_stmt(Prepared_statement *stmt, uint columns)
...
@@ -247,9 +247,9 @@ static bool send_prep_stmt(Prepared_statement *stmt, uint columns)
*/
*/
DBUG_RETURN
(
my_net_write
(
net
,
buff
,
sizeof
(
buff
))
||
DBUG_RETURN
(
my_net_write
(
net
,
buff
,
sizeof
(
buff
))
||
(
stmt
->
param_count
&&
(
stmt
->
param_count
&&
stmt
->
thd
->
protocol_
simple
.
send_fields
((
List
<
Item
>
*
)
stmt
->
thd
->
protocol_
text
.
send_fields
((
List
<
Item
>
*
)
&
stmt
->
lex
->
param_list
,
&
stmt
->
lex
->
param_list
,
Protocol
::
SEND_EOF
)));
Protocol
::
SEND_EOF
)));
}
}
#else
#else
static
bool
send_prep_stmt
(
Prepared_statement
*
stmt
,
static
bool
send_prep_stmt
(
Prepared_statement
*
stmt
,
...
@@ -1882,7 +1882,7 @@ void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
...
@@ -1882,7 +1882,7 @@ void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
/* First of all clear possible warnings from the previous command */
/* First of all clear possible warnings from the previous command */
mysql_reset_thd_for_next_command
(
thd
);
mysql_reset_thd_for_next_command
(
thd
);
if
(
!
(
stmt
=
new
Prepared_statement
(
thd
,
&
thd
->
protocol_
prep
)))
if
(
!
(
stmt
=
new
Prepared_statement
(
thd
,
&
thd
->
protocol_
binary
)))
DBUG_VOID_RETURN
;
/* out of memory: error is set in Sql_alloc */
DBUG_VOID_RETURN
;
/* out of memory: error is set in Sql_alloc */
if
(
thd
->
stmt_map
.
insert
(
thd
,
stmt
))
if
(
thd
->
stmt_map
.
insert
(
thd
,
stmt
))
...
@@ -2054,8 +2054,8 @@ void mysql_sql_stmt_prepare(THD *thd)
...
@@ -2054,8 +2054,8 @@ void mysql_sql_stmt_prepare(THD *thd)
const
char
*
query
;
const
char
*
query
;
uint
query_len
;
uint
query_len
;
DBUG_ENTER
(
"mysql_sql_stmt_prepare"
);
DBUG_ENTER
(
"mysql_sql_stmt_prepare"
);
DBUG_ASSERT
(
thd
->
protocol
==
&
thd
->
protocol_simple
);
LINT_INIT
(
query_len
);
LINT_INIT
(
query_len
);
DBUG_ASSERT
(
thd
->
protocol
==
&
thd
->
protocol_text
);
if
((
stmt
=
(
Prepared_statement
*
)
thd
->
stmt_map
.
find_by_name
(
name
)))
if
((
stmt
=
(
Prepared_statement
*
)
thd
->
stmt_map
.
find_by_name
(
name
)))
{
{
...
@@ -2068,7 +2068,7 @@ void mysql_sql_stmt_prepare(THD *thd)
...
@@ -2068,7 +2068,7 @@ void mysql_sql_stmt_prepare(THD *thd)
}
}
if
(
!
(
query
=
get_dynamic_sql_string
(
lex
,
&
query_len
))
||
if
(
!
(
query
=
get_dynamic_sql_string
(
lex
,
&
query_len
))
||
!
(
stmt
=
new
Prepared_statement
(
thd
,
&
thd
->
protocol_
simple
)))
!
(
stmt
=
new
Prepared_statement
(
thd
,
&
thd
->
protocol_
text
)))
{
{
DBUG_VOID_RETURN
;
/* out of memory */
DBUG_VOID_RETURN
;
/* out of memory */
}
}
...
@@ -2621,14 +2621,14 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
...
@@ -2621,14 +2621,14 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
/***************************************************************************
/***************************************************************************
Select_fetch_protocol_
prep
Select_fetch_protocol_
binary
****************************************************************************/
****************************************************************************/
Select_fetch_protocol_
prep
::
Select_fetch_protocol_prep
(
THD
*
thd_arg
)
Select_fetch_protocol_
binary
::
Select_fetch_protocol_binary
(
THD
*
thd_arg
)
:
protocol
(
thd_arg
)
:
protocol
(
thd_arg
)
{}
{}
bool
Select_fetch_protocol_
prep
::
send_fields
(
List
<
Item
>
&
list
,
uint
flags
)
bool
Select_fetch_protocol_
binary
::
send_fields
(
List
<
Item
>
&
list
,
uint
flags
)
{
{
bool
rc
;
bool
rc
;
Protocol
*
save_protocol
=
thd
->
protocol
;
Protocol
*
save_protocol
=
thd
->
protocol
;
...
@@ -2646,7 +2646,7 @@ bool Select_fetch_protocol_prep::send_fields(List<Item> &list, uint flags)
...
@@ -2646,7 +2646,7 @@ bool Select_fetch_protocol_prep::send_fields(List<Item> &list, uint flags)
return
rc
;
return
rc
;
}
}
bool
Select_fetch_protocol_
prep
::
send_eof
()
bool
Select_fetch_protocol_
binary
::
send_eof
()
{
{
Protocol
*
save_protocol
=
thd
->
protocol
;
Protocol
*
save_protocol
=
thd
->
protocol
;
...
@@ -2658,7 +2658,7 @@ bool Select_fetch_protocol_prep::send_eof()
...
@@ -2658,7 +2658,7 @@ bool Select_fetch_protocol_prep::send_eof()
bool
bool
Select_fetch_protocol_
prep
::
send_data
(
List
<
Item
>
&
fields
)
Select_fetch_protocol_
binary
::
send_data
(
List
<
Item
>
&
fields
)
{
{
Protocol
*
save_protocol
=
thd
->
protocol
;
Protocol
*
save_protocol
=
thd
->
protocol
;
bool
rc
;
bool
rc
;
...
@@ -3000,7 +3000,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
...
@@ -3000,7 +3000,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
mysql_open_cursor
(
thd
,
(
uint
)
ALWAYS_MATERIALIZED_CURSOR
,
mysql_open_cursor
(
thd
,
(
uint
)
ALWAYS_MATERIALIZED_CURSOR
,
&
result
,
&
cursor
)
:
&
result
,
&
cursor
)
:
mysql_execute_command
(
thd
));
mysql_execute_command
(
thd
));
thd
->
protocol
=
&
thd
->
protocol_
simple
;
/* use normal protocol */
thd
->
protocol
=
&
thd
->
protocol_
text
;
/* use normal protocol */
/* Assert that if an error, no cursor is open */
/* Assert that if an error, no cursor is open */
DBUG_ASSERT
(
!
(
error
&&
cursor
));
DBUG_ASSERT
(
!
(
error
&&
cursor
));
...
...
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