String CDatabaseConnectionMySql::DoWriteFloat( float value ) const
	{
		StringStream stream;
		uint32_t decimals = GetPrecision( EFieldType_FLOAT32 );
		stream << STR( "CAST( " );
		stream.precision( decimals * 2 );
		stream << value;
		// float min == -3.40282e+038 => 39 digits before decimals separator
		stream << STR( " AS DECIMAL( " ) << ( 39 + decimals ) << STR( ", " ) << decimals << STR( " ) )" );
		return stream.str();
	}
예제 #2
0
 //-----------------------------------------------------------------------
 String StringConverter::toString(double val, unsigned short precision,
                                  unsigned short width, char fill, std::ios::fmtflags flags)
 {
     StringStream stream;
     stream.precision(precision);
     stream.width(width);
     stream.fill(fill);
     if (flags)
         stream.setf(flags);
     stream << val;
     return stream.str();
 }
 //-----------------------------------------------------------------------
 String StringConverter::toString(float val, unsigned short precision,
                                  unsigned short width, char fill, std::ios::fmtflags flags)
 {
     StringStream stream;
     if (msUseLocale)
         stream.imbue(msLocale);
     stream.precision(precision);
     stream.width(width);
     stream.fill(fill);
     if (flags)
         stream.setf(flags);
     stream << val;
     return stream.str();
 }