1 | <?php |
||||||
2 | |||||||
3 | namespace Lagdo\DbAdmin\Driver\Sqlite; |
||||||
4 | |||||||
5 | use Lagdo\DbAdmin\Driver\Exception\AuthException; |
||||||
6 | use Lagdo\DbAdmin\Driver\Utils\Utils; |
||||||
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); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() The call to
Lagdo\DbAdmin\Driver\Driver::__construct() has too few arguments starting with options .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
23 | |||||||
24 | $this->server = new Db\Server($this, $this->utils); |
||||||
0 ignored issues
–
show
The call to
Lagdo\DbAdmin\Driver\Sql...b\Server::__construct() has too few arguments starting with trans .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
25 | $this->database = new Db\Database($this, $this->utils); |
||||||
0 ignored issues
–
show
The call to
Lagdo\DbAdmin\Driver\Sql...Database::__construct() has too few arguments starting with trans .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
26 | $this->table = new Db\Table($this, $this->utils); |
||||||
0 ignored issues
–
show
The call to
Lagdo\DbAdmin\Driver\Sql...Db\Table::__construct() has too few arguments starting with trans .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
27 | $this->query = new Db\Query($this, $this->utils); |
||||||
0 ignored issues
–
show
The call to
Lagdo\DbAdmin\Driver\Sql...Db\Query::__construct() has too few arguments starting with trans .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
28 | $this->grammar = new Db\Grammar($this, $this->utils); |
||||||
0 ignored issues
–
show
The call to
Lagdo\DbAdmin\Driver\Sql...\Grammar::__construct() has too few arguments starting with trans .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
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
'SQLite3' of type string is incompatible with the type Lagdo\DbAdmin\Driver\TranslatorInterface expected by parameter $trans of Lagdo\DbAdmin\Driver\Sql...nnection::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() The call to
Lagdo\DbAdmin\Driver\Sql...nnection::__construct() has too few arguments starting with extension .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
82 | return $this->connection = $connection; |
||||||
83 | } |
||||||
84 | if (extension_loaded("pdo_sqlite")) { |
||||||
85 | $connection = new Db\Pdo\Connection($this, $this->utils, 'PDO_SQLite'); |
||||||
0 ignored issues
–
show
'PDO_SQLite' of type string is incompatible with the type Lagdo\DbAdmin\Driver\TranslatorInterface expected by parameter $trans of Lagdo\DbAdmin\Driver\Sql...nnection::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() The call to
Lagdo\DbAdmin\Driver\Sql...nnection::__construct() has too few arguments starting with extension .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
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 |