MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / set_longdata

Method set_longdata

sql/item.cc:1631–1660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1629
1630
1631bool Item_param::set_longdata(const char *str, ulong length)
1632{
1633 DBUG_ENTER("Item_param::set_longdata");
1634
1635 /*
1636 If client character set is multibyte, end of long data packet
1637 may hit at the middle of a multibyte character. Additionally,
1638 if binary log is open we must write long data value to the
1639 binary log in character set of client. This is why we can't
1640 convert long data to connection character set as it comes
1641 (here), and first have to concatenate all pieces together,
1642 write query to the binary log and only then perform conversion.
1643 */
1644 if (str_value.length() + length > current_thd->variables.max_allowed_packet)
1645 {
1646 my_message(ER_UNKNOWN_ERROR,
1647 "Parameter of prepared statement which is set through "
1648 "mysql_send_long_data() is longer than "
1649 "'max_allowed_packet' bytes",
1650 MYF(0));
1651 DBUG_RETURN(true);
1652 }
1653
1654 if (str_value.append(str, length, &my_charset_bin))
1655 DBUG_RETURN(TRUE);
1656 state= LONG_DATA_VALUE;
1657 maybe_null= 0;
1658
1659 DBUG_RETURN(FALSE);
1660}
1661
1662
1663/**

Callers

nothing calls this directly

Calls 3

my_messageFunction · 0.85
lengthMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected