xref: /PHP-8.2/ext/sqlite3/sqlite3.stub.php (revision 148ac364)
1<?php
2
3/** @generate-class-entries */
4
5/**
6 * @var int
7 * @cvalue PHP_SQLITE3_ASSOC
8 */
9const SQLITE3_ASSOC = UNKNOWN;
10/**
11 * @var int
12 * @cvalue PHP_SQLITE3_NUM
13 */
14const SQLITE3_NUM = UNKNOWN;
15/**
16 * @var int
17 * @cvalue PHP_SQLITE3_BOTH
18 */
19const SQLITE3_BOTH = UNKNOWN;
20
21/**
22 * @var int
23 * @cvalue SQLITE_INTEGER
24 */
25const SQLITE3_INTEGER = UNKNOWN;
26/**
27 * @var int
28 * @cvalue SQLITE_FLOAT
29 */
30const SQLITE3_FLOAT = UNKNOWN;
31/**
32 * @var int
33 * @cvalue SQLITE3_TEXT
34 */
35const SQLITE3_TEXT = UNKNOWN;
36/**
37 * @var int
38 * @cvalue SQLITE_BLOB
39 */
40const SQLITE3_BLOB = UNKNOWN;
41/**
42 * @var int
43 * @cvalue SQLITE_NULL
44 */
45const SQLITE3_NULL = UNKNOWN;
46
47/**
48 * @var int
49 * @cvalue SQLITE_OPEN_READONLY
50 */
51const SQLITE3_OPEN_READONLY = UNKNOWN;
52/**
53 * @var int
54 * @cvalue SQLITE_OPEN_READWRITE
55 */
56const SQLITE3_OPEN_READWRITE = UNKNOWN;
57/**
58 * @var int
59 * @cvalue SQLITE_OPEN_CREATE
60 */
61const SQLITE3_OPEN_CREATE = UNKNOWN;
62
63#ifdef SQLITE_DETERMINISTIC
64/**
65 * @var int
66 * @cvalue SQLITE_DETERMINISTIC
67 */
68const SQLITE3_DETERMINISTIC = UNKNOWN;
69#endif
70
71/** @not-serializable */
72class SQLite3
73{
74    /**
75     * @var int
76     * @cvalue SQLITE_OK
77     * @link sqlite3.class.constants.ok
78     */
79    public const OK = UNKNOWN;
80
81    /* Constants for authorizer return */
82
83    /**
84     * @var int
85     * @cvalue SQLITE_DENY
86     * @link sqlite3.class.constants.deny
87     */
88    public const DENY = UNKNOWN;
89    /**
90     * @var int
91     * @cvalue SQLITE_IGNORE
92     * @link sqlite3.class.constants.ignore
93     */
94    public const IGNORE = UNKNOWN;
95
96    /* Constants for authorizer actions */
97
98    /**
99     * @var int
100     * @cvalue SQLITE_CREATE_INDEX
101     * @link sqlite3.class.constants.create-index
102     */
103    public const CREATE_INDEX = UNKNOWN;
104    /**
105     * @var int
106     * @cvalue SQLITE_CREATE_TABLE
107     * @link sqlite3.class.constants.create-table
108     */
109    public const CREATE_TABLE = UNKNOWN;
110    /**
111     * @var int
112     * @cvalue SQLITE_CREATE_TEMP_INDEX
113     * @link sqlite3.class.constants.create-temp-index
114     */
115    public const CREATE_TEMP_INDEX = UNKNOWN;
116    /**
117     * @var int
118     * @cvalue SQLITE_CREATE_TEMP_TABLE
119     * @link sqlite3.class.constants.create-temp-table
120     */
121    public const CREATE_TEMP_TABLE = UNKNOWN;
122    /**
123     * @var int
124     * @cvalue SQLITE_CREATE_TEMP_TRIGGER
125     * @link sqlite3.class.constants.create-temp-trigger
126     */
127    public const CREATE_TEMP_TRIGGER = UNKNOWN;
128    /**
129     * @var int
130     * @cvalue SQLITE_CREATE_TEMP_VIEW
131     * @link sqlite3.class.constants.create-temp-view
132     */
133    public const CREATE_TEMP_VIEW = UNKNOWN;
134    /**
135     * @var int
136     * @cvalue SQLITE_CREATE_TRIGGER
137     * @link sqlite3.class.constants.create-trigger
138     */
139    public const CREATE_TRIGGER = UNKNOWN;
140    /**
141     * @var int
142     * @cvalue SQLITE_CREATE_VIEW
143     * @link sqlite3.class.constants.create-view
144     */
145    public const CREATE_VIEW = UNKNOWN;
146    /**
147     * @var int
148     * @cvalue SQLITE_DELETE
149     * @link sqlite3.class.constants.delete
150     */
151    public const DELETE = UNKNOWN;
152    /**
153     * @var int
154     * @cvalue SQLITE_DROP_INDEX
155     * @link sqlite3.class.constants.drop-index
156     */
157    public const DROP_INDEX = UNKNOWN;
158    /**
159     * @var int
160     * @cvalue SQLITE_DROP_TABLE
161     * @link sqlite3.class.constants.drop-table
162     */
163    public const DROP_TABLE = UNKNOWN;
164    /**
165     * @var int
166     * @cvalue SQLITE_DROP_TEMP_INDEX
167     * @link sqlite3.class.constants.drop-temp-index
168     */
169    public const DROP_TEMP_INDEX = UNKNOWN;
170    /**
171     * @var int
172     * @cvalue SQLITE_DROP_TEMP_TABLE
173     * @link sqlite3.class.constants.drop-temp-table
174     */
175    public const DROP_TEMP_TABLE = UNKNOWN;
176    /**
177     * @var int
178     * @cvalue SQLITE_DROP_TEMP_TRIGGER
179     * @link sqlite3.class.constants.drop-temp-trigger
180     */
181    public const DROP_TEMP_TRIGGER = UNKNOWN;
182    /**
183     * @var int
184     * @cvalue SQLITE_DROP_TEMP_VIEW
185     * @link sqlite3.class.constants.drop-temp-view
186     */
187    public const DROP_TEMP_VIEW = UNKNOWN;
188    /**
189     * @var int
190     * @cvalue SQLITE_DROP_TRIGGER
191     * @link sqlite3.class.constants.drop-trigger
192     */
193    public const DROP_TRIGGER = UNKNOWN;
194    /**
195     * @var int
196     * @cvalue SQLITE_DROP_VIEW
197     * @link sqlite3.class.constants.drop-view
198     */
199    public const DROP_VIEW = UNKNOWN;
200    /**
201     * @var int
202     * @cvalue SQLITE_INSERT
203     * @link sqlite3.class.constants.insert
204     */
205    public const INSERT = UNKNOWN;
206    /**
207     * @var int
208     * @cvalue SQLITE_PRAGMA
209     * @link sqlite3.class.constants.pragma
210     */
211    public const PRAGMA = UNKNOWN;
212    /**
213     * @var int
214     * @cvalue SQLITE_READ
215     * @link sqlite3.class.constants.read
216     */
217    public const READ = UNKNOWN;
218    /**
219     * @var int
220     * @cvalue SQLITE_SELECT
221     * @link sqlite3.class.constants.select
222     */
223    public const SELECT = UNKNOWN;
224    /**
225     * @var int
226     * @cvalue SQLITE_TRANSACTION
227     * @link sqlite3.class.constants.transaction
228     */
229    public const TRANSACTION = UNKNOWN;
230    /**
231     * @var int
232     * @cvalue SQLITE_UPDATE
233     * @link sqlite3.class.constants.update
234     */
235    public const UPDATE = UNKNOWN;
236    /**
237     * @var int
238     * @cvalue SQLITE_ATTACH
239     * @link sqlite3.class.constants.attach
240     */
241    public const ATTACH = UNKNOWN;
242    /**
243     * @var int
244     * @cvalue SQLITE_DETACH
245     * @link sqlite3.class.constants.detach
246     */
247    public const DETACH = UNKNOWN;
248    /**
249     * @var int
250     * @cvalue SQLITE_ALTER_TABLE
251     * @link sqlite3.class.constants.alter-table
252     */
253    public const ALTER_TABLE = UNKNOWN;
254    /**
255     * @var int
256     * @cvalue SQLITE_REINDEX
257     * @link sqlite3.class.constants.reindex
258     */
259    public const REINDEX = UNKNOWN;
260    /**
261     * @var int
262     * @cvalue SQLITE_ANALYZE
263     * @link sqlite3.class.constants.analyze
264     */
265    public const ANALYZE = UNKNOWN;
266    /**
267     * @var int
268     * @cvalue SQLITE_CREATE_VTABLE
269     * @link sqlite3.class.constants.create-vtable
270     */
271    public const CREATE_VTABLE = UNKNOWN;
272    /**
273     * @var int
274     * @cvalue SQLITE_DROP_VTABLE
275     * @link sqlite3.class.constants.drop-vtable
276     */
277    public const DROP_VTABLE = UNKNOWN;
278    /**
279     * @var int
280     * @cvalue SQLITE_FUNCTION
281     * @link sqlite3.class.constants.function
282     */
283    public const FUNCTION = UNKNOWN;
284    /**
285     * @var int
286     * @cvalue SQLITE_SAVEPOINT
287     * @link sqlite3.class.constants.savepoint
288     */
289    public const SAVEPOINT = UNKNOWN;
290    /**
291     * @var int
292     * @cvalue SQLITE_COPY
293     * @link sqlite3.class.constants.copy
294     */
295    public const COPY = UNKNOWN;
296#ifdef SQLITE_RECURSIVE
297    /**
298     * @var int
299     * @cvalue SQLITE_RECURSIVE
300     * @link sqlite3.class.constants.recursive
301     */
302    public const RECURSIVE = UNKNOWN;
303#endif
304
305    /**
306     * @implementation-alias SQLite3::open
307     * @no-verify SQLite3::open should really be static
308     */
309    public function __construct(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = "") {}
310
311    /** @tentative-return-type */
312    public function open(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = ""): void {}
313
314    /** @return bool */
315    public function close() {} // TODO make return type void
316
317    /** @tentative-return-type */
318    public static function version(): array {}
319
320    /** @tentative-return-type */
321    public function lastInsertRowID(): int {}
322
323    /** @tentative-return-type */
324    public function lastErrorCode(): int {}
325
326    /** @tentative-return-type */
327    public function lastExtendedErrorCode(): int {}
328
329    /** @tentative-return-type */
330    public function lastErrorMsg(): string {}
331
332    /** @tentative-return-type */
333    public function changes(): int {}
334
335    /** @tentative-return-type */
336    public function busyTimeout(int $milliseconds): bool {}
337
338#ifndef SQLITE_OMIT_LOAD_EXTENSION
339    /** @tentative-return-type */
340    public function loadExtension(string $name): bool {}
341#endif
342
343#if SQLITE_VERSION_NUMBER >= 3006011
344    /** @tentative-return-type */
345    public function backup(SQLite3 $destination, string $sourceDatabase = "main", string $destinationDatabase = "main"): bool {}
346#endif
347
348    /** @tentative-return-type */
349    public static function escapeString(string $string): string {}
350
351    /** @tentative-return-type */
352    public function prepare(string $query): SQLite3Stmt|false {}
353
354    /** @tentative-return-type */
355    public function exec(string $query): bool {}
356
357    /** @tentative-return-type */
358    public function query(string $query): SQLite3Result|false {}
359
360    /** @tentative-return-type */
361    public function querySingle(string $query, bool $entireRow = false): mixed {}
362
363    /** @tentative-return-type */
364    public function createFunction(string $name, callable $callback, int $argCount = -1, int $flags = 0): bool {}
365
366    /** @tentative-return-type */
367    public function createAggregate(string $name, callable $stepCallback, callable $finalCallback, int $argCount = -1): bool {}
368
369    /** @tentative-return-type */
370    public function createCollation(string $name, callable $callback): bool {}
371
372    /** @return resource|false */
373    public function openBlob(string $table, string $column, int $rowid, string $database = "main", int $flags = SQLITE3_OPEN_READONLY) {}
374
375    /** @tentative-return-type */
376    public function enableExceptions(bool $enable = false): bool {}
377
378    /** @tentative-return-type */
379    public function enableExtendedResultCodes(bool $enable = true): bool {}
380
381    /** @tentative-return-type */
382    public function setAuthorizer(?callable $callback): bool {}
383}
384
385/** @not-serializable */
386class SQLite3Stmt
387{
388    private function __construct(SQLite3 $sqlite3, string $query) {}
389
390    /** @tentative-return-type */
391    public function bindParam(string|int $param, mixed &$var, int $type = SQLITE3_TEXT): bool {}
392
393    /** @tentative-return-type */
394    public function bindValue(string|int $param, mixed $value, int $type = SQLITE3_TEXT): bool {}
395
396    /** @tentative-return-type */
397    public function clear(): bool {}
398
399    /** @tentative-return-type */
400    public function close(): bool {}
401
402    /** @tentative-return-type */
403    public function execute(): SQLite3Result|false {}
404
405    /** @tentative-return-type */
406    public function getSQL(bool $expand = false): string|false {}
407
408    /** @tentative-return-type */
409    public function paramCount(): int {}
410
411    /** @tentative-return-type */
412    public function readOnly(): bool {}
413
414    /** @tentative-return-type */
415    public function reset(): bool {}
416}
417
418/** @not-serializable */
419class SQLite3Result
420{
421    private function __construct() {}
422
423    /** @tentative-return-type */
424    public function numColumns(): int {}
425
426    /** @tentative-return-type */
427    public function columnName(int $column): string|false {}
428
429    /** @tentative-return-type */
430    public function columnType(int $column): int|false {}
431
432    /** @tentative-return-type */
433    public function fetchArray(int $mode = SQLITE3_BOTH): array|false {}
434
435    /** @tentative-return-type */
436    public function reset(): bool {}
437
438    /** @return bool */
439    public function finalize() {} // TODO make return type void
440}
441