Parameters
$sql - The SQL statement.
Returns
An array of record columns.
Syntax
| PHP |
|
public function SQLRetrieve(string $sql): ?array
|
Executes a Select SQL statement.
Example
| PHP |
// Executes a Select SQL statement.
private static function SQLRetrieve(LJCDataManager $manager)
{
$nameValue = "NameValue";
$methodName = "SQLRetrieve()";
$data = new LJCDbColumns();
$data->Add("Name", value: $nameValue);
$affectedCount = $manager->Add($data);
// Retrieve with SQLRetrieve().
// See constructor for how to create $manager.
$keys = new LJCDbColumns();
$keys->Add("Name", value: $nameValue);
$sql = $manager->RetrieveSQL($keys);
$rows = $manager->SQLRetrieve($sql);
if (null == $rows
|| !is_array($rows)
|| 0 == count($rows))
{
echo($manager->SQL);
echo("\r\n{$methodName} No data retrieved.");
}
// $sql =
// select
// TableName.ID,
// TableName.Name
// from TableName
// where TableName.Name = 'NameValue'
$keys = new LJCDbColumns();
$keys->Add("Name", value: $nameValue);
$affectedCount = $manager->Delete($keys);
}
|
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.