MAX_SHORT_STRING is now intended to be an implementation detail of the
value code. There is no real reason that the Gnumeric or PostgreSQL
readers need to use it, so make them use their own constants instead.
#include <data/identifier.h>
#include <assert.h>
#include <data/identifier.h>
#include <assert.h>
+/* Default width of string variables. */
+#define GNUMERIC_DEFAULT_WIDTH 8
static void gnm_file_casereader_destroy (struct casereader *, void *);
static void gnm_file_casereader_destroy (struct casereader *, void *);
if (-1 == var_spec [idx].width )
var_spec [idx].width = (gri->asw == -1) ?
if (-1 == var_spec [idx].width )
var_spec [idx].width = (gri->asw == -1) ?
- ROUND_UP (strlen(text), MAX_SHORT_STRING) : gri->asw;
+ ROUND_UP (strlen(text), GNUMERIC_DEFAULT_WIDTH) : gri->asw;
/* Probably no data exists for this variable, so allocate a
default width */
if ( var_spec[i].width == -1 )
/* Probably no data exists for this variable, so allocate a
default width */
if ( var_spec[i].width == -1 )
- var_spec[i].width = MAX_SHORT_STRING;
+ var_spec[i].width = GNUMERIC_DEFAULT_WIDTH;
if ( ! dict_make_unique_var_name (r->dict, var_spec[i].name,
&vstart, name))
if ( ! dict_make_unique_var_name (r->dict, var_spec[i].name,
&vstart, name))
+/* Default width of string variables. */
+#define PSQL_DEFAULT_WIDTH 8
+
/* These macros must be the same as in catalog/pg_types.h from the postgres source */
#define BOOLOID 16
#define BYTEAOID 17
/* These macros must be the same as in catalog/pg_types.h from the postgres source */
#define BOOLOID 16
#define BYTEAOID 17
if ( n_tuples > 0 )
length = PQgetlength (qres, 0, i);
else
if ( n_tuples > 0 )
length = PQgetlength (qres, 0, i);
else
- length = MAX_SHORT_STRING;
+ length = PSQL_DEFAULT_WIDTH;
case BPCHAROID:
fmt.type = FMT_A;
width = (info->str_width == -1) ?
case BPCHAROID:
fmt.type = FMT_A;
width = (info->str_width == -1) ?
- ROUND_UP (length, MAX_SHORT_STRING) : info->str_width;
+ ROUND_UP (length, PSQL_DEFAULT_WIDTH) : info->str_width;
fmt.w = width;
fmt.d = 0;
break;
case BYTEAOID:
fmt.type = FMT_AHEX;
fmt.w = width;
fmt.d = 0;
break;
case BYTEAOID:
fmt.type = FMT_AHEX;
- width = length > 0 ? length : MAX_SHORT_STRING;
+ width = length > 0 ? length : PSQL_DEFAULT_WIDTH;
fmt.w = width * 2;
fmt.d = 0;
break;
fmt.w = width * 2;
fmt.d = 0;
break;
default:
msg (MW, _("Unsupported OID %d. SYSMIS values will be inserted."), type);
fmt.type = FMT_A;
default:
msg (MW, _("Unsupported OID %d. SYSMIS values will be inserted."), type);
fmt.type = FMT_A;
- width = length > 0 ? length : MAX_SHORT_STRING;
+ width = length > 0 ? length : PSQL_DEFAULT_WIDTH;
fmt.w = width ;
fmt.d = 0;
break;
}
if ( width == 0 && fmt_is_string (fmt.type))
fmt.w = width ;
fmt.d = 0;
break;
}
if ( width == 0 && fmt_is_string (fmt.type))
- fmt.w = width = MAX_SHORT_STRING;
+ fmt.w = width = PSQL_DEFAULT_WIDTH;
var = create_var (r, &fmt, width, PQfname (qres, i), i);
var = create_var (r, &fmt, width, PQfname (qres, i), i);