How exactly MySQL support longblob
Posted by: Artur Ivakov
Date: November 28, 2019 02:45AM

JDBC connection. jdbc:mysql://mi-db:3306/dbmi?blobSendChunkSize=10000&useServerPrepStmts=true&emulateUnsupportedPstmts=false&maxAllowedPacket=200000

Yes I can increase max_allowed_packet property. No reason though since my data is bigger than 1GB anyway.

I have a simple table with 3 fields, where 1 field has LONGBLOB type.
And I have a question. How value of LONGBLOB is supposed to be inserted.
JPA or server prepared statement with binary stream binding for longblob value would fail because neither client side neither server side supports blob bigger than 1GB(protocol limit for max_allowed_packet is 1GB).
Binary stream is supposed to send long values in chunks. And it does. Except server accept chunks with this function
bool Item_param::set_longdata(const char *str, ulong length) {
DBUG_TRACE;

/*
If client character set is multibyte, end of long data packet
may hit at the middle of a multibyte character. Additionally,
if binary log is open we must write long data value to the
binary log in character set of client. This is why we can't
convert long data to connection character set as it comes
(here), and first have to concatenate all pieces together,
write query to the binary log and only then perform conversion.
*/
if (str_value.length() + length > current_thd->variables.max_allowed_packet) {
my_message(ER_UNKNOWN_ERROR,
"Parameter of prepared statement which is set through "
"mysql_send_long_data() is longer than "
"'max_allowed_packet' bytes",
MYF(0));
return true;
}

if (str_value.append(str, length, &my_charset_bin)) return true;
state = LONG_DATA_VALUE;
maybe_null = 0;

return false;
}

What effectively makes blob limited to a 1GB on server side.
Is a type longer than 1GB a futere release feature? I dont see any documentation mentioning that it is so.

Options: ReplyQuote


Subject
Written By
Posted
How exactly MySQL support longblob
November 28, 2019 02:45AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.