xref: /PHP-8.1/ext/sqlite3/sqlite3.stub.php (revision 2378f357)
1<?php
2
3/** @generate-class-entries */
4
5/** @not-serializable */
6class SQLite3
7{
8    /**
9     * @implementation-alias SQLite3::open
10     * @no-verify SQLite3::open should really be static
11     */
12    public function __construct(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = "") {}
13
14    /** @tentative-return-type */
15    public function open(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = ""): void {}
16
17    /** @return bool */
18    public function close() {} // TODO make return type void
19
20    /** @tentative-return-type */
21    public static function version(): array {}
22
23    /** @tentative-return-type */
24    public function lastInsertRowID(): int {}
25
26    /** @tentative-return-type */
27    public function lastErrorCode(): int {}
28
29    /** @tentative-return-type */
30    public function lastExtendedErrorCode(): int {}
31
32    /** @tentative-return-type */
33    public function lastErrorMsg(): string {}
34
35    /** @tentative-return-type */
36    public function changes(): int {}
37
38    /** @tentative-return-type */
39    public function busyTimeout(int $milliseconds): bool {}
40
41#ifndef SQLITE_OMIT_LOAD_EXTENSION
42    /** @tentative-return-type */
43    public function loadExtension(string $name): bool {}
44#endif
45
46#if SQLITE_VERSION_NUMBER >= 3006011
47    /** @tentative-return-type */
48    public function backup(SQLite3 $destination, string $sourceDatabase = "main", string $destinationDatabase = "main"): bool {}
49#endif
50
51    /** @tentative-return-type */
52    public static function escapeString(string $string): string {}
53
54    /** @tentative-return-type */
55    public function prepare(string $query): SQLite3Stmt|false {}
56
57    /** @tentative-return-type */
58    public function exec(string $query): bool {}
59
60    /** @tentative-return-type */
61    public function query(string $query): SQLite3Result|false {}
62
63    /** @tentative-return-type */
64    public function querySingle(string $query, bool $entireRow = false): mixed {}
65
66    /** @tentative-return-type */
67    public function createFunction(string $name, callable $callback, int $argCount = -1, int $flags = 0): bool {}
68
69    /** @tentative-return-type */
70    public function createAggregate(string $name, callable $stepCallback, callable $finalCallback, int $argCount = -1): bool {}
71
72    /** @tentative-return-type */
73    public function createCollation(string $name, callable $callback): bool {}
74
75    /** @return resource|false */
76    public function openBlob(string $table, string $column, int $rowid, string $database = "main", int $flags = SQLITE3_OPEN_READONLY) {}
77
78    /** @tentative-return-type */
79    public function enableExceptions(bool $enable = false): bool {}
80
81    /** @tentative-return-type */
82    public function enableExtendedResultCodes(bool $enable = true): bool {}
83
84    /** @tentative-return-type */
85    public function setAuthorizer(?callable $callback): bool {}
86}
87
88/** @not-serializable */
89class SQLite3Stmt
90{
91    private function __construct(SQLite3 $sqlite3, string $query) {}
92
93    /** @tentative-return-type */
94    public function bindParam(string|int $param, mixed &$var, int $type = SQLITE3_TEXT): bool {}
95
96    /** @tentative-return-type */
97    public function bindValue(string|int $param, mixed $value, int $type = SQLITE3_TEXT): bool {}
98
99    /** @tentative-return-type */
100    public function clear(): bool {}
101
102    /** @tentative-return-type */
103    public function close(): bool {}
104
105    /** @tentative-return-type */
106    public function execute(): SQLite3Result|false {}
107
108    /** @tentative-return-type */
109    public function getSQL(bool $expand = false): string|false {}
110
111    /** @tentative-return-type */
112    public function paramCount(): int {}
113
114    /** @tentative-return-type */
115    public function readOnly(): bool {}
116
117    /** @tentative-return-type */
118    public function reset(): bool {}
119}
120
121/** @not-serializable */
122class SQLite3Result
123{
124    private function __construct() {}
125
126    /** @tentative-return-type */
127    public function numColumns(): int {}
128
129    /** @tentative-return-type */
130    public function columnName(int $column): string|false {}
131
132    /** @tentative-return-type */
133    public function columnType(int $column): int|false {}
134
135    /** @tentative-return-type */
136    public function fetchArray(int $mode = SQLITE3_BOTH): array|false {}
137
138    /** @tentative-return-type */
139    public function reset(): bool {}
140
141    /** @return bool */
142    public function finalize() {} // TODO make return type void
143}
144