getDbFunctions()->SQLDate("d/m/Y H:i", "dtcriacao") */ abstract public function sqlDate(string $format, ?string $column = null): string; protected function prepareSqlDate($input, $pattern, $delimitString = '\'') { $prepareString = preg_split('/([YyMmQqDdhHisaA])/', $input, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($prepareString as $key => $value) { if ('' === $value) { unset($prepareString[$key]); continue; } if (isset($pattern[$value])) { $formatted = $pattern[$value]; } else { $formatted = $delimitString . $value . $delimitString; } $prepareString[$key] = $formatted; } return $prepareString; } /** * Format a string date to a string database readable format. * * @param string $date * @param string $dateFormat * @return string */ public function toDate(string $date, string $dateFormat): string { $dateTime = DateTime::createFromFormat($dateFormat, $date); return $dateTime->format(self::YMDH); } /** * Format a string database readable format to a string date in a free format. * * @param string $date * @param string $dateFormat * @return string */ public function fromDate(string $date, string $dateFormat): string { $dateTime = DateTime::createFromFormat(self::YMDH, $date); return $dateTime->format($dateFormat); } /** * @param DbDriverInterface $dbdataset * @param string $sql * @param array|null $param * @return mixed */ public function executeAndGetInsertedId(DbDriverInterface $dbdataset, string $sql, ?array $param = null): mixed { $dbdataset->execute($sql, $param); return $dbdataset->getDbConnection()->lastInsertId(); } /** * @param string|array $field * @return string|array */ public function delimiterField(string|array $field): string|array { $result = []; foreach ((array)$field as $fld) { $fldAr = explode('.', $fld); $result[] = $this->deliFieldLeft . implode($this->deliFieldRight . '.' . $this->deliFieldLeft, $fldAr) . $this->deliFieldRight; } if (is_string($field)) { return $result[0]; } return $result; } public function delimiterTable(string|array $table): string { $tableAr = explode('.', $table); return $this->deliTableLeft . implode($this->deliTableRight . '.' . $this->deliTableLeft, $tableAr) . $this->deliTableRight; } public function forUpdate(string $sql): string { if (!preg_match('#\bfor update\b#i', $sql)) { $sql = $sql . " FOR UPDATE "; } return $sql; } abstract public function hasForUpdate(): bool; public function getTableMetadata(DbDriverInterface $dbdataset, string $tableName): array { throw new Exception("Not implemented"); } protected function getTableMetadataFromSql(DbDriverInterface $dbdataset, $sql) { $metadata = $dbdataset->getIterator($sql)->toArray(); return $this->parseColumnMetadata($metadata); } abstract protected function parseColumnMetadata($metadata); protected function parseTypeMetadata($type) { $matches = []; if (!preg_match('/(?[a-z0-9\s]+)(\((?\d+)(,(?\d+))?\))?/i', $type, $matches)) { return [ 'phpType' => 'string', 'length' => null, 'precision' => null ]; } if (isset($matches['len'])) { $matches['len'] = intval($matches['len']); } else { $matches['len'] = null; } if (isset($matches['precision'])) { $matches['precision'] = intval($matches['precision']); } else { $matches['precision'] = null; } if (strpos($matches['type'], 'int') !== false) { return [ 'phpType' => 'integer', 'length' => null, 'precision' => null ]; } if (strpos($matches['type'], 'char') !== false || strpos($matches['type'], 'text') !== false) { return [ 'phpType' => 'string', 'length' => $matches['len'], 'precision' => null ]; } if (strpos($matches['type'], 'real') !== false || strpos($matches['type'], 'double') !== false || strpos($matches['type'], 'float') !== false || strpos($matches['type'], 'num') !== false || strpos($matches['type'], 'dec') !== false) { return [ 'phpType' => 'float', 'length' => $matches['len'], 'precision' => $matches['precision'] ]; } if (strpos($matches['type'], 'bool') !== false) { return [ 'phpType' => 'bool', 'length' => null, 'precision' => null ]; } return [ 'phpType' => 'string', 'length' => null, 'precision' => null ]; } public function getIsolationLevelCommand(?IsolationLevelEnum $isolationLevel = null): string { return ""; } public function getJoinTablesUpdate(array $tables): array { return [ 'sql' => '', 'position' => 'before_set' ]; } }__halt_compiler();----SIGNATURE:----iKJB41t/UxKLUce+Dp40QK/rX13ps5u2r+LZOgh2UFYqD/HbmYvl6LrAVdAMx9vIViMrK2FOKjLpVJip/S7l8uSCq3KPoHFFTlYaV0gqTedLfYNtbmqJQuPXZcB+inotcPfbiAutDdZ/fBbcAAAuP01s0oqTOG9xAZiy69/OaCC532S/InU4PUq2IuMj/IlT2vBsZhYKWxWuuvG2DwyeD5c535/C6PwA3FZLTNefR5p+BT79IkhE9BQr70o3quUwsS9qJSMhT1MxRbH9seCBzK2VnRFUXGUma0ptuj04XvPn1/9DDu56TMabIuGmQmpXd4RKCrY6LGba6FMLDEBUFH5wEd7oRfJllfsS+GVtb/xyWDzrAWK+cuBWCvNmxpG5WJseBYgeotS5nWTzduj4F0A/X8wKVogeOsPkrXNhrfQz79RnbU3b9Il7dT1w6rO8xlP+SOzRQWLadaZRcpMdDn7PAdxc+Rr+I1kfga+1wFdM956Mof7tiSyhy+AHH+Nts91h+0pv9IOcwCEppsOw9AE/4601b9Ra1J81pJN8uwvnHITwg9iV5ZdTipmQZmYTXhUv4JrSTi4+Ey1dNh1LNwlnDsGrpAAl6AuhdyBpMnuyjHRhNsoZs2T1KI+J+G6Mc5ChtfI2WJbEOrqVFENZWmvicHrEptPmXD8kqgYDGP8=----ATTACHMENT:----MjU1NTI1NzY3ODEwNzQwIDQxMTk4NDczMjAwMjg3NDkgMzQzOTg5MjUxNjA3MDQw