From 65bf59cd3b1d41c1192ef0b9203077322d74d9f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Fri, 20 Sep 2013 15:42:35 +0200 Subject: [PATCH] 2013-09-20 15:42 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rdd/dbcmd.c ! fixed dbRSelect() to be compatible with undocumented Cl*pper behavior: When parameter is missing, wrong or 0 then 1 is used as relation number --- ChangeLog.txt | 5 +++++ src/rdd/dbcmd.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index c107b190a8..ae32cc0851 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,11 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-09-20 15:42 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * src/rdd/dbcmd.c + ! fixed dbRSelect() to be compatible with undocumented Cl*pper behavior: + When parameter is missing, wrong or 0 then 1 is used as relation number + 2013-09-20 15:30 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/hbgtcore.c ! added explicit casting to strchr() result diff --git a/src/rdd/dbcmd.c b/src/rdd/dbcmd.c index 3e4bc5f70c..87df3b4728 100644 --- a/src/rdd/dbcmd.c +++ b/src/rdd/dbcmd.c @@ -1741,11 +1741,15 @@ HB_FUNC( DBRELATION ) /* () --> cLinkExp */ HB_FUNC( DBRSELECT ) /* () --> nWorkArea */ { - HB_USHORT uiWorkArea = 0; + HB_USHORT uiWorkArea = 0, uiRelation = ( HB_USHORT ) hb_parni( 1 ); AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) - SELF_RELAREA( pArea, ( HB_USHORT ) hb_parni( 1 ), &uiWorkArea ); + /* undocumented CA-Cl*pper behavior: + * When parameter is missing, wrong or 0 then 1 is used as + * relation number [druzus] + */ + SELF_RELAREA( pArea, uiRelation ? uiRelation : 1, &uiWorkArea ); hb_retni( uiWorkArea ); }