Отступы

This commit is contained in:
Origami11 2021-03-26 16:54:38 +03:00
parent cdf7527c43
commit 085820d78c
5 changed files with 71 additions and 62 deletions

View file

@ -57,6 +57,7 @@ class Controller_Component
public /*.Settings.*/$registry; public /*.Settings.*/$registry;
public /*.Database.*/$db; public /*.Database.*/$db;
public /*.Collection.*/$parameter; public /*.Collection.*/$parameter;
static public $ID;
public $module; public $module;
public $item_module; public $item_module;
@ -246,11 +247,16 @@ class Controller_Component
} }
} }
$stmt = $db->prepareStatement("SELECT * FROM component WHERE code = ?"); // Нужно для отличия компонентов на странице нужно извлекать id для всей страницы сразу?
$stmt->setString(1, $expression); // Просто вести глобальный счетчик для компонентов
$cid = $stmt->executeQuery();
if ($cid->next()) { $component->component_id = self::$ID++;
$component->component_id = $cid->getInt('id_component'); /*
$stmt = $db->prepare("SELECT * FROM component WHERE code = :code");
$stmt->execute(['code' => $expression]);
$cid = $stmt->fetch();
if ($cid) {
$component->component_id = $cid['id_component'];
} else { } else {
$last = $db->getIdGenerator(); $last = $db->getIdGenerator();
if ($last->isBeforeInsert()) { if ($last->isBeforeInsert()) {
@ -269,6 +275,7 @@ class Controller_Component
} }
$component->component_id = $result; $component->component_id = $result;
} }
*/
$params = new Collection(); $params = new Collection();
$params->import(array_merge($_GET, $arguments)); $params->import(array_merge($_GET, $arguments));

View file

@ -100,8 +100,7 @@ class Database extends PDO
return $sth->fetch(PDO::FETCH_ASSOC); return $sth->fetch(PDO::FETCH_ASSOC);
} }
private static function assignQuote($x, $y) function assignQuote($x, $y) {
{
return $x . "=" . $this->quote($y); return $x . "=" . $this->quote($y);
} }

View file

@ -95,6 +95,9 @@ class Database_PDOStatement extends PDOStatement implements IteratorAggregate
function execute($args = null) { function execute($args = null) {
$result = parent::execute($args); $result = parent::execute($args);
if (class_exists('Log')) {
Log::add('execute', [$this->queryString, $args]);
}
return $result; return $result;
} }

View file

@ -143,7 +143,7 @@ class Tools_SQLStatementExtractor {
trigger_error("substring(), Endindex out of bounds must be $startpos<n<".($len-1), E_USER_ERROR); trigger_error("substring(), Endindex out of bounds must be $startpos<n<".($len-1), E_USER_ERROR);
} }
if ($startpos === $endpos) { if ($startpos === $endpos) {
return (string) $string{$startpos}; return (string) $string[$startpos];
} else { } else {
$len = $endpos-$startpos; $len = $endpos-$startpos;
} }

View file

@ -18,7 +18,7 @@ class Tools_String {
$res[] = static::strToArray(implode(',', $subarr[$in_subarr])); $res[] = static::strToArray(implode(',', $subarr[$in_subarr]));
$in_subarr--; $in_subarr--;
} }
} elseif ($tok{0} === '{') { // we're inside a new sub-array } elseif ($tok[0] === '{') { // we're inside a new sub-array
if ('}' !== substr($tok, -1, 1)) { if ('}' !== substr($tok, -1, 1)) {
$in_subarr++; $in_subarr++;
// if sub-array has more than one element // if sub-array has more than one element