| 1565 | */ |
| 1566 | |
| 1567 | bool validate_comment_length(THD *thd, const char *comment_str, |
| 1568 | size_t *comment_len, uint max_len, |
| 1569 | uint err_code, const char *comment_name) |
| 1570 | { |
| 1571 | int length= 0; |
| 1572 | DBUG_ENTER("validate_comment_length"); |
| 1573 | uint tmp_len= system_charset_info->cset->charpos(system_charset_info, |
| 1574 | comment_str, |
| 1575 | comment_str + |
| 1576 | *comment_len, |
| 1577 | max_len); |
| 1578 | if (tmp_len < *comment_len) |
| 1579 | { |
| 1580 | if (thd->is_strict_mode()) |
| 1581 | { |
| 1582 | my_error(err_code, MYF(0), |
| 1583 | comment_name, static_cast<ulong>(max_len)); |
| 1584 | DBUG_RETURN(true); |
| 1585 | } |
| 1586 | char warn_buff[MYSQL_ERRMSG_SIZE]; |
| 1587 | length= my_snprintf(warn_buff, sizeof(warn_buff), ER(err_code), |
| 1588 | comment_name, static_cast<ulong>(max_len)); |
| 1589 | /* do not push duplicate warnings */ |
| 1590 | if (!thd->get_stmt_da()->has_sql_condition(warn_buff, length)) |
| 1591 | push_warning(thd, Sql_condition::WARN_LEVEL_WARN, |
| 1592 | err_code, warn_buff); |
| 1593 | *comment_len= tmp_len; |
| 1594 | } |
| 1595 | DBUG_RETURN(false); |
| 1596 | } |
| 1597 | |
| 1598 | /* |
| 1599 | Extend long VARCHAR fields to blob & prepare field if it's a blob |
nothing calls this directly
no test coverage detected