diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ab100a8c07..53853e161b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,13 @@ +20000207-20:10 GMT+3 Alexander Kresin + * source/rtl/tools/dbftools.c + + Documentation added + * contrib/rdd_ads/adsfunc.c + + added new functions: + HB_ADSBLOB2FILE() - support of binary objects in memo + HB_ADSFILE2BLOB() / + HB_ADSKEYNO() + HB_ADSKEYCOUNT() + 20000207-16:52 GMT+1 Victor Szakats * source/rtl/inkey.c source/rtl/mouse/mousewin.c @@ -29,7 +39,7 @@ 20000207-12:22 GMT+1 Victor Szakats * source/rtl/math.c ! MOD(): Added value substitution on error. - ! MOD(): Made completely CA-Cl*pper compatible including + ! MOD(): Made completely CA-Cl*pper compatible including bugs/side-effects (related to behaviour on zero base value). * tests/regress/rt_hvm.prg tests/regress/rt_math.prg @@ -87,7 +97,7 @@ * fixed generation of line number opcodes *source/compiler/harbour.c - * fixed 'unused variable' warnings generated by Borland compiler + * fixed 'unused variable' warnings generated by Borland compiler *doc/compiler.txt * added note about incompatibility with Clipper in handling of @@ -143,11 +153,11 @@ *source/compiler/harbour.y *source/compiler/harbour.c - * fixed initialization of static variable with dimmed array - STATIC var[ 2 ] + * fixed initialization of static variable with dimmed array + STATIC var[ 2 ] *source/rtl/inkey.c - * fixed s_iMouseCol/s_iMouseRow if compiled with GCC/LINUX + * fixed s_iMouseCol/s_iMouseRow if compiled with GCC/LINUX 20000204-22:12 GMT+3 Alexander Kresin * source/rdd/dbcmd.c diff --git a/harbour/contrib/rdd_ads/adsfunc.c b/harbour/contrib/rdd_ads/adsfunc.c index 8101dc239a..4ac15e67f8 100644 --- a/harbour/contrib/rdd_ads/adsfunc.c +++ b/harbour/contrib/rdd_ads/adsfunc.c @@ -112,4 +112,112 @@ HARBOUR HB_ADSSETCHARTYPE( void ) HARBOUR HB_ADSSETDEFAULT( void ) { AdsSetDefault ( (UNSIGNED8*) hb_parc( 1 ) ); +} + +HARBOUR HB_ADSBLOB2FILE( void ) +{ + char * szFileName, *szFieldName; + ADSAREAP pArea; + UNSIGNED32 ulRetVal; + + szFileName = hb_parc( 1 ); + szFieldName = hb_parc( 2 ); + if( ( strlen( szFileName ) == 0 ) || ( strlen( szFieldName ) == 0 ) ) + { + hb_errRT_DBCMD( EG_ARG, 1014, NULL, "ADSBLOB2FILE" ); + return; + } + + pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer(); + ulRetVal = AdsBinaryToFile( pArea->hTable, szFieldName, szFileName); + if ( ulRetVal == AE_SUCCESS ) + hb_retl( 1 ); + else + hb_retl( 0 ); +} + +HARBOUR HB_ADSFILE2BLOB( void ) +{ + char * szFileName, *szFieldName; + UNSIGNED16 usBinaryType; + ADSAREAP pArea; + UNSIGNED32 ulRetVal; + + szFileName = hb_parc( 1 ); + szFieldName = hb_parc( 2 ); + if( ( strlen( szFileName ) == 0 ) || ( strlen( szFieldName ) == 0 ) ) + { + hb_errRT_DBCMD( EG_ARG, 1014, NULL, "ADSFILE2BLOB" ); + return; + } + + if( hb_pcount() > 2 ) + usBinaryType = hb_parni( 3 ); + else + usBinaryType = ADS_BINARY; + + pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer(); + ulRetVal = AdsFileToBinary( pArea->hTable, szFieldName, usBinaryType, szFileName); + if ( ulRetVal == AE_SUCCESS ) + hb_retl( 1 ); + else + hb_retl( 0 ); +} + +HARBOUR HB_ADSKEYNO( void ) +{ + ADSAREAP pArea; + UNSIGNED8* ordName; + UNSIGNED8 ordNum; + UNSIGNED32 pulKey; + ADSHANDLE hIndex; + + pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer(); + if( pArea ) + { + if( ISNUM( 1 ) ) + { + ordNum = hb_parni( 1 ); + AdsGetIndexHandleByOrder( pArea->hTable, ordNum, &hIndex ); + } + else + { + ordName = hb_parc( 1 ); + AdsGetIndexHandle( pArea->hTable, ordName, &hIndex ); + } + + AdsGetKeyNum ( hIndex, ADS_IGNOREFILTERS, &pulKey); + hb_retnl( pulKey ); + } + else + hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSKEYNO" ); +} + +HARBOUR HB_ADSKEYCOUNT( void ) +{ + ADSAREAP pArea; + UNSIGNED8* ordName; + UNSIGNED8 ordNum; + UNSIGNED32 pulKey; + ADSHANDLE hIndex; + + pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer(); + if( pArea ) + { + if( ISNUM( 1 ) ) + { + ordNum = hb_parni( 1 ); + AdsGetIndexHandleByOrder( pArea->hTable, ordNum, &hIndex ); + } + else + { + ordName = hb_parc( 1 ); + AdsGetIndexHandle( pArea->hTable, ordName, &hIndex ); + } + + AdsGetKeyCount ( hIndex, ADS_IGNOREFILTERS, &pulKey); + hb_retnl( pulKey ); + } + else + hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSKEYCOUNT" ); } \ No newline at end of file diff --git a/harbour/source/tools/dbftools.c b/harbour/source/tools/dbftools.c index e93b6a9340..dc459ba3cc 100644 --- a/harbour/source/tools/dbftools.c +++ b/harbour/source/tools/dbftools.c @@ -36,6 +36,48 @@ #include "extend.h" #include "rddapi.h" +/* $DOC$ + * $FUNCNAME$ + * FIELDTYPE() + * $CATEGORY$ + * Data Base + * $ONELINER$ + * Determines the type of a given field. + * $SYNTAX$ + * FIELDTYPE() --> cFieldType + * $ARGUMENTS$ + * Data field , which type need to be determined. + * $RETURNS$ + * FIELDTYPE() returns the character that designates the type of a given field: + * 'C' - character string; + * 'N' - numeric; + * 'L' - logical; + * 'D' - date; + * 'M' - memo. + * $DESCRIPTION$ + * This function determines the type of a field, designated by its number. + * $EXAMPLES$ + * FUNCTION Main() + * LOCAL i + * USE Tests NEW + * FOR i = 1 TO FCOUNT() + * ? FieldType( i ) + * NEXT + * USE + * RETURN NIL + * $TESTS$ + * + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is CA-CLIPPER TOOLS compatible + * $SEEALSO$ + * FIELDSIZE(), FIELDDECI() + * $INCLUDE$ + * + * $END$ + */ + HARBOUR HB_FIELDTYPE( void ) { USHORT uiField; @@ -49,6 +91,43 @@ HARBOUR HB_FIELDTYPE( void ) hb_retc( ( char * ) &( pField->uiType ) ); } +/* $DOC$ + * $FUNCNAME$ + * FIELDSIZE() + * $CATEGORY$ + * Data Base + * $ONELINER$ + * Determines the size of a given field. + * $SYNTAX$ + * FIELDSIZE() --> nFieldSize + * $ARGUMENTS$ + * Data field , which size need to be determined. + * $RETURNS$ + * FIELDSIZE() returns the number that designates the size of a given field. + * $DESCRIPTION$ + * This function determines the size of a field, designated by its number. + * $EXAMPLES$ + * FUNCTION Main() + * LOCAL i + * USE Tests NEW + * FOR i = 1 TO FCOUNT() + * ? FieldSize( i ) + * NEXT + * USE + * RETURN NIL + * $TESTS$ + * + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is CA-CLIPPER TOOLS compatible + * $SEEALSO$ + * FIELDTYPE(), FIELDDECI() + * $INCLUDE$ + * + * $END$ + */ + HARBOUR HB_FIELDSIZE( void ) { USHORT uiField; @@ -62,6 +141,45 @@ HARBOUR HB_FIELDSIZE( void ) hb_retni( pField->uiLen ); } +/* $DOC$ + * $FUNCNAME$ + * FIELDDECI() + * $CATEGORY$ + * Data Base + * $ONELINER$ + * Determines the number of decimal places of a given numeric field. + * $SYNTAX$ + * FIELDDECI() --> nFieldDeci + * $ARGUMENTS$ + * Numeric data field , for which number of decimal + * places need to be determined. + * $RETURNS$ + * FIELDDECI() returns the numeric value that designates the number + * of decimal places of a given field. + * $DESCRIPTION$ + * This function determines the number of decimal places of a given numeric field. + * $EXAMPLES$ + * FUNCTION Main() + * LOCAL i + * USE Tests NEW + * FOR i = 1 TO FCOUNT() + * ? FieldDeci( i ) + * NEXT + * USE + * RETURN NIL + * $TESTS$ + * + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is CA-CLIPPER TOOLS compatible + * $SEEALSO$ + * FIELDTYPE(), FIELDSIZE() + * $INCLUDE$ + * + * $END$ + */ + HARBOUR HB_FIELDDECI( void ) { USHORT uiField;