deliFieldLeft = '`'; $this->deliFieldRight = '`'; $this->deliTableLeft = '`'; $this->deliTableRight = '`'; } public function concat($str1, $str2 = null) { return "concat(" . implode(', ', func_get_args()) . ")"; } /** * Given a SQL returns it with the proper LIMIT or equivalent method included * @param string $sql * @param int $start * @param int $qty * @return string */ public function limit($sql, $start, $qty = null) { if (is_null($qty)) { $qty = 50; } if (stripos($sql, ' LIMIT ') === false) { $sql = $sql . " LIMIT x, y"; } return preg_replace( '~(\s[Ll][Ii][Mm][Ii][Tt])\s.*?,\s*.*~', '$1 ' . $start .', ' .$qty, $sql ); } /** * Given a SQL returns it with the proper TOP or equivalent method included * @param string $sql * @param int $qty * @return string */ public function top($sql, $qty) { return $this->limit($sql, 0, $qty); } /** * Return if the database provider have a top or similar function * @return bool */ public function hasTop() { return true; } /** * Return if the database provider have a limit function * @return bool */ public function hasLimit() { return true; } /** * Format date column in sql string given an input format that understands Y M D * * @param string $format * @param string|null $column * @return string * @example $db->getDbFunctions()->SQLDate("d/m/Y H:i", "dtcriacao") */ public function sqlDate($format, $column = null) { if (is_null($column)) { $column = 'now()'; } $pattern = [ 'Y' => "%Y", 'y' => "%y", 'M' => "%b", 'm' => "%m", 'Q' => "", 'q' => "", 'D' => "%d", 'd' => "%e", 'h' => "%I", 'H' => "%H", 'i' => "%i", 's' => "%s", 'a' => "%p", 'A' => "%p", ]; $preparedSql = $this->prepareSqlDate($format, $pattern, ''); return sprintf( "DATE_FORMAT(%s,'%s')", $column, implode('', $preparedSql) ); } /** * @param DbDriverInterface $dbdataset * @param string $sql * @param array $param * @return int */ public function executeAndGetInsertedId(DbDriverInterface $dbdataset, $sql, $param) { $returnedId = parent::executeAndGetInsertedId($dbdataset, $sql, $param); $iterator = $dbdataset->getIterator("select LAST_INSERT_ID() id"); if ($iterator->hasNext()) { $singleRow = $iterator->moveNext(); $returnedId = $singleRow->get("id"); } return $returnedId; } public function hasForUpdate() { return true; } } __halt_compiler();----SIGNATURE:----f7NQV5ZO4hs3J9+Fg+Y2rejyQxkQ6ScXteFI3/f9kRPxcdNchEmEYhnyWkyL75TclpBP80J/AIG/QfN6kW9Tq/ieyBi7O5VIwB/LABjVgaklOEOLpIt3btiau5QhZJ4fAigxayy2gSCaJK6pr+K6S1TjToob70Hc8Lp0DC1WcIH6Iq1VWA/3t+UF1y4Gbtj2KoR7Dy+x6D8FlXJJPINwfoKUuSJkZPSOw+bYzwLI3DR7hLWE6mBaQPPdFLFK/k/nZophXA6ZlugvhVwjIwCEd8YpCJshdy9gyWKU9zirMpemESxv5683NCxvG+XlFSasYF7IZIVbKVRT0mRKu23kiR9Eec91r8KyeqYGlbkngV2o1meN79pn7gzr4EGk947cDNUUccRycFVxuwonmu/t4Y7YXn8dxORv3WODjsBglZHUJuhkgudbsShblBcmSo3wsL6PWTnTFQRl0/IpW7QDRNJLYcKZFGUEEgCDQ/GCUgQYZY8EvkWF8yQB/w0COEXJmf1Pj1mKHw24OH22HvSDbuJmalcz+7nVAeXPt/UiqZxAPhqGCJcp9tiWlORehe253dsHk80vFXdJGw3/+yzoj1hH6dwWyIasj8uRWaSkWRNaatfuayqo5WBg3jV8KrVH0dBPFgxxb/QrBX3KAJSulDGA9ehxQoE8wIy1IZT2OT0=----ATTACHMENT:----NTA1NDg2NTIyMzYyNjk3NCA0NTIwMjM1NzYyNjUwMTg3IDMwNjkwMzg1NTQwMjYwMTk=