You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-3Lines changed: 45 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,12 +33,36 @@ Inspired/compatible with [react-native-sqlite-storage](https://github.com/andpor
33
33
34
34
```typescript
35
35
interfaceQueryResult {
36
-
status:0|1; // 0 for correct execution
37
-
message:string; // if status === 1, here you will find error description
38
-
rows:any[];
36
+
status?:0|1; // 0 for correct execution
39
37
insertId?:number;
38
+
rowsAffected:number;
39
+
message?:string;
40
+
rows?: {
41
+
/** Raw array with all dataset */
42
+
_array:any[];
43
+
/** The lengh of the dataset */
44
+
length:number;
45
+
};
46
+
/**
47
+
* Query metadata, avaliable only for select query results
48
+
*/
49
+
metadata?:ColumnMetadata[];
40
50
}
41
51
52
+
/**
53
+
* Column metadata
54
+
* Describes some information about columns fetched by the query
55
+
*/
56
+
declaretypeColumnMetadata= {
57
+
/** The name used for this column for this resultset */
58
+
columnName:string;
59
+
/** The declared column type for this column, when fetched directly from a table or a View resulting from a table column. "UNKNOWN" for dynamic values, like function returned ones. */
60
+
columnDeclaredType:string;
61
+
/**
62
+
* The index for this column for this resultset*/
63
+
columnIndex:number;
64
+
};
65
+
42
66
interfaceBatchQueryResult {
43
67
status?:0|1;
44
68
rowsAffected?:number;
@@ -116,6 +140,24 @@ if (!result.status) {
116
140
}
117
141
```
118
142
143
+
In some scenarios, dynamic applications may need to get some metadata information about the returned resultset.
144
+
This can be done testing the returned data directly, but in some cases may not be enough, like when data is stored outside
145
+
storage datatypes, like booleans or datetimes. When fetching data directly from tables or views linked to table columns, SQLite is able
146
+
to identify the table declared types:
147
+
148
+
```typescript
149
+
let result =sqlite.executeSql('myDatabase', 'SELECT int_column_1, bol_column_2 FROM sometable');
Copy file name to clipboardExpand all lines: src/index.ts
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,26 @@ interface QueryResult {
40
40
*/
41
41
item: (idx: number)=>any;
42
42
};
43
+
/**
44
+
* Query metadata, avaliable only for select query results
45
+
*/
46
+
metadata?: ColumnMetadata[];
43
47
}
44
48
49
+
/**
50
+
* Column metadata
51
+
* Describes some information about columns fetched by the query
52
+
*/
53
+
declaretypeColumnMetadata={
54
+
/** The name used for this column for this resultset */
55
+
columnName: string;
56
+
/** The declared column type for this column, when fetched directly from a table or a View resulting from a table column. "UNKNOWN" for dynamic values, like function returned ones. */
0 commit comments