Database Operations

Use these functions for handling database input and output.

New features in BaanERP
In BaanERP, the functions db.curr(), db.first(), db.last(),, db.prev(),,, and db.le() are implemented internally as SELECT statements. They are supported for backward compatibility only. In new applications, use queries instead.
In BaanERP, certain 4GL functions have Data Access Layer (DAL) equivalents. The following table lists these functions and their DAL equivalents. 

4GL function                                              DAL function
set.input.error()                                          dal.set.error.message()
                                                                    return(DALHOOKERROR)                                                      dal.set.error.message()
                                                                    return(DALHOOKERROR)                                                    dal.set.error.message()
db.update()                                               dal.update()
db.delete()                                                dal.destroy()
If a DAL exists for a particular table, it is preferable to use the DAL functions. The older functions access the database directly. When you make changes to the database with these functions, logic integrity checks programmed in the DAL are not executed. When you make changes to the database with the DAL functions, the relevant DAL hooks are executed automatically. This ensures the logic integrity of the database. 

Table names and declarations
The naming syntax for tables, record buffers, and fields is:
 table tppmmmxxx                | table declaration
 rcd.tppmmmxxx                  | record buffer of table
 ppmmmxxx.ffffffff                 | logical field of table

where t stands for table, pp is the package code, mmm is the module code, xxx is the table number, and ffffffff  is a field name.
If a table is used in a script, it must be declared with the statement:
table tppmmmxxx
Declaration of a table implies declaration of all its fields and its record buffer. These do not need to be declared separately.
There are no functions for opening or closing a table. A table is automatically opened the first time it is accessed. It is automatically closed when the program ends.

List of Database operations:

People who read this post also read :


Post a Comment


Twitter Delicious Facebook Digg Stumbleupon Favorites More