Parameters
$sql - The SQL statement.
Returns
An array of data records.
Syntax
| PHP |
|
public function SQLLoad(string $sql): ?array
|
Executes a Select SQL statement.
Example
| PHP |
// Executes a Select SQL statement.
private static function SQLLoad(LJCDataManager $manager)
{
$nameValue = "NameValue";
$methodName = "SQLLoad()";
$data = new LJCDbColumns();
$data->Add("Name", value: $nameValue);
$affectedCount = $manager->Add($data);
// Retrieve with SQLLoad().
// See constructor for how to create $manager.
$keys = new LJCDbColumns();
$keys->Add("Name", value: $nameValue);
$sql = $manager->LoadSQL($keys);
$rows = $manager->SQLLoad($sql);
if (null == $rows
|| !is_array($rows)
|| 0 == count($rows))
{
echo($manager->SQL);
echo("\r\n{$methodName} No data retrieved.");
}
// $sql =
// $manager->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.