TDBase

Fuente: source/classes/tdbase.prg

Standalone class

TDBase represents SQL database metadata, storing the database name and up to eight relation definitions with their corresponding INTO clauses. It is used by the SQL query and reporting engine to resolve table relationships in SELECT statements.

Key DATA Members

DATATypeDescription
cDatabaseCharacterName of the SQL database
aRelationsArrayArray of relation definitions (up to 8)
aIntosArrayArray of INTO clause definitions (up to 8)

Methods

MethodDescription
New( cDb, cRel01, cRel02, cRel03, cRel04, cRel05, cRel06, cRel07, cRel08, cInto01, cInto02, cInto03, cInto04, cInto05, cInto06, cInto07, cInto08 )Create a new database metadata object with up to 8 relation/INTO pairs

Example: Define Database Relations

#include "FiveWin.ch"

function Main()

   local oDb

   // Define a "sales" database with two relations
   oDb := TDBase():New( "sales", ;
      "CUSTOMER.ID = ORDERS.CUSTID", "ORDERS.ID = ITEMS.ORDERID", , , , , , , ;
      "CUSTOMERS", "ORDER_ITEMS" )

   ? "Database:", oDb:cDatabase
   ? "Relation 1:", oDb:aRelations[ 1 ]
   ? "Into 1:", oDb:aIntos[ 1 ]
   ? "Relation 2:", oDb:aRelations[ 2 ]
   ? "Into 2:", oDb:aIntos[ 2 ]

return nil

Notes

Ver También