1 | <?php |
||
2 | |||
3 | namespace Lagdo\DbAdmin\Driver\Sqlite; |
||
4 | |||
5 | use Lagdo\DbAdmin\Driver\Exception\AuthException; |
||
6 | use Lagdo\DbAdmin\Driver\Utils\Utils; |
||
0 ignored issues
–
show
|
|||
7 | use Lagdo\DbAdmin\Driver\Driver as AbstractDriver; |
||
8 | |||
9 | use function class_exists; |
||
10 | use function extension_loaded; |
||
11 | |||
12 | class Driver extends AbstractDriver |
||
13 | { |
||
14 | /** |
||
15 | * The constructor |
||
16 | * |
||
17 | * @param Utils $utils |
||
18 | * @param array $options |
||
19 | */ |
||
20 | public function __construct(Utils $utils, array $options) |
||
21 | { |
||
22 | parent::__construct($utils, $options); |
||
23 | |||
24 | $this->server = new Db\Server($this, $this->utils); |
||
0 ignored issues
–
show
|
|||
25 | $this->database = new Db\Database($this, $this->utils); |
||
26 | $this->table = new Db\Table($this, $this->utils); |
||
27 | $this->query = new Db\Query($this, $this->utils); |
||
28 | $this->grammar = new Db\Grammar($this, $this->utils); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @inheritDoc |
||
33 | */ |
||
34 | public function name() |
||
35 | { |
||
36 | return "SQLite 3"; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @inheritDoc |
||
41 | */ |
||
42 | protected function beforeConnectConfig() |
||
43 | { |
||
44 | // Init config |
||
45 | $this->config->jush = 'sqlite'; |
||
46 | $this->config->drivers = ["SQLite3", "PDO_SQLite"]; |
||
47 | $this->config->setTypes([ //! arrays |
||
48 | 'Numbers' => ["integer" => 0, "real" => 0, "numeric" => 0], |
||
49 | 'Strings' => ["text" => 0], |
||
50 | 'Binary' => ["blob" => 0], |
||
51 | ]); |
||
52 | // $this->config->unsigned = []; |
||
53 | $this->config->operators = ["=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", |
||
54 | "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"]; // REGEXP can be user defined function; |
||
55 | $this->config->functions = ["hex", "length", "lower", "round", "unixepoch", "upper"]; |
||
56 | $this->config->grouping = ["avg", "count", "count distinct", "group_concat", "max", "min", "sum"]; |
||
57 | $this->config->editFunctions = [[ |
||
58 | // "text" => "date('now')/time('now')/datetime('now')", |
||
59 | ],[ |
||
60 | "integer|real|numeric" => "+/-", |
||
61 | // "text" => "date/time/datetime", |
||
62 | "text" => "||", |
||
63 | ]]; |
||
64 | $this->config->features = ['columns', 'database', 'drop_col', 'dump', 'indexes', 'descidx', |
||
65 | 'move_col', 'sql', 'status', 'table', 'trigger', 'variables', 'view', 'view_trigger']; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @inheritDoc |
||
70 | */ |
||
71 | protected function afterConnectConfig() |
||
72 | {} |
||
73 | |||
74 | /** |
||
75 | * @inheritDoc |
||
76 | * @throws AuthException |
||
77 | */ |
||
78 | protected function createConnection() |
||
79 | { |
||
80 | if (!$this->options('prefer_pdo', false) && class_exists("SQLite3")) { |
||
81 | $connection = new Db\Sqlite\Connection($this, $this->utils, 'SQLite3'); |
||
0 ignored issues
–
show
|
|||
82 | return $this->connection = $connection; |
||
83 | } |
||
84 | if (extension_loaded("pdo_sqlite")) { |
||
85 | $connection = new Db\Pdo\Connection($this, $this->utils, 'PDO_SQLite'); |
||
86 | return $this->connection = $connection; |
||
87 | } |
||
88 | throw new AuthException($this->utils->trans->lang('No package installed to open a Sqlite database.')); |
||
89 | } |
||
90 | } |
||
91 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths