Page 1 of 1

DbCopyStruct

Posted: Mon May 20, 2024 3:19 am
by hua
Hi guys,
when I tried to compile with BCC7.7 and Harbour I get unresolved external for dbCopyStruct().
The function is in which lib? For now I use __dbCopyStruct() instead
TIA

Re: DbCopyStruct

Posted: Mon May 20, 2024 3:59 am
by nageswaragunupudi
Both dbCopyStruct() and __dbCopyStruct() (with the same functionality) are supported only by xHarbour.
Harbour provides __dbCopyStruct() only.

My humbles submission:
It is always a good practice to use COMMAND syntax where available
We will not get into these problems
eg:

Code: Select all | Expand

COPY STRUCTURE TO cnewdbf

Re: DbCopyStruct

Posted: Mon May 20, 2024 5:12 am
by hua
Thanks for the explanation Rao.
I am using dbCopyStruct() because I was sub-classing TDatabase() to add that function.

Code: Select all | Expand

method dbCopyStruct(cDataBase, aFieldList) inline ( ::cAlias )->(__dbCopyStruct(cDataBase, aFieldList))

Re: DbCopyStruct

Posted: Mon May 20, 2024 12:58 pm
by karinha

Code: Select all | Expand

// C:\FHW\SAMPLES\DBSTRUCT.PRG

#include "FiveWin.ch"

// Require: RDD.LIB

FUNCTION Main()

   /*
   // Create a new file that contain part of the original structure
   LOCAL aList

   USE TEST

   aList := { "STATE" }

   // dbCopyStruct( "ONLYNAME.dbf",  aList ) // xHarbour only

   __dbCopyStruct( "ONLYNAME.dbf",  aList )  // Harbour / xHarbour
   */

   // .and.

   // Open a database,  then copy its structure to a new file,
   // Open the new file and list all its records
   USE Test

   // dbCopyXStruct( "TestStru" )  // xHarbour Only

   __dbCopyXStruct( "TestStru" )   // xHarbour .AND. Harbour

   USE TestStru

   BROWSE()

RETURN NIL

// FIN / END
 
Regards, saludos.

Re: DbCopyStruct

Posted: Mon May 20, 2024 3:30 pm
by karinha

Code: Select all | Expand

Harbour:

C:\HBBCC74\src\rdd

03/04/2020  19:58             5.900 dbstrux.prg

xHarbour:

C:\XHBBCC74\source\rdd

25/02/2020  13:20            13.638 dbstrux.prg
 
Regards, saludos.