Data buffer for PowerBuilder data window

Source: Internet
Author: User

Four buffers of DataWindow

In PowerBuilder, DataWindow is the object that the user front-end uses to store and manipulate data. In each DataWindow object, 4 two-dimensional tables are used as data buffers to store the data that is queried. In the DataWindow, the operation of the data processing system in the user is actually the modification and movement of it in these buffers, finally, when the user submits the database, the system forms the SQL in-sert,update,delete and so on according to the information in these four buffers. These four buffers are:

1, Primary Buffer

This buffer is the one that holds the data in the DataWindow control in the Fill window, and the retrieve () function and InsertRow () function that calls DataWindow can populate the buffer with the data. When you use the About DataWindow Delete and filter functions, the corresponding records are removed from this buffer. When the DataWindow update () function is executed, PowerBuilder will look at the records in this buffer to form the SQL INSERT and UPDATE statements.

2, Delete Buffer

This buffer holds records that are deleted from primary buffer using the DeleteRow () function, and the system creates a DELETE statement based on the record of the buffer when the update () function is executed.

3. Filter Buffer

This buffer stores the remaining records from original buffer using the filter () function to filter into the primary buffer.

4, Original Buffer

This buffer stores all of the records that were obtained when DataWindow first executed the retrieve () function. When the database is submitted, the UPDATE statement generated from the primary buffer and the DELETE statement generated from the delete buffer are based on this buffer to construct the WHERE clause in these SQL statements.

The Original buffer is maintained internally by PowerBuilder, and any function provided by Power-builder cannot change its value, but the getitem provided by PowerBuilder ... The function of the series can read out the original values that DataWindow originally found from the database. These functions allow us to programmatically implement the so-called "Undo" function and get a WHERE clause that forms the submitting database when using optimistic locks.

If the DataWindow you are currently using does not have the right to modify, you will not be able to operate on the delete buffer and the original buffer and will cause a system error when calling Update ().

The state value of the data buffer

Both the Primary buffer and the delete buffer have a row-level and column-level state value, which is an enumeration type. The state value of the line at the time of submission determines whether the SQL statement is to be generated, where primary buffer produces the In-sert and UPDATE statements, and the delete buffer produces the DELETE statement. We can manipulate this state value using the Getitemstatus () function and the Setitemstatus () function. This enumeration state has the following four kinds:

· Notmodified!——— The value of the row or row is the result of the query and has not changed.

· Datamodified!——— The value of the row or column is the result of the query, which has changed.

· New!——— the row or column as a newly inserted row, the data has not changed (the data is blank or the default value).

· Newmodified!——— the row or column as a new row inserted, the data changes. Change is the SetItem () function that is entered or invoked through the user's keyboard.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.