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

View File

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