Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

DBDelete

DBDelete()

Marks the current record for logical deletion.

DBDeleteAdvPL
01 · OVERVIEW

Overview

DBDelete marks the current record rather than physically removing every record. The TOPCONN reference describes R_E_C_D_E_L_ control; use the proper API instead of manually editing control columns. The fragment acts only after obtaining RecLock on an owned-table record. Do not transfer it to business tables without module routines and validation. EDTRB identifies only an owned test table already open with the required schema and permissions; examples are not intended for standard tables. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

DBDelete()

Return value

Return not formalized by the consulted page; unused in the example.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed330()
    // EDTRB is disposable; test record already located.
    If Select("EDTRB") > 0
        If !EDTRB->(Eof())
            If RecLock("EDTRB", .F.)
                EDTRB->(DBDelete())
                EDTRB->(MsUnlock())
            EndIf
        EndIf
    EndIf
Return Nil
Expected result

On successful lock, requests logical deletion of the test record; full error handling is not implemented. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Check RDD, alias and pending operations. Navigation can flush updates; preserve context under the caller contract and handle errors in the complete routine.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. DBDelete. TDN. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha