Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Sql Avg delivers String instead of double
Re: Sql Avg delivers String instead of double [message #43440 is a reply to message #43439] Thu, 31 July 2014 15:27 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
The problem might be in bool MySqlConnection::Execute();

See the switch there, I suspect that Avg returns some type that is not recognized there, so 'default' non-conversion to String takes the place.

After brief googling, could you please try to add FIELD_TYPE_NEW_DECIMAL to double section?

		for(int i = 0; i < fields; i++) {
			MYSQL_FIELD *field = mysql_fetch_field_direct(result, i);
			SqlColumnInfo& f = info[i];
			f.name = field->name;
			switch(field->type) {
			case FIELD_TYPE_TINY:
			case FIELD_TYPE_SHORT:
			case FIELD_TYPE_LONG:
			case FIELD_TYPE_INT24:
				f.type = INT_V;
				break;
			case FIELD_TYPE_LONGLONG:
			case FIELD_TYPE_DECIMAL:
			case FIELD_TYPE_FLOAT:
			case FIELD_TYPE_DOUBLE:
			case FIELD_TYPE_NEW_DECIMAL: // <<<<<<<<<<<<<<<<<<<<<<<<  THIS IS NEW...
				f.type = DOUBLE_V;
				break;
			case FIELD_TYPE_DATE:
				f.type = DATE_V;
				break;
			case FIELD_TYPE_DATETIME:
			case FIELD_TYPE_TIMESTAMP:
				f.type = TIME_V;
				break;
			case FIELD_TYPE_VAR_STRING:
			case FIELD_TYPE_STRING:
				convert[i] = true;
			default:
				f.type = STRING_V;
				break;
			}
			f.width = field->length;
			f.scale = f.precision = 0;
		}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bugfix: MySqlConnection::GetRowsProcessed() returns correct value after an sql update
Next Topic: MySql bitwise and
Goto Forum:
  


Current Time: Sat May 18 22:39:42 CEST 2024

Total time taken to generate the page: 0.00835 seconds