Advanced PowerBuilder

HomePrevious Lesson: GetSqlPreview() & SetSqlPreview()
Next Lesson: Modify() Function

GetSQLSelect() and SetSQLSelect()

Unlike GetSqlPreview(), GetSQLSelect() and SetSQLSelect() functions can be called from other events. When PowerBuilder validates the SELECT statement against the database, SetSqlPreview() is called - provided the DataWindow is updateable.

If the SELECT list doesn't match the previously defined version, it returns an error and the new list of columns won't take effect. If the DataWindow is not updateable, PowerBuilder doesn't check for the validity of the SELECT statement.

If the SELECT statement contains computed columns, or if the FROM clause contains more than one table, PowerBuilder sets the DataWindow as not updateable, which makes Update() function call to fail. If this happens, you need to change the UPDATE characteristics by calling Modify(), which is explained next. Typically, these commands are called when a WHERE or HAVING clause has to be changed dynamically.
HomePrevious Lesson: GetSqlPreview() & SetSqlPreview()
Next Lesson: Modify() Function