Try OpenEdge Now
skip to main content
ABL Essentials
Handling Data and Locking Records

Handling Data and Locking Records

The most important aspect of any enterprise application is updating and maintaining data its database. This book deliberately delays that all-important topic until now so that you have the necessary background in ABL (Advanced Business Language) to understand and manage database updates. In this chapter, you'll learn about data handling and record locks.
This chapter discusses these topics from the perspective of a distributed application, one where the user interface and the logic that actually update the database are running in different sessions, normally on different machines. You don't have to run your application in this distributed mode, but you should definitely design it this way, so that as your requirements change, you are prepared to take advantage of multiple user interfaces and other requirements that demand that your application run on different platforms, one where the user interface is running and one or more where the database is directly connected.
This distributed environment affects some of the most basic precepts of how you construct ABL procedures. When the language was first developed, a typical run-time environment was a host-based system with a number of character-screen terminals connected directly to a single computer. Later, this environment was extended to the client/server model, with a network of PCs usually running a graphical interface connected over a network to a server machine where the database was located. In the client/server model, the notion of a direct connection to the database was still maintained across the network so that individual client sessions could run as if they had a local connection to the database, reading and writing individual records directly to and from the database and maintaining locks on records as they were viewed in the client session.
In a distributed application this model changes considerably. There's no longer a direct connection from a client session to the database. Records are read from the database into temp-tables and passed to the client for display and possible update. The client session can no longer hold locks on records it's using, so the server-side code needs to verify whether updated records passed back from the client have been modified by another user since they were read. Likewise, the server-side business logic cannot easily hold record locks while the records are being viewed in the client session. All of these considerations have a fundamental impact on how you design your application and how you write your ABL procedures.
To help you understand a bit of the historical perspective of how ABL has evolved, this chapter begins by introducing you to all the update-related statements in the language, and then explains how they are or are not still relevant to the new distributed paradigm.
* Overview of data handling statements
* Record locking in ABL