1export interface Window { 2 openDatabase?: (name: string, version: string, displayName: string, estimatedSize: number, creationCallback?: DatabaseCallback) => Database; 3} 4export interface DatabaseCallback { 5 (database: Database): void; 6} 7export interface Database { 8 version: string; 9 transaction(callback: SQLTransactionCallback, errorCallback?: SQLTransactionErrorCallback, successCallback?: SQLVoidCallback): void; 10 readTransaction(callback: SQLTransactionCallback, errorCallback?: SQLTransactionErrorCallback, successCallback?: SQLVoidCallback): void; 11} 12export interface SQLVoidCallback { 13 (): void; 14} 15export interface SQLTransactionCallback { 16 (transaction: SQLTransaction): void; 17} 18export interface SQLTransactionErrorCallback { 19 (error: SQLError): void; 20} 21export interface SQLTransaction { 22 executeSql(sqlStatement: string, args?: any[], callback?: SQLStatementCallback, errorCallback?: SQLStatementErrorCallback): void; 23} 24export interface SQLStatementCallback { 25 (transaction: SQLTransaction, resultSet: SQLResultSet): void; 26} 27export interface SQLStatementErrorCallback { 28 (transaction: SQLTransaction, error: SQLError): boolean; 29} 30export interface SQLResultSet { 31 insertId: number; 32 rowsAffected: number; 33 rows: SQLResultSetRowList; 34} 35export interface SQLResultSetRowList { 36 length: number; 37 item(index: number): any; 38} 39export declare class SQLError { 40 static UNKNOWN_ERR: number; 41 static DATABASE_ERR: number; 42 static VERSION_ERR: number; 43 static TOO_LARGE_ERR: number; 44 static QUOTA_ERR: number; 45 static SYNTAX_ERR: number; 46 static CONSTRAINT_ERR: number; 47 static TIMEOUT_ERR: number; 48 code: number; 49 message: string; 50} 51export interface WebSQLDatabase extends Database { 52 exec(queries: Query[], readOnly: boolean, callback: SQLiteCallback): void; 53} 54export declare type Query = { 55 sql: string; 56 args: unknown[]; 57}; 58export interface ResultSetError { 59 error: Error; 60} 61export interface ResultSet { 62 insertId?: number; 63 rowsAffected: number; 64 rows: { 65 [column: string]: any; 66 }[]; 67} 68export declare type SQLiteCallback = (error?: Error | null, resultSet?: (ResultSetError | ResultSet)[]) => void; 69