OrdKeyVal can't be more large than 240 at cdx almoust in clipper.
If you are agree I upload this changes:

I want to do to this changes :

   bType = hb_cdxItemType( pResult );
   switch ( bType )
   {
      case 'N':
      case 'D':
         uiLen = 8;
         break;
      case 'L':
         uiLen = 1;
         break;
      case 'C':
         uiLen = ( USHORT ) hb_itemGetCLen( pResult );
         break;
      default:
         bType = 'U';
         uiLen = 0;
   }
   hb_itemRelease( pResult );

   /* Make sure KEY has proper type and iLen is not 0 */
   if ( bType == 'U' || uiLen == 0 || uiLen > CDX_MAXKEY )
   {
      hb_vmDestroyBlockOrMacro( pKeyExp );
      SELF_GOTO( ( AREAP ) pArea, ulRecNo );
      hb_cdxErrorRT( pArea, bType == 'U' ? EG_DATATYPE : EG_DATAWIDTH,
                     EDBF_INVALIDKEY, NULL, 0, 0 );
      return FAILURE;
   }

so solve as at clipper the next problem:

FUNCTION MAIN()

    LOCAL i

    REQUEST DBFCDX
    RddSetDefault( "DBFCDX" )

    DBCREATE( "__MYTEST", { { "test", "C", 241, 0 } } )

    USE __MYTEST
    INDEX ON FIELD->Test TO __MYTEST

    FOR i := 1 TO 10
        APPEND BLANK
        FIELD->test := Replicate( "1", 240 ) + Str( 10 - i, 1 )
    NEXT

    DbGoTop()
    ? &(OrdKey())
    ? "Length of &(OrdKey()) :" + Str( Len( &(OrdKey()) ) )
    ? OrdKeyVal()
    ? "Length of OrdKeyVal() :" + Str( Len(OrdKeyVal()) )
    WHILE ! EOF()
      ? Right( FIELD->Test, 1 )
      DbSkip()
    ENDDO

    USE
    FERASE( "__MYTEST.DBF" )
    FERASE( "__MYTEST.CDX" )

    ? "end"
RETURN NIL
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to