DBF: extended type: SET 'Y', but GET 'I'

100 views
Skip to first unread message

Hurricane

unread,
Sep 21, 2025, 5:54:32 AM (5 days ago) Sep 21
to Harbour Developers
Hi,


// DBF: extended type: SET 'Y', but GET 'I'
function main
   CLS

   DBCREATE( 'TESTY', { ;
      {'CODE', 'N', 5, 0},;
      {'NAME', 'C', 30, 0},;
      {'PRICE', 'Y', 8, 4} }, NIL, .T., 'TESTY' )

   ? FieldType('PRICE')  // OK
   ? FieldLen('PRICE')   // OK
   ? FieldDec('PRICE')   // OK

   dbCloseAll()

   USE TESTY
   ? FieldType('PRICE')  // INCORRECT
   ? FieldLen('PRICE')   // OK
   ? FieldDec('PRICE')   // OK

   RETURN NIL

Initially without any consequences for storage and reading, but it certainly interferes with specific logic, structure updates, etc.


In this utility dbu (structure mode), I added support for all Harbour extended types. In structure mode, I detect the situation and set it to type Y.

Regards,
Hurricane

carloskds

unread,
Sep 21, 2025, 5:42:03 PM (5 days ago) Sep 21
to Harbour Users
same, dbstruct and hb_fieldtype return 'I'.

function main
   CLS

   DBCREATE( 'TESTY', { ;
      {'CODE', 'N', 5, 0},;
      {'NAME', 'C', 30, 0},;
      {'PRICE', 'Y', 8, 4} }, NIL, .T., 'TESTY' )

   ? FieldType('PRICE')  // OK
   ? FieldLen('PRICE')   // OK
   ? FieldDec('PRICE')   // OK

   dbCloseAll()

   USE TESTY
  AEval( DbStruct(), {|a| QOut( PadR( a[DBS_NAME], 10 ), ;
                                   a[DBS_TYPE]      , ;
                              Str( a[DBS_LEN ],  3 ), ;
                              Str( a[DBS_DEC ],  3 )  ;
                           ) } )
   ? HB_FieldType('PRICE')  // INCORRECT

   ? FieldLen('PRICE')   // OK
   ? FieldDec('PRICE')   // OK

   RETURN NIL

Angel Pais

unread,
Sep 21, 2025, 6:32:00 PM (5 days ago) Sep 21
to harbou...@googlegroups.com
Alguien me explique el tipo de campo DBF currency?
Cuanto es el maximo y minimo que se puede almacenar en el ?
Cómo se manejan los decimales?

TIA
Angel

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/03908e70-a0b7-4915-ad4f-7ff32594e7fbn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages