Example #1
0
static readstat_error_t dta_write_missing(void *row, const readstat_variable_t *var) {
    readstat_error_t retval = READSTAT_OK;
    if (var->type == READSTAT_TYPE_CHAR) {
        retval = dta_write_char(row, var, DTA_MISSING_CHAR);
    } else if (var->type == READSTAT_TYPE_INT16) {
        retval = dta_write_int16(row, var, DTA_MISSING_INT16);
    } else if (var->type == READSTAT_TYPE_INT32) {
        retval = dta_write_int32(row, var, DTA_MISSING_INT32);
    } else if (var->type == READSTAT_TYPE_FLOAT) {
        retval = dta_write_float(row, var, DTA_MISSING_FLOAT);
    } else if (var->type == READSTAT_TYPE_DOUBLE) {
        retval = dta_write_double(row, var, DTA_MISSING_DOUBLE);
    } else if (var->type == READSTAT_TYPE_STRING) {
        retval = dta_write_string(row, var, NULL);
    }
    return retval;
}
Example #2
0
static readstat_error_t dta_write_missing(void *row, const readstat_variable_t *var) {
    readstat_error_t retval = READSTAT_OK;
    if (var->type == READSTAT_TYPE_CHAR) {
        retval = dta_write_char(row, var, DTA_MISSING_CHAR);
    } else if (var->type == READSTAT_TYPE_INT16) {
        retval = dta_write_int16(row, var, DTA_MISSING_INT16);
    } else if (var->type == READSTAT_TYPE_INT32) {
        retval = dta_write_int32(row, var, DTA_MISSING_INT32);
    } else if (var->type == READSTAT_TYPE_FLOAT) {
        int32_t val_i = DTA_MISSING_FLOAT;
        memcpy(row, &val_i, sizeof(int32_t));
    } else if (var->type == READSTAT_TYPE_DOUBLE) {
        int64_t val_l = DTA_MISSING_DOUBLE;
        memcpy(row, &val_l, sizeof(int64_t));
    } else if (var->type == READSTAT_TYPE_STRING) {
        retval = dta_write_string(row, var, NULL);
    }
    return retval;
}