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:----NxtV4fM3v5xHdofS6jGr0gOSXIkDm+v/QBwvG1yuSSdncsMSzJ1pDUFPRaxYSR766cMpA8RyDQv9BgLAo57dy1e2U4LYO7bfVESl6IJQ6XmqjczEMsUye72anVOJWrv4IwKPoPugIFW51/YOQaDFfxP7QRUpZ75N0GtZuxQRkt/yAUPBpjcK6ZI/gJsDpXItDqfq/JaW4qcGUHXKLLI3lCS3nWObhiwzC12Xo35ryA3ifeVrSEgnfGUmJkr7gQx3eQ1tpY16QhvtUKUNkMsZmm+UaIsxryPJSK41EaBtuesqRHSLu6RqAVyJX02l7aB6WEgtvfA7g2HNlrDkwvaMcUmXt+2oi7VDkgDVIx/QZzcz1wxbhf8/Yfjh7z3DsLV2YazmLRgP2M4pE9h01fcHhjwlL30iz1pXPbW9bNaES0aV8D7AS0e8eqWPScsKpOsolz+JqrQ9VsaDbj+H8S/ZdZMZJO5FwNaBmiNx3y+w23X/6biDk5R+S/HIUHF2i8P87MtSWoqyl7iteW5cKoyHGZXzKMhKscTKK6WuoLPfa05BT7laLXJKcsBAUq/NMZIV2W1TzDm5t0YHRHKXR86eHMG0WKz6igQzH0R9CIC2p1/LZM5EirFO8CpKInMZisiq3ZBzGh18fDP2vh9FpD69VFl8pzRRmm0ak3DNbUr4rKc=----ATTACHMENT:----MTg0ODA1NzYwMDgyMzMzMiA5OTIzMjM0MjkwNDg4Nzk4IDk3Mjk3MTU2NDIxNjA0MTg=