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;
}