/ LJCPHPCodeDoc / LJCDataManagerLib / LJCSQLBuilder / CreateUpdate


Parameters
$tableName - The table name.
$keyColumns - The where clause key columns.
$dataColumns - The Data columns.

Returns

The Update SQL statement.

Syntax

PHP
public static function CreateUpdate(string $tableName
, ?LJCDbColumns $keyColumns, LJCDbColumns $dataColumns) : string

Creates an Update SQL statement.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCDataManagerLib.php";
 require_once "$webCommonPath/LJCDBAccessLib.php";
 
 $keyColumns = new LJCDbColumns();
 $keyColumns->Add("ID", value:1);
 
 $dataColumns = new DbColumns();
 $dataColumns->Add("FirstName", value: "First");
 $dataColumns->Add("LastName", value: "Last");
 
 $sql = LJCSQLBuilder::CreateUpdate("TableName", $keyColumns
   , $dataColumns);
 
 // $sql =
 // update TableName set
 //   FirstName = 'First',
 //   LastName = 'Last'
 // where TableName.ID = 1

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.