Record Methods Used to Create SQL Statements

You can use the following record object methods to build and execute SQL statements:

  • Delete

  • SelectByKey

  • Insert

  • Save

  • Update

The methods that result in a database update (specifically, UPDATE, INSERT, and DELETE) can only be issued in the following events:

  • SavePreChange

  • WorkFlow

  • SavePostChange

  • FieldChange

Remember that record UPDATEs, INSERTs, and DELETEs go directly to the database server, not to the Component Processor (although you can view data in the buffer using the PeopleCode debugger and other data buffer access classes). If a record method assumes that the database has been updated based on changes made in the component, that record method can be issued only in the SavePostChange event, because before SavePostChange none of the changes made to page data has actually been written back to the database.

If your application is repeating the same instruction many times, such as doing a million INSERTs, you should use the SQL object with the BulkMode property set to True, rather than the record SQL methods.