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:----MMfw4bS0gQamFqVWP212iOOXJcBNfMimsL/sujiHxdVD8Y0WXybXgrxupkCKRzRLPpGhbSOhJdOY8lUM63c05gHftl4ZlmdrWgQ1HZHLdvl+Qe146POCLv5gkKiv7T3Y4XyG2DTCeDixcaez82rLm9okS4LU4VBmZ5v52UgXuge/AWHb6vAoLBwECKk2wk5jj6nes3ZdDfrU8A2kpJxt85dNkeuxlXJ/1RxRH1om7KFICyD8yYWBqFEZcdqowEUppVWbTudmF3BGo5Nv7TBT+GgWLoontl9q6mRIQ+cgiLzUSM4vZkl+v8gyXjPTlSkQwmpRaGpBOT7hftI/MvYQ23RJ/va5gN37OQesSRZPvL35ygX8lx7drFXm3rpDE2SKrhMwA+UGNIEna7ofp4cgQfD56Ov+a9YV9gvyNdRICCM69PhQV3cGfMXLAMHftIy5i2LRyc0TmyqDszf3/M9l1qTRVKlbBKRK2rrL82bF7yIVNdKFN9ZuOLhPsp6aWOz349uOVVDBMNfgpV691ae0VArALpbaBKb7cB7Qxbru/vHGoO+mrke1bIVvXpmP4OF96mcAW6ar91+86EuSeAbw0YG617gSpb2kAlWn2yd7FmytmM4AqCJDrszZ0AoaDvcTg7XXRMkBgn8rAzRhHgqECfBTjDVQUMkOl44rr49hbzU=----ATTACHMENT:----NTU2ODEyMTI1NDk5MjQ5NSAzNTQyNjYwMzI1OTY3NzQxIDg5OTAwMjY1ODUyNzU2Ng==