Exemple #1
0
int load_data()
{
	int c,r ;
	char * endp ;
	
	MYSQL_ROW row ;
	MYSQL_FIELD *field ;
	
	ST_retcode rc ;
	ST_double val = 0 ;
	// Loop over rows/columns of MySQL result set	
	for(r=1;r<=mysql_num_rows(res); r++){
		row=mysql_fetch_row(res) ;
		if(row<0) break ;
			for(c=1;c<=mysql_num_fields(res);c++){
				val = strtod(row[c-1], &endp) ;
				if (val) {	
					val = strtod(row[c-1], &endp) ;
					if(rc = SF_vstore(c, r, val)) 
					return(rc) ;
				}
				else {
					if(rc = SF_sstore(c, r, row[c-1])) 
					return(rc) ;
				}
			}
	}
	return 0 ;
}
int WriteOut(gsl_vector * metaResultsVector, ST_long j, gsl_combination * comb) {
	
	ST_retcode	rc;
	ST_uint4	i, subsetLength = gsl_combination_k(comb);
	char 		digits[52]="abcdefghijklmnopqrstuvwxywABCDEFGHIJKLMNOPQRSTUVWXYZ";
	char 		buf[80] ,temp[80];
	
	if((rc = SF_vstore(3, j, MARES(0)))) return(rc);  /* ES_FEM */
	if((rc = SF_vstore(4, j, MARES(1)))) return(rc);  /* var_FEM */
	if((rc = SF_vstore(5, j, MARES(2)))) return(rc);  /* ES_REM */
	if((rc = SF_vstore(6, j, MARES(3)))) return(rc);  /* var_REM */
	if((rc = SF_vstore(7, j, MARES(4)))) return(rc);  /* df */
	if (MARES(4) > 0.0) {
		if((rc = SF_vstore(8, j, MARES(5)))) return(rc);  /* Q */
		if((rc = SF_vstore(9, j, MARES(6)))) return(rc);  /* I2 */
	}
	else {
		if((rc = SF_vstore(8, j, SV_missval ))) return(rc);  /* Q */
		if((rc = SF_vstore(9, j, SV_missval ))) return(rc);  /* I2 */
	}
	if((rc = SF_vstore(10, j, MARES(7)))) return(rc);  /* tau2 */
	
	if (subsetLength>80) {
		SF_error("Exceeded 80 characters for subset description");
		SF_error("I will not print the string variable coding the subsets");
	}
	else {
		for(i=0; i<subsetLength; i++) {
			buf[i]=digits[c(i)];
			if (i==subsetLength-1) {
				buf[i+1]='\0';
			}
		}
	}
	
	if((rc = SF_sstore(11, j, buf))) return(rc);  


	return 0;
}