1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Introduce String::append_float

This method will write out a float to a String object, keeping the
charset of the original string.

Also have Float::to_string make use of String::append_float
This commit is contained in:
Vicențiu Ciorbaru
2024-07-25 21:52:33 +03:00
committed by Sergei Golubchik
parent 26e599cd32
commit f813ac2a51
3 changed files with 44 additions and 20 deletions

View File

@@ -20,9 +20,13 @@
/* This file is originally from the mysql distribution. Coded by monty */
#include <my_global.h>
#include <cmath>
#include "m_ctype.h" /* my_charset_bin */
#include <my_sys.h> /* alloc_root, my_free, my_realloc */
#include "m_string.h" /* TRASH */
#include "sql_const.h"
#include "sql_list.h"
class String;
@@ -1007,6 +1011,12 @@ public:
{
return Binary_string::append(s);
}
// Append a float value to the string keeping the string's charset.
//
// The float value must not be NaN or Inf, it will be represented as 0 in
// that case.
bool append_float(float num, uint decimals);
inline bool append(char chr)
{
return Binary_string::append_char(chr);