/ LJCPHPCodeDoc / LJCDataManagerLib / LJCSQLBuilder / SQLColumns


Parameters
$tableName - The request Table name.
$sqlColumns - The included columns.
$includeParens - Includes the statement parenthesis.
$joins - The Join definitions.

Returns

The Select columns.

Syntax

PHP
public static function SQLColumns(string $tableName
, LJCDbColumns $sqlColumns, bool $includeParens = false
, LJCJoins $joins = null) : string

Creates the columns for a Select SQL statement.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCDataManagerLib.php";
 require_once "$webCommonPath/LJCDBAccessLib.php";
 
 $joins = new LJCJoins();
 $join = $joins->Add("JoinTableName");
 $join->JoinOns->Add("FromColumnName", "ToColumnName");
 $join->Columns->Add("JoinColumnName", "PropertyName", "ResultName");
 
 $tableName = "TableName";
 $dbColumns = new DbColumns();
 $dbColumns->Add("ID", dataTypeName: "int");
 $dbColumns->Add("Name");
 $columns = LJCSQLBuilder::SQLColumns($tableName, $dbColumns, $joins);
 
 // $columns =
 //  TableName.ID,
 //  TableName.Name,
 //  JoinTableName.JoinColumnName as ResultName

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