Commit 03c68f40 authored by Sergei Golubchik's avatar Sergei Golubchik

ErrConvStringQ helper

like ErrConvString, but puts the string in 'single quotes'
parent 3c9ecf4b
......@@ -857,6 +857,14 @@ class ErrBuff
len= err_conv(err_buffer, (uint) sizeof(err_buffer), str, (uint) len, cs);
return {err_buffer, len};
}
LEX_CSTRING set_strq(const char *str, size_t len, CHARSET_INFO *cs) const
{
DBUG_ASSERT(len < UINT_MAX32);
len= err_conv(err_buffer+1, (uint) sizeof(err_buffer)-2, str, (uint) len, cs);
err_buffer[0]= err_buffer[len+1]= '\'';
err_buffer[len+2]= 0;
return {err_buffer, len+2};
}
LEX_CSTRING set_mysql_time(const MYSQL_TIME *ltime) const
{
int length= my_TIME_to_str(ltime, err_buffer, AUTO_SEC_PART_DIGITS);
......@@ -880,6 +888,7 @@ class ErrConv: public ErrBuff
class ErrConvString : public ErrConv
{
protected:
const char *str;
size_t len;
CHARSET_INFO *cs;
......@@ -896,6 +905,16 @@ class ErrConvString : public ErrConv
}
};
class ErrConvStringQ : public ErrConvString
{
public:
using ErrConvString::ErrConvString;
LEX_CSTRING lex_cstring() const override
{
return set_strq(str, len, cs);
}
};
class ErrConvInteger : public ErrConv, public Longlong_hybrid
{
public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment