wwsql::SqlBuildUpdateStatementFromObject

This method builds a SQL UPDATE string to be sent to the backend application from a SCATTER NAME type object. The object must contain a key field in order for this method to work.

o.SqlBuildUpdateStatementFromObject(loData, lcFileName, lcPkField, loOrigData, loSQLRecord,llUseNamedParameters)

Return Value

Update command as a string or ""

Parameters

loData
A SCATTER NAME type object that contains the fields that are to be updated. The keyfield must be included in this data block.

lcTableame
The name of the SQL table to be updated.

lcPKField
The name of the PK field that is used to find the record to update. Name has to match the value on the loData object property passed in. Defaults to "PK".

Pass "NONE" to specify you don't want to generate a WHERE clause on the SQL statement. This allows you to create a custom WHERE clause for the SQL statement after the string is returned to you.

The PK field value passed must either be a string, or a value that can be turned into a compare value in a where clause (ie. Pk = 11, Pk = '_0123123331' or Pk = '{55A38A85-F48A-4ABD-8AEC-3E0B2CE0B01B}')

loOrigData
Optional - Data to compare current record to, to determine which fields to update in the database

loSqlRecord
Optional - A Record object that contains the actual structure of the fields to update. Pass .F. to ignore and use all fields but loSql.cSkipFields

llUseNamedParameters
Optional - defaults to .T. if not passed. When set uses Named parameters instead of SQL Literals (highly recommended).


See also:

Class wwsql

© West Wind Technologies, 2023 • Updated: 12/02/21
Comment or report problem with topic