Files
harbour-core/contrib/hbfoxpro/relfunc.c
Aleksander Czajczynski 362b7a32de 2019-02-11 13:09 UTC+0100 Aleksander Czajczynski (hb fki.pl)
* contrib/sddsqlt3/core.c
    ! fix DBUSEAREA() operation with SQLITE3 SDD to return empty result
      when query conditions are false or the source table has no rows.

      Previously an logically correct example caused RTE:
      DBUSEAREA(,, "SELECT * FROM existing_table WHERE FALSE")

    ! fix double-free error in sqLite3Disconnect(), looks like the
      sqlite3_close() return value checking was reverted, SQLITE_OK is 0

    * use CDP API to get UTF8 string length

    * use new sqlite3_prepare_v3() when built against
      sqlite 3.20.0 or upper (change borrowed from Viktor's 3.4 fork)

    + add HB_SQLT3_MAP_DECLARED_EMULATED define (not yet enabled by default)
      which make this SDD additionally parse SQLite column declarations.
      Right now it can make HB_FT_DATE fields working using standard
      ISO 8601 "yyyy-mm-dd" syntax. Also declarations not significant for
      SQLite, but useful in xBase-style programming - SQL numeric(len,dec)
      columns are detected in this mode and will be reflected in dbStruct().

    + add support for alternative StoD() like syntax for HB_FT_DATE columns

    + add support for ISO 8601 "YYYY-MM-DD HH:MM:SS.FFF" timestamp declared
      columns, SQLite stored strings are converted to proper HB_FT_TIMESTAMP
      fields

    + added HB_SQLT3_FIELDNAME_STRICT define, which enables shortening
      of field to "name" if SQLite returns "table.name". Such fields are
      not completly usable in xBase code - WA->T.FIELD syntax is not
      valid, but FieldPos("t.field") is OK. I think it should be default
      behaviour or some runtime setting should be introduced for convenience
      when working with specific SQL queries.

  * contrib/rddsql/sqlbase.c
  * contrib/rddsql/sqlmix.c
    + added ZAP functionality to SQLBASE and SQLMIX RDDs,
      index tags are preserved while ZAP-ing SQLMIX area.
      They are cleaned, no REINDEX is needed

    * changed to allow values of any type in "V" SIX3 / HB_FT_ANY fields
      in SQLBASE/SQLMIX RDD workareas

  * contrib/hbfoxpro/relfunc.c
    ! fix InList() FoxPro compatible function not looking at the last
      parameter passed. Thanks to Attila Szabo for the information
      posted on the developers list.
2019-02-11 13:10:05 +01:00

86 lines
3.0 KiB
C

/*
* FoxPro compatible functions BETWEEN(), INLIST()
*
* Copyright 2016 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file LICENSE.txt. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbapi.h"
#include "hbapiitm.h"
HB_FUNC( BETWEEN )
{
HB_BOOL fResult = HB_FALSE;
if( hb_pcount() == 3 )
{
PHB_ITEM pItem = hb_param( 1, HB_IT_ANY );
int iResult1, iResult2;
if( hb_itemCompare( pItem, hb_param( 2, HB_IT_ANY ), HB_FALSE, &iResult1 ) &&
hb_itemCompare( pItem, hb_param( 3, HB_IT_ANY ), HB_FALSE, &iResult2 ) )
fResult = iResult1 >= 0 && iResult2 <= 0;
}
hb_retl( fResult );
}
HB_FUNC( INLIST )
{
HB_BOOL fResult = HB_FALSE;
int iPCount = hb_pcount();
if( iPCount > 1 )
{
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
int iParam;
for( iParam = 2; iParam <= iPCount; ++iParam )
{
if( hb_itemEqual( pValue, hb_param( iParam, HB_IT_ANY ) ) )
{
fResult = HB_TRUE;
break;
}
}
}
hb_retl( fResult );
}