Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Jun 15, 2022
1 parent ff9692b commit fbfd901
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.idea
/.vscode
/vendor
composer.lock
composer.lock
identifier.sqlite
15 changes: 10 additions & 5 deletions src/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Throwable;
use WorkBunny\Storage\Exceptions\StorageException;

final class Driver
class Driver
{
/** @see gettype() @var array 类型映射 */
protected array $_typeMap = [
Expand Down Expand Up @@ -379,7 +379,7 @@ public function insert(string $table, array $values): ?SQLite3Result
/**
* @param callable $actions
* @return void
* @throws Throwable
* @throws StorageException
*/
public function action(callable $actions): void
{
Expand All @@ -392,7 +392,7 @@ public function action(callable $actions): void
}
} catch (Throwable $e) {
$this->rollback();
throw $e;
throw new StorageException($e->getMessage(), $e->getCode(), $e);
}
}

Expand Down Expand Up @@ -458,14 +458,19 @@ public function commit(){
}

/**
* @param bool $expend
* @return array = [ (string|null) LAST_SQL, (float) LAST_DURATION ]
*/
public function last(): array
public function last(bool $expend = false): array
{
return [$this->_lastSQL, $this->_lastDuration];
return [
$expend ? $this->generate($this->_lastSQL, $this->_lastMap) : $this->_lastSQL,
$this->_lastDuration
];
}

/**
* @todo 大字符串的执行效率比较低
* @param string $statement
* @param array $map
* @return string
Expand Down

0 comments on commit fbfd901

Please sign in to comment.