Page 1 of 1

ADS and autoincremental fields

Posted: Mon Feb 24, 2020 10:38 am
by MOISES
Hi,

Is there a way to support it in dbf databases:

Code: Select all

{ "ID",         "+",  10,   0 }
Thank you.

Re: ADS and autoincremental fields

Posted: Mon Feb 24, 2020 7:34 pm
by nageswaragunupudi
MOISES wrote:Hi,

Is there a way to support it in dbf databases:

Code: Select all

{ "ID",         "+",  10,   0 }
Thank you.
This is already supported in DBFCDX.
fwh\samples\customer.dbf has the first field ID as autoinc field.

Re: ADS and autoincremental fields

Posted: Mon Feb 24, 2020 7:40 pm
by MOISES
Yes, but I asked in ADS. I get an error: field type not supported.

Re: ADS and autoincremental fields

Posted: Mon Feb 24, 2020 10:05 pm
by carlos vargas
this example work with ads

Code: Select all

#include "common.ch"
#include "dbinfo.ch"
#include "ads.ch"

REQUEST ADS
//REQUEST DBFCDX, DBFFPT
REQUEST HB_LANG_ESWIN, HB_CODEPAGE_ESWIN

//EXTERNAL OrdKeyNo, OrdKeyCount, OrdKeyGoTo, OrdKeyRelPos
EXTERNAL AdsKeyNo, AdsKeyCount, AdsGetRelKeyPos, AdsSetRelKeyPos

PROCEDURE Main()
  LOCAL aStruct := { ;
         { "CHARACTER", "C", 25, 0 }, ;
         { "NUMERIC"  , "N",  8, 0 }, ;
         { "DOUBLE"   , "N",  8, 2 }, ;
         { "DATE"     , "D",  8, 0 }, ;
         { "LOGICAL"  , "L",  1, 0 }, ;
         { "MEMO1"    , "M", 10, 0 }, ;
         { "MEMO2"    , "M", 10, 0 }, ;
         { "MYRECNO"  , "+", 4, 0  }  } /*work ok with + and Autoinc*/

  hb_LangSelect(  "ESWIN" )
  hb_SetCodePage( "ESWIN" )

  RddSetDefault( "ADS" )
   
  set date brit
  set cent on
  set opti on
  set dele on
  
  SET SERVER LOCAL
  SET AXS LOCKING OFF
  SET RIGHTS CHECKING OFF
  SET CHARTYPE TO ANSI
  SET FILETYPE TO ADT
  
  SetMode(25,80)
  cls
  
  WAIT "Exist table: " + iif( hb_dbExists( "testdbf" ), "Si", "No" )
  
  IF !hb_dbExists( "testdbf" )
    DbCreate( "testdbf", aStruct, "ADS", .T., "mylias" )
    index on CHARACTER to char01
  ELSE
    USE testdbf NEW ALIAS myalias
    SET INDEX TO char01
    WAIT "IndexOrder: " + hb_ntos( OrdNumber() ) + " / " + OrdKey()
  ENDIF
  
  Browse()
  
  use
  
RETURN

Re: ADS and autoincremental fields

Posted: Tue Feb 25, 2020 9:50 am
by MOISES
Thank you very much, Carlos.

The problem occurs if a DBF with autoincremental created with DBFCDX is opened with ADS, then it fails.

We must re-generate the table with the ADS driver.

Re: ADS and autoincremental fields

Posted: Tue Feb 25, 2020 5:48 pm
by carlos vargas
yes, not work. ace fail open customer.dbf from fwh sample folder!
Image

Re: ADS and autoincremental fields

Posted: Wed Feb 26, 2020 10:02 am
by MOISES
Yes, thats the problem.

It seems that ADS is abandoned by Sybase. Am i right?