2024-05-31 11:49 UTC+0200 Aleksander Czajczynski (hb fki.pl)

* contrib/rddmisc/arrayrdd.prg
    ! group of fixes contributed in #355 by @VarenL:
      IndexOrd() didn't work, DbZap() didn't update indexes, problem
      with larger number of indexes, erroneous AR_GOBOTTOM function.

  + doc/en/rdddb.txt
    + readded a 2017 copy

  * contrib/hbamf/amfstdio.c
    * flow-control is now optional, but still enabled by default

    ! fix missing free when exiting the loop

  * contrib/hbpgsql/rddcopy.c
    ! fix c&p bug/typo in HB_PQCOPYFROMWA, corrected handling field list
      passed in <aFiledNames> parameter

      <lResult> := HB_PQCOPYFROMWA( <pConn>, <cTargetTable>, [<bWhileBlock>],
                                   [<bForBlock>], [<aFieldNames>], [<nCount>],
                                   [<lTrimStrings>], [<nPreBuffer>] )
This commit is contained in:
Aleksander Czajczynski
2024-05-31 11:49:16 +02:00
parent a10feba63c
commit 217d50769f
5 changed files with 1333 additions and 13 deletions

View File

@@ -7,6 +7,28 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */
2024-05-31 11:49 UTC+0200 Aleksander Czajczynski (hb fki.pl)
* contrib/rddmisc/arrayrdd.prg
! group of fixes contributed in #355 by @VarenL:
IndexOrd() didn't work, DbZap() didn't update indexes, problem
with larger number of indexes, erroneous AR_GOBOTTOM function.
+ doc/en/rdddb.txt
+ readded a 2017 copy
* contrib/hbamf/amfstdio.c
* flow-control is now optional, but still enabled by default
! fix missing free when exiting the loop
* contrib/hbpgsql/rddcopy.c
! fix c&p bug/typo in HB_PQCOPYFROMWA, corrected handling field list
passed in <aFiledNames> parameter
<lResult> := HB_PQCOPYFROMWA( <pConn>, <cTargetTable>, [<bWhileBlock>],
[<bForBlock>], [<aFieldNames>], [<nCount>],
[<lTrimStrings>], [<nPreBuffer>] )
2024-05-13 02:39 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* ChangeLog.txt
* src/rtl/fscopy.c

View File

@@ -55,16 +55,23 @@
static int s_nCount = 0;
static void countCheck( int n )
static void countCheck( int n, int nFlowCtrl )
{
/* yes, this is flow-control */
/* implements flow control for interacting with ill-strange non-configurable
environments that lose data when writing too much into such STDIN pipe.
specify nFlowCtrl = 0 to disable */
if( ! nFlowCtrl )
return;
s_nCount += n;
while( s_nCount >= SINGLEBUF )
while( s_nCount >= nFlowCtrl )
{
/* this 32-bit uint 'zero' should be discarded from buffer every
nFlowCtrl bytes, when received on the other side - after such
notification other process is allowed to send more data */
hb_conOutStd( "\0\0\0\0", 4 );
s_nCount -= SINGLEBUF;
s_nCount -= nFlowCtrl;
}
}
@@ -72,9 +79,6 @@ HB_FUNC( AMFSTDIO_READ )
{
char * pszStrIn = ( char * ) hb_xgrab( SINGLEBUF );
char * pszLenPrefix = ( char * ) hb_xgrab( 5 );
#if 0
char * pszBuf; = ( char * ) hb_xgrab( SINGLEBUF );
#endif
char * pszBuf;
char * pszTmp = pszLenPrefix;
HB_USHORT nBytes;
@@ -82,13 +86,21 @@ HB_FUNC( AMFSTDIO_READ )
int nLen;
int nToRead;
HB_FHANDLE hStdIn = hb_fsGetOsHandle( HB_STDIN_HANDLE );
int nFlowCtrl = hb_parnidef( 1, SINGLEBUF );
/* 0 - disable flow control, 32768 - by default */
while( nTotal < 4 )
{
nToRead = ( s_nCount + 4 - nTotal > SINGLEBUF ? SINGLEBUF - s_nCount : 4 - nTotal );
nBytes = hb_fsRead( hStdIn, pszStrIn, ( HB_USHORT ) nToRead );
countCheck( nBytes );
if( ! nBytes )
{
hb_xfree( pszStrIn );
hb_xfree( pszLenPrefix );
hb_ret();
return;
}
countCheck( nBytes, nFlowCtrl );
memcpy( pszTmp, pszStrIn, nBytes );
nTotal += nBytes;
@@ -100,6 +112,8 @@ HB_FUNC( AMFSTDIO_READ )
if( nLen >= MAXLEN )
{
hb_xfree( pszStrIn );
hb_xfree( pszLenPrefix );
hb_ret();
return;
}
@@ -122,7 +136,7 @@ HB_FUNC( AMFSTDIO_READ )
nBytes = hb_fsRead( hStdIn, pszStrIn, ( HB_USHORT ) nToRead );
countCheck( nBytes );
countCheck( nBytes, nFlowCtrl );
memcpy( pszTmp, pszStrIn, nBytes );
nTotal += nBytes;

View File

@@ -396,7 +396,7 @@ HB_FUNC( HB_PQCOPYFROMWA )
{
if( SELF_GETVALUE( pArea, ( HB_USHORT ) hb_arrayGetNI( pFields, uiIter ), pItem ) != HB_SUCCESS ||
! exportBufSqlVar( context, pItem, sc_szQuote, sc_szEsc ) ||
! addStrToContext( context, uiIter == uiFields ? "\n" : sc_szDelim ) )
! addStrToContext( context, uiIter == uiFieldCopy ? "\n" : sc_szDelim ) )
{
bFail = HB_TRUE;
break;

View File

@@ -585,7 +585,7 @@ STATIC FUNCTION AR_GOBOTTOM( nWA )
aWAData[ WADATA_ORDRECNO ] := 0
nResult := AR_GOTO( nWA, 0 )
ELSE
aWAData[ WADATA_ORDRECNO ] := Len( ATail( aIndexes[ nIndex ][ INDEX_RECORDS ] ) )
aWAData[ WADATA_ORDRECNO ] := Len( aIndexes[ nIndex ][ INDEX_RECORDS ] )
nResult := AR_GOTO( nWA, ATail( aIndexes[ nIndex ][ INDEX_RECORDS ] )[ INDEXKEY_RECORD ] )
ENDIF
ELSE
@@ -1084,6 +1084,7 @@ STATIC FUNCTION AR_ZAP( nWA )
/* empty records */
aDBFData[ DATABASE_RECORDS ] := {}
aDBFData[ DATABASE_RECINFO ] := {}
AEval( aDBFData[ DATABASE_INDEX ], {| aIndex | ASize( aIndex[ INDEX_RECORDS ], 0 ) } )
/* move to 0 recno */
AR_GOTO( nWA, 0 )
@@ -1319,6 +1320,9 @@ STATIC FUNCTION AR_ORDINFO( nWA, nMsg, aOrderInfo )
ENDSWITCH
SWITCH nMsg
CASE DBOI_NUMBER
aOrderInfo[ UR_ORI_RESULT ] := nIndex
EXIT
CASE DBOI_EXPRESSION
IF nIndex < 1 .OR. Empty( aIndexes ) .OR. nIndex > Len( aIndexes[ nIndex ] )
aOrderInfo[ UR_ORI_RESULT ] := ""
@@ -1327,7 +1331,7 @@ STATIC FUNCTION AR_ORDINFO( nWA, nMsg, aOrderInfo )
ENDIF
EXIT
CASE DBOI_POSITION
IF nIndex < 1 .OR. Empty( aIndexes ) .OR. nIndex > Len( aIndexes[ nIndex ] ) .OR. Empty( aIndexes[ nIndex ][ INDEX_RECORDS ] ) .OR. aWAData[ WADATA_ORDRECNO ] == 0
IF nIndex < 1 .OR. Empty( aIndexes ) .OR. nIndex > Len( aIndexes ) .OR. Empty( aIndexes[ nIndex ][ INDEX_RECORDS ] ) .OR. aWAData[ WADATA_ORDRECNO ] == 0
aOrderInfo[ UR_ORI_RESULT ] := 0
ELSE
IF aIndexes[ nIndex ][ INDEX_RECORDS ][ aWAData[ WADATA_ORDRECNO ] ][ INDEXKEY_RECORD ] != aWAData[ WADATA_RECNO ]

1280
doc/en/rdddb.txt Normal file

File diff suppressed because it is too large Load Diff