From 8000b289243e408e58740275b9644708788d11b1 Mon Sep 17 00:00:00 2001 From: Elena Date: Fri, 13 Jan 2023 13:24:57 +0100 Subject: [PATCH] =?UTF-8?q?Modificaciones=20para=20conservar=20tama=C3=B1o?= =?UTF-8?q?=20en=20ascii=20de=20los=20campos=20num=C3=A9ricos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GdataTable.cpp | 18 ++++++++++++------ GdataTable.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/GdataTable.cpp b/GdataTable.cpp index 5b8db76..d3932ce 100644 --- a/GdataTable.cpp +++ b/GdataTable.cpp @@ -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(); - inf.nb = sizeof(long); + inf.nb = sizeof(long); if(nn>0) { if(!((*(Cgarray*)c)+=nn)) @@ -142,6 +143,8 @@ bool GdataTable::addColm(char* name, int type, int size) case(Tstring): case(Tbin): c = new Cgarray(); + if (!inf.nb) + inf.nb = 32; if(nn>0) { if(!((*(Cgarray*)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; } + //*************************************************************************** \ No newline at end of file diff --git a/GdataTable.h b/GdataTable.h index 6f5930a..d02b728 100644 --- a/GdataTable.h +++ b/GdataTable.h @@ -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