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
5bc4965d
Commit
5bc4965d
authored
Aug 21, 2003
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for SHOW CREATE TABLE to report corerct second field's length
parent
3ec7456f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
36 deletions
+39
-36
sql/item.cc
sql/item.cc
+5
-0
sql/sql_show.cc
sql/sql_show.cc
+34
-36
No files found.
sql/item.cc
View file @
5bc4965d
...
...
@@ -355,6 +355,11 @@ void Item_string::make_field(Send_field *tmp_field)
init_make_field
(
tmp_field
,
FIELD_TYPE_STRING
);
}
void
Item_empty_string
::
make_field
(
Send_field
*
tmp_field
)
{
init_make_field
(
tmp_field
,
FIELD_TYPE_VAR_STRING
);
}
void
Item_datetime
::
make_field
(
Send_field
*
tmp_field
)
{
init_make_field
(
tmp_field
,
FIELD_TYPE_DATETIME
);
...
...
sql/sql_show.cc
View file @
5bc4965d
...
...
@@ -564,49 +564,47 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN
(
1
);
}
String
packet
;
packet
.
length
(
0
);
net_store_data
(
&
packet
,
table
->
table_name
);
/*
A hack - we need to reserve some space for the length before
we know what it is - let's assume that the length of create table
statement will fit into 3 bytes ( 16 MB max :-) )
*/
ulong
store_len_offset
=
packet
.
length
();
packet
.
length
(
store_len_offset
+
4
);
if
(
store_create_info
(
thd
,
table
,
&
packet
))
DBUG_RETURN
(
-
1
);
ulong
create_len
=
packet
.
length
()
-
store_len_offset
-
4
;
if
(
create_len
>
0x00ffffff
)
// better readable in HEX ...
{
/*
Just in case somebody manages to create a table
with *that* much stuff in the definition
*/
DBUG_RETURN
(
1
);
}
/*
Now we have to store the length in three bytes, even if it would fit
into fewer bytes, so we cannot use net_store_data() anymore,
and do it ourselves
*/
char
*
p
=
(
char
*
)
packet
.
ptr
()
+
store_len_offset
;
*
p
++
=
(
char
)
253
;
// The client the length is stored using 3-bytes
int3store
(
p
,
create_len
);
List
<
Item
>
field_list
;
field_list
.
push_back
(
new
Item_empty_string
(
"Table"
,
NAME_LEN
));
field_list
.
push_back
(
new
Item_empty_string
(
"Create Table"
,
1024
));
field_list
.
push_back
(
new
Item_empty_string
(
"Create Table"
,
packet
.
length
()
));
if
(
send_fields
(
thd
,
field_list
,
1
))
DBUG_RETURN
(
1
);
String
*
packet
=
&
thd
->
packet
;
{
packet
->
length
(
0
);
net_store_data
(
packet
,
table
->
table_name
);
/*
A hack - we need to reserve some space for the length before
we know what it is - let's assume that the length of create table
statement will fit into 3 bytes ( 16 MB max :-) )
*/
ulong
store_len_offset
=
packet
->
length
();
packet
->
length
(
store_len_offset
+
4
);
if
(
store_create_info
(
thd
,
table
,
packet
))
DBUG_RETURN
(
-
1
);
ulong
create_len
=
packet
->
length
()
-
store_len_offset
-
4
;
if
(
create_len
>
0x00ffffff
)
// better readable in HEX ...
{
/*
Just in case somebody manages to create a table
with *that* much stuff in the definition
*/
DBUG_RETURN
(
1
);
}
/*
Now we have to store the length in three bytes, even if it would fit
into fewer bytes, so we cannot use net_store_data() anymore,
and do it ourselves
*/
char
*
p
=
(
char
*
)
packet
->
ptr
()
+
store_len_offset
;
*
p
++
=
(
char
)
253
;
// The client the length is stored using 3-bytes
int3store
(
p
,
create_len
);
if
(
my_net_write
(
&
thd
->
net
,
(
char
*
)
packet
.
ptr
(),
packet
.
length
()))
DBUG_RETURN
(
1
);
// now we are in business :-)
if
(
my_net_write
(
&
thd
->
net
,
(
char
*
)
packet
->
ptr
(),
packet
->
length
()))
DBUG_RETURN
(
1
);
}
send_eof
(
&
thd
->
net
);
DBUG_RETURN
(
0
);
}
...
...
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