/ LJCPHPCodeDoc / LJCDataManagerLib / LJCSQLBuilder / SQLValueColumns


Parameters
$dataColumns - The Data columns.
$isUpdate - Indicates if the values are for an Update.
$includeParens - Includes the statement parenthesis.

Returns

The Add and Update value columns.

Syntax

PHP
public static function SQLValueColumns(LJCDbColumns $dataColumns
, bool $isUpdate = false, bool $includeParens = false) : string

Creates the value columns for an Update SQL statement.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCDataManagerLib.php";
 require_once "$webCommonPath/LJCDBAccessLib.php";
 
 $dbColumns = new DbColumns();
 $dbColumns->Add("FirstName", value: "First");
 $dbColumns->Add("LastName", value: "Last");
 
 // For an Update "set" statement.
 $columns = $LJCSQLBuilder::SQLValueColumns($dbColumns, true);
 // $columns =
 //  FirstName = 'First',
 //  LastName = 'Last'
 
 // For an Insert "values" statement.
 $columns = LJCSQLBuilder::SQLValueColumns($dbColumns, false, true);
 // $columns =
 //  (
 //   'First',
 //   'Last'
 //  )

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