Modificaciones para conservar tamaño en ascii de los campos numéricos

master
Elena 2023-01-13 13:24:57 +01:00
parent 5acf5e3f28
commit 8000b28924
2 changed files with 13 additions and 6 deletions

View File

@ -92,6 +92,7 @@ bool GdataTable::addColm(char* name, int type, int size)
colmName.add(name); colmName.add(name);
GdataTableColum inf; GdataTableColum inf;
void* c = NULL; void* c = NULL;
inf.szascii = size;
inf.flags=0; inf.flags=0;
inf.nb=size; inf.nb=size;
inf.type=type; inf.type=type;
@ -142,6 +143,8 @@ bool GdataTable::addColm(char* name, int type, int size)
case(Tstring): case(Tstring):
case(Tbin): case(Tbin):
c = new Cgarray<char>(); c = new Cgarray<char>();
if (!inf.nb)
inf.nb = 32;
if(nn>0) if(nn>0)
{ {
if(!((*(Cgarray<char>*)c)+=(nn*inf.nb))) if(!((*(Cgarray<char>*)c)+=(nn*inf.nb)))
@ -438,21 +441,23 @@ bool GdataTable::addMemRow( int nrow )
//*************************************************************************** //***************************************************************************
int GdataTable::getSizeASCII( int icol ) int GdataTable::getSizeASCII( int icol )
{ {
if(!colm[icol].nb) if (colm[icol].szascii)
return colm[icol].szascii;
else if(!colm[icol].nb)
{ {
switch(colm[icol].type) switch(colm[icol].type)
{ {
case(Tbool): case(Tbool):
return 1; return 1;
case(Tint): case(Tint):
return 4; return 16;
case(Tdouble): case(Tdouble):
return 8; return 16;
case(Tint64): case(Tint64):
return 8; return 32;
case(Tbin): case(Tbin):
case(Tstring): case(Tstring):
return colm[icol].nb; return 32;// colm[icol].nb;
default: default:
return -1; return -1;
} }
@ -460,4 +465,5 @@ int GdataTable::getSizeASCII( int icol )
else else
return colm[icol].nb; return colm[icol].nb;
} }
//*************************************************************************** //***************************************************************************

View File

@ -12,6 +12,7 @@ public:
int type;//tipo de dato int type;//tipo de dato
int nb;//numero de bytes de informacion int nb;//numero de bytes de informacion
int flags; int flags;
int szascii; //el tamaño en ascii que trae el dbf
}; };
class UTILES_EXPORT GdataTable class UTILES_EXPORT GdataTable