en Harbour

Gestionar bases de datos PostgreSQL

Un resumen de los métodos de la clase TPQ para PostgreSQL que viene en Harbour.

CREATE CLASS TPQServer

   VAR pDb
   VAR lTrans
   VAR lAllCols  INIT .T.
   VAR Schema    INIT "public"
   VAR lError    INIT .F.
   VAR cError    INIT ""
   VAR lTrace    INIT .F.
   VAR pTrace

   METHOD New( cHost, cDatabase, cUser, cPass, nPort, cSchema, hCustom )
   METHOD Destroy()
   METHOD Close()              INLINE ::Destroy()

   METHOD StartTransaction()
   METHOD TransactionStatus()  INLINE PQtransactionStatus( ::pDb )
   METHOD Commit()
   METHOD Rollback()

   METHOD Query( cQuery )
   METHOD Execute( cQuery )    INLINE ::Query( cQuery )
   METHOD SetSchema( cSchema )

   METHOD NetErr()             INLINE ::lError
   METHOD ErrorMsg()           INLINE ::cError

   METHOD TableExists( cTable )
   METHOD ListTables()
   METHOD TableStruct( cTable )
   METHOD CreateTable( cTable, aStruct )
   METHOD DeleteTable( cTable  )
   METHOD TraceOn( cFile )
   METHOD TraceOff()
   METHOD SetVerbosity( num )  INLINE PQsetErrorVerbosity( ::pDb, iif( num >= 0 .AND. num <= 2, num, 1 )  )

ENDCLASS
CREATE CLASS TPQQuery

   VAR pQuery
   VAR pDB

   VAR nResultStatus

   VAR lBof
   VAR lEof
   VAR lRead
   VAR lAllCols INIT .T.

   VAR lError   INIT .F.
   VAR cError   INIT ""

   VAR cQuery
   VAR nRecno
   VAR nFields
   VAR nLastrec

   VAR aStruct
   VAR aKeys
   VAR TableName
   VAR Schema
   VAR rows     INIT 0

   METHOD New( pDB, cQuery, lAllCols, cSchema, res )
   METHOD Destroy()
   METHOD Close()            INLINE ::Destroy()

   METHOD Refresh( lQuery, lMeta )
   METHOD Fetch()            INLINE ::Skip()
   METHOD Read()
   METHOD Skip( nRecno )

   METHOD Bof()              INLINE ::lBof
   METHOD Eof()              INLINE ::lEof
   METHOD RecNo()            INLINE ::nRecno
   METHOD LastRec()          INLINE ::nLastrec
   METHOD Goto( nRecno )

   METHOD NetErr()           INLINE ::lError
   METHOD ErrorMsg()         INLINE ::cError

   METHOD FCount()           INLINE ::nFields
   METHOD FieldName( nField )
   METHOD FieldPos( cField )
   METHOD FieldLen( nField )
   METHOD FieldDec( nField )
   METHOD FieldType( nField )
   METHOD Update( oRow )
   METHOD Delete( oRow )
   METHOD Append( oRow )
   METHOD SetKey()

   METHOD Changed( nField )  INLINE !( ::aRow[ nField ] == ::aOld[ nField ] )
   METHOD Blank()            INLINE ::GetBlankRow()

   METHOD Struct()

   METHOD FieldGet( nField, nRow )
   METHOD GetRow( nRow )
   METHOD GetBlankRow()

ENDCLASS
CREATE CLASS TPQRow

   VAR aRow
   VAR aOld
   VAR aStruct

   METHOD New( row, old, struct )

   METHOD FCount()              INLINE Len( ::aRow )
   METHOD FieldGet( nField )
   METHOD FieldPut( nField, Value )
   METHOD FieldName( nField )
   METHOD FieldPos( cField )
   METHOD FieldLen( nField )
   METHOD FieldDec( nField )
   METHOD FieldType( nField )
   METHOD Changed( nField )     INLINE !( ::aRow[ nField ] == ::aOld[ nField ] )
   METHOD FieldGetOld( nField ) INLINE ::aOld[ nField ]

ENDCLASS