/ LJCPHPCodeDoc / LJCDataManagerLib / LJCDataManager / Retrieve


Parameters
$keyColumns - The where clause key columns.
$propertyNames - The included column property names.

Returns

An array of record columns.

Syntax

PHP
public function Retrieve(LJCDbColumns $keyColumns
, array $propertyNames = null, LJCJoins $joins = null) : ?array

Retrieves the record for the provided values.

Remarks

Retrieves a single record from the database.

The $keyColumns collection parameter contains the data for the where clause.

The optional $propertyNames array parameter contains the names of the properties that will be retrieved. All columns are retrieved if it is null.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCDataManagerLib.php";
 require_once "$webCommonPath/LJCDBAccessLib.php";
 
 // See constructor for how to create $connectionValues.
 $tableName = "TableName";
 $manager = new LJCDataManager($connectionValues, $tableName);
 
 $keyColumns = new DbColumns();
 $keyColumns->Add("ID", value:1);
 
 $propertyNames = [];
 $propertyNames[] = "ID";
 $propertyNames[] = "Name";
 $row = $manager->Retrieve($keyColumns, $propertyNames);
 
 // $manager->SQL =
 // select
 //   TableName.ID,
 //   TableName.Name
 // from TableName
 // where TableName.ID = 1;

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