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