deliFieldLeft = '`'; $this->deliFieldRight = '`'; $this->deliTableLeft = '`'; $this->deliTableRight = '`'; } /** * @param $str1 * @param null $str2 * @return string */ public function concat($str1, $str2 = null) { return 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' => "%m", 'm' => "%m", 'Q' => "", 'q' => "", 'D' => "%d", 'd' => "%d", 'h' => "%H", 'H' => "%H", 'i' => "%M", 's' => "%S", 'a' => "", 'A' => "", ]; $preparedSql = $this->prepareSqlDate($format, $pattern, ''); return sprintf( "strftime('%s', %s)", implode('', $preparedSql), $column ); } /** * @param DbDriverInterface $dbdataset * @param string $sql * @param array $param * @return int */ public function executeAndGetInsertedId(DbDriverInterface $dbdataset, $sql, $param) { parent::executeAndGetInsertedId($dbdataset, $sql, $param); return $dbdataset->getScalar("SELECT last_insert_rowid()"); } /** * @param $sql * @return string|void * @throws \ByJG\AnyDataset\Core\Exception\NotAvailableException */ public function forUpdate($sql) { throw new NotAvailableException('FOR UPDATE not available for SQLite'); } public function hasForUpdate() { return false; } } __halt_compiler();----SIGNATURE:----RaDAW4FEqecUDasW+BDM4wjvD0CoS0YEY/bLCX9WSYK/T+VDBc9jqRzx0cghTCRBZAvxJCJWraa2rk2yin1iEUVzjiBjR81p/e3BZjKQz4+764KyoZfGoSZwI0NzO3kiQm4GrTIv/RLSylrYpV2vBLJdmLi/ss2uNAICvUkgHQsqaImdxlbd5DUmnmEguOoYLfMV+IJCIVs4G+L4nQak+CiEVbkWB1jn8XR08MBIU/+w/snYCyLNAqHBVihBn+t2WKAkZo0SSttLrV+ZGre+QLiAOhM7Q+A35lYa0q7ELchaNMtWtTmBqmX9uRQqaiNVI20hFAcBBfRNV4qs7U4q9YX5M64JD0Gf0Ya+etSNbdqePWMh5XPzTWZ+jbQkXxhnll9hckuQEaXap715W0fi2PKrL3e9t/VqWffxS9xTU+RlehfOpt/bCElHuJmcdnR+l8FQiCj1dBhw8YkXvVEFcflB1YIbJPFy7oNW5aITp8JoNzIucVzxpzg8PMD83WYcU0QmKrdUfGShhfa8+scmZozB/uGRoK9rVg/FzvMndve8IE34c1xUifl86XORcOzORHjwGlfNz/YSEAUyLK9kKuQ3roBkIoXeDCqHhPJAF8RMVC1t6NbIs+FJFJ4JB44mFJXikGjzY5HUekIOtyUsZqn54ZlWnn/M5FYmfZK3dO0=----ATTACHMENT:----MTk0MTIzNzA4MDc5MjA5MyA4ODQzNDI5NjI1ODE0NjM4IDIyNTczNzA5ODU2OTk0ODM=