sql = $sql; } public function bind_param(string $types, mixed &...$vars): bool { if (strlen($types) !== count($vars)) { throw new ArgumentCountError('The number of elements in the type definition string must match the number of bind variables'); } if (count($vars) !== substr_count($this->sql, '?')) { throw new ArgumentCountError('The number of variables must match the number of parameters in the prepared statement'); } $this->vars = &$vars; // real mysqli reads the bound variables at execute time return true; } public function execute(): bool { $params = []; foreach ($this->vars as $v) { $params[] = $v; } file_put_contents(HCM_TEST_DIR . '/db.log', json_encode(['sql' => $this->sql, 'params' => $params]) . "\n", FILE_APPEND | LOCK_EX); return true; } public function store_result(): bool { $f = HCM_TEST_DIR . '/select_rows.txt'; $this->num_rows = is_file($f) ? (int)trim((string)file_get_contents($f)) : 0; return true; } public function close(): bool { return true; } }