Data buffers for window| data DataWindow
Zhang Jianji 01-6-22 03:14:44
DataWindow's four mitigation sites are in PowerBuilder, and DataWindow is the object that the user front-end uses to store and manipulate the 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: Primary buffer This buffer is the data in the DataWindow control in the Fill window, and the retrieve () function and the InsertRow () function that invokes the 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. Delete buffer This buffer holds the record that was deleted from the primary buffer with the deleterow () function, and the system creates a DELETE statement based on the record of the buffer when the update () function is executed. Filter buffer This buffer stores the remaining records from original buffer using the filter () function filtered into the primary buffer. Original 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 when you call the UPdate () will also cause a system error. The state value of the data buffer Primary buffer and delete buffer both have row-level and column-level state values, which are 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. Let's look at the following example: We have a table with three fields in it, where item is the primary key. ITEM CHAR (5); NAME CHAR (20); QUANTITY INT. In the script we query the record of this table and get the following information stored in the primary and origianal buffer, where the line number is buffer plus. TB 01175000.gif in the window, we programmed to filter out the line number 0 and add a blank line: Dw_1.setfilter ("quantity=0") Dw_1.filter () Dw_1.insertrow () Primary The status of the buffer is:! The TB 01175001.gif record in filter buffer is:! TB 01175002.gif Users enter data in the new insert row, delete the 3rd row of data, and modify the 2nd row of data. When he leaves this datawindow, the status of the primary and delete buffers is as follows:! TB 01175003.gif then the Dw_1.update () function is executed, and the system will generate the SQL statement based on the two buffers. TB 01175004.gif in primary buffer, rows with a status of Notmodified and new! are ignored without generating SQL statements. A row with a status of Datamodified will produce an UPDATE statement, and a newmodified will produce an INSERT statement in the DThe row in the elete buffer produces the DELETE statement. Application of four buffers in programming some functions of the DataWindow control have the function of specifying DataWindow buffers. If default, the primary buffer is represented. The following are functions that can specify a buffer: · Getitemstatus () · Getnextmodified () · Getupdatestatus () · Setitemstatus () In addition, there are getitem ... Series of functions that are used to query the values in DataWindow. These functions are: · Getitemdate () · Getitemdatatime () · Getitemdecimal () · Getitemnumber () · Getitemstring () · Getitemtime ()
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.