Updating of ADS RDD files

This commit is contained in:
Alexander S.Kresin
2000-02-07 17:19:23 +00:00
parent a9e80410b1
commit f459ca5ee2
3 changed files with 241 additions and 5 deletions

View File

@@ -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 <info@szelvesz.hu>
* source/rtl/inkey.c
source/rtl/mouse/mousewin.c
@@ -29,7 +39,7 @@
20000207-12:22 GMT+1 Victor Szakats <info@szelvesz.hu>
* 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

View File

@@ -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" );
}

View File

@@ -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(<nFieldNum>) --> cFieldType
* $ARGUMENTS$
* <nFieldNum> 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(<nFieldNum>) --> nFieldSize
* $ARGUMENTS$
* <nFieldNum> 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(<nFieldNum>) --> nFieldDeci
* $ARGUMENTS$
* <nFieldNum> 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;