Exemplo n.º 1
0
/** Convert from a \e double_array data type
	Converts a \e double_array data type reference to a string.  
	@return the number of character written to the string
 **/
int convert_from_double_array(char *buffer, int size, void *data, PROPERTY *prop)
{
	double_array *a = (double_array*)data;
	unsigned int n,m;
	unsigned int p = 0;
	for ( n=0 ; n<a->get_rows() ; n++ )
	{
		for ( m=0 ; m<a->get_cols() ; m++ )
		{
			if ( a->is_nan(n,m) )
				p += sprintf(buffer+p,"%s","NAN");
			else
				p += convert_from_double(buffer+p,size,(void*)a->get_addr(n,m),prop);
			if ( m<a->get_cols()-1 ) strcpy(buffer+p++," ");
		}
		if ( n<a->get_rows()-1 ) strcpy(buffer+p++,";");
	}
	return p;
}
Exemplo n.º 2
0
/* {{{ ps_fetch_double */
static
void ps_fetch_double(MYSQL_BIND *r_param, const MYSQL_FIELD * field , unsigned char **row)
{
  switch (r_param->buffer_type)
  {
    case MYSQL_TYPE_DOUBLE:
    {
      double *value= (double *)r_param->buffer;
      float8get(*value, *row);
      r_param->buffer_length= 8;
    }
    break;
    default:
    {
      double value;
      float8get(value, *row);
      convert_from_double(r_param, field, value, sizeof(double));
    }
    break;
  }
  (*row)+= 8;
}