Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: sdk/lib/web_sql/dart2js/web_sql_dart2js.dart

Issue 14017007: Roll IDLs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * An API for storing data in the browser that can be queried with SQL. 2 * An API for storing data in the browser that can be queried with SQL.
3 * 3 *
4 * **Caution:** this specification is no longer actively maintained by the Web 4 * **Caution:** this specification is no longer actively maintained by the Web
5 * Applications Working Group and may be removed at any time. 5 * Applications Working Group and may be removed at any time.
6 * See [the W3C Web SQL Database specification](http://www.w3.org/TR/webdatabase /) 6 * See [the W3C Web SQL Database specification](http://www.w3.org/TR/webdatabase /)
7 * for more information. 7 * for more information.
8 * 8 *
9 * The [dart:indexed_db] APIs is a recommended alternatives. 9 * The [dart:indexed_db] APIs is a recommended alternatives.
10 */ 10 */
11 library dart.dom.web_sql; 11 library dart.dom.web_sql;
12 12
13 import 'dart:async'; 13 import 'dart:async';
14 import 'dart:collection'; 14 import 'dart:collection';
15 import 'dart:_collection-dev'; 15 import 'dart:_collection-dev';
16 import 'dart:html'; 16 import 'dart:html';
17 import 'dart:html_common'; 17 import 'dart:html_common';
18 import 'dart:_js_helper' show convertDartClosureToJS, Creates, JavaScriptIndexin gBehavior, JSName; 18 import 'dart:_js_helper' show convertDartClosureToJS, Creates, JavaScriptIndexin gBehavior, JSName;
19 import 'dart:_foreign_helper' show JS; 19 import 'dart:_foreign_helper' show JS;
20 // DO NOT EDIT - unless you are editing documentation as per: 20 // DO NOT EDIT - unless you are editing documentation as per:
21 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation 21 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
22 // Auto-generated dart:audio library. 22 // Auto-generated dart:audio library.
23 23
24 24
25 25
26 26
27 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
28 // for details. All rights reserved. Use of this source code is governed by a
29 // BSD-style license that can be found in the LICENSE file.
30
31 // WARNING: Do not edit - generated code.
32
33
34 typedef void DatabaseCallback(database);
Anton Muhin 2013/04/17 18:30:09 Pete, may you take care of proper lib placement vi
35 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
36 // for details. All rights reserved. Use of this source code is governed by a
37 // BSD-style license that can be found in the LICENSE file.
38
39 // WARNING: Do not edit - generated code.
40
41
42 typedef void SqlStatementCallback(SqlTransaction transaction, SqlResultSet resul tSet);
43 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
44 // for details. All rights reserved. Use of this source code is governed by a
45 // BSD-style license that can be found in the LICENSE file.
46
47 // WARNING: Do not edit - generated code.
48
49
50 typedef void SqlStatementErrorCallback(SqlTransaction transaction, SqlError erro r);
51 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
52 // for details. All rights reserved. Use of this source code is governed by a
53 // BSD-style license that can be found in the LICENSE file.
54
55 // WARNING: Do not edit - generated code.
56
57
58 typedef void SqlTransactionCallback(SqlTransaction transaction);
59 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
60 // for details. All rights reserved. Use of this source code is governed by a
61 // BSD-style license that can be found in the LICENSE file.
62
63 // WARNING: Do not edit - generated code.
64
65
66 typedef void SqlTransactionErrorCallback(SqlError error);
67 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
68 // for details. All rights reserved. Use of this source code is governed by a
69 // BSD-style license that can be found in the LICENSE file.
70
71
72 @DocsEditable
73 @DomName('Database')
74 @SupportedBrowser(SupportedBrowser.CHROME)
75 @SupportedBrowser(SupportedBrowser.SAFARI)
76 @Experimental
77 class SqlDatabase native "*Database" {
78
79 /// Checks if this type is supported on the current platform.
80 static bool get supported => JS('bool', '!!(window.openDatabase)');
81
82 @DomName('Database.version')
83 @DocsEditable
84 final String version;
85
86 /**
87 * Atomically update the database version to [newVersion], asynchronously
88 * running [callback] on the [SqlTransaction] representing this
89 * [changeVersion] transaction.
90 *
91 * If [callback] runs successfully, then [successCallback] is called.
92 * Otherwise, [errorCallback] is called.
93 *
94 * [oldVersion] should match the database's current [version] exactly.
95 *
96 * * [Database.changeVersion](http://www.w3.org/TR/webdatabase/#dom-database-c hangeversion) from W3C.
97 */
98 @DomName('Database.changeVersion')
99 @DocsEditable
100 void changeVersion(String oldVersion, String newVersion, [SqlTransactionCallba ck callback, SqlTransactionErrorCallback errorCallback, VoidCallback successCall back]) native;
101
102 @DomName('Database.readTransaction')
103 @DocsEditable
104 void readTransaction(SqlTransactionCallback callback, [SqlTransactionErrorCall back errorCallback, VoidCallback successCallback]) native;
105
106 @DomName('Database.transaction')
107 @DocsEditable
108 void transaction(SqlTransactionCallback callback, [SqlTransactionErrorCallback errorCallback, VoidCallback successCallback]) native;
109 }
110 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
111 // for details. All rights reserved. Use of this source code is governed by a
112 // BSD-style license that can be found in the LICENSE file.
113
114
115 @DocsEditable
116 @DomName('SQLError')
117 class SqlError native "*SQLError" {
118
119 static const int CONSTRAINT_ERR = 6;
120
121 static const int DATABASE_ERR = 1;
122
123 static const int QUOTA_ERR = 4;
124
125 static const int SYNTAX_ERR = 5;
126
127 static const int TIMEOUT_ERR = 7;
128
129 static const int TOO_LARGE_ERR = 3;
130
131 static const int UNKNOWN_ERR = 0;
132
133 static const int VERSION_ERR = 2;
134
135 @DomName('SQLError.code')
136 @DocsEditable
137 final int code;
138
139 @DomName('SQLError.message')
140 @DocsEditable
141 final String message;
142 }
143 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
144 // for details. All rights reserved. Use of this source code is governed by a
145 // BSD-style license that can be found in the LICENSE file.
146
147
148 @DocsEditable
149 @DomName('SQLException')
150 class SqlException native "*SQLException" {
151
152 static const int CONSTRAINT_ERR = 6;
153
154 static const int DATABASE_ERR = 1;
155
156 static const int QUOTA_ERR = 4;
157
158 static const int SYNTAX_ERR = 5;
159
160 static const int TIMEOUT_ERR = 7;
161
162 static const int TOO_LARGE_ERR = 3;
163
164 static const int UNKNOWN_ERR = 0;
165
166 static const int VERSION_ERR = 2;
167
168 @DomName('SQLException.code')
169 @DocsEditable
170 final int code;
171
172 @DomName('SQLException.message')
173 @DocsEditable
174 final String message;
175 }
176 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
177 // for details. All rights reserved. Use of this source code is governed by a
178 // BSD-style license that can be found in the LICENSE file.
179
180
181 @DocsEditable
182 @DomName('SQLResultSet')
183 class SqlResultSet native "*SQLResultSet" {
184
185 @DomName('SQLResultSet.insertId')
186 @DocsEditable
187 final int insertId;
188
189 @DomName('SQLResultSet.rows')
190 @DocsEditable
191 final SqlResultSetRowList rows;
192
193 @DomName('SQLResultSet.rowsAffected')
194 @DocsEditable
195 final int rowsAffected;
196 }
197 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
198 // for details. All rights reserved. Use of this source code is governed by a
199 // BSD-style license that can be found in the LICENSE file.
200
201
202 @DocsEditable
203 @DomName('SQLResultSetRowList')
204 class SqlResultSetRowList implements JavaScriptIndexingBehavior, List<Map> nativ e "*SQLResultSetRowList" {
205
206 @DomName('SQLResultSetRowList.length')
207 @DocsEditable
208 int get length => JS("int", "#.length", this);
209
210 Map operator[](int index) => this.item(index);
211
212 void operator[]=(int index, Map value) {
213 throw new UnsupportedError("Cannot assign element of immutable List.");
214 }
215 // -- start List<Map> mixins.
216 // Map is the element type.
217
218 // From Iterable<Map>:
219
220 Iterator<Map> get iterator {
221 // Note: NodeLists are not fixed size. And most probably length shouldn't
222 // be cached in both iterator _and_ forEach method. For now caching it
223 // for consistency.
224 return new FixedSizeListIterator<Map>(this);
225 }
226
227 Map reduce(Map combine(Map value, Map element)) {
228 return IterableMixinWorkaround.reduce(this, combine);
229 }
230
231 dynamic fold(dynamic initialValue,
232 dynamic combine(dynamic previousValue, Map element)) {
233 return IterableMixinWorkaround.fold(this, initialValue, combine);
234 }
235
236 bool contains(Map element) => IterableMixinWorkaround.contains(this, element);
237
238 void forEach(void f(Map element)) => IterableMixinWorkaround.forEach(this, f);
239
240 String join([String separator = ""]) =>
241 IterableMixinWorkaround.joinList(this, separator);
242
243 Iterable map(f(Map element)) =>
244 IterableMixinWorkaround.mapList(this, f);
245
246 Iterable<Map> where(bool f(Map element)) =>
247 IterableMixinWorkaround.where(this, f);
248
249 Iterable expand(Iterable f(Map element)) =>
250 IterableMixinWorkaround.expand(this, f);
251
252 bool every(bool f(Map element)) => IterableMixinWorkaround.every(this, f);
253
254 bool any(bool f(Map element)) => IterableMixinWorkaround.any(this, f);
255
256 List<Map> toList({ bool growable: true }) =>
257 new List<Map>.from(this, growable: growable);
258
259 Set<Map> toSet() => new Set<Map>.from(this);
260
261 bool get isEmpty => this.length == 0;
262
263 Iterable<Map> take(int n) => IterableMixinWorkaround.takeList(this, n);
264
265 Iterable<Map> takeWhile(bool test(Map value)) {
266 return IterableMixinWorkaround.takeWhile(this, test);
267 }
268
269 Iterable<Map> skip(int n) => IterableMixinWorkaround.skipList(this, n);
270
271 Iterable<Map> skipWhile(bool test(Map value)) {
272 return IterableMixinWorkaround.skipWhile(this, test);
273 }
274
275 Map firstWhere(bool test(Map value), { Map orElse() }) {
276 return IterableMixinWorkaround.firstWhere(this, test, orElse);
277 }
278
279 Map lastWhere(bool test(Map value), {Map orElse()}) {
280 return IterableMixinWorkaround.lastWhereList(this, test, orElse);
281 }
282
283 Map singleWhere(bool test(Map value)) {
284 return IterableMixinWorkaround.singleWhere(this, test);
285 }
286
287 Map elementAt(int index) {
288 return this[index];
289 }
290
291 // From Collection<Map>:
292
293 void add(Map value) {
294 throw new UnsupportedError("Cannot add to immutable List.");
295 }
296
297 void addAll(Iterable<Map> iterable) {
298 throw new UnsupportedError("Cannot add to immutable List.");
299 }
300
301 // From List<Map>:
302 void set length(int value) {
303 throw new UnsupportedError("Cannot resize immutable List.");
304 }
305
306 void clear() {
307 throw new UnsupportedError("Cannot clear immutable List.");
308 }
309
310 Iterable<Map> get reversed {
311 return IterableMixinWorkaround.reversedList(this);
312 }
313
314 void sort([int compare(Map a, Map b)]) {
315 throw new UnsupportedError("Cannot sort immutable List.");
316 }
317
318 int indexOf(Map element, [int start = 0]) =>
319 Lists.indexOf(this, element, start, this.length);
320
321 int lastIndexOf(Map element, [int start]) {
322 if (start == null) start = length - 1;
323 return Lists.lastIndexOf(this, element, start);
324 }
325
326 Map get first {
327 if (this.length > 0) return this[0];
328 throw new StateError("No elements");
329 }
330
331 Map get last {
332 if (this.length > 0) return this[this.length - 1];
333 throw new StateError("No elements");
334 }
335
336 Map get single {
337 if (length == 1) return this[0];
338 if (length == 0) throw new StateError("No elements");
339 throw new StateError("More than one element");
340 }
341
342 void insert(int index, Map element) {
343 throw new UnsupportedError("Cannot add to immutable List.");
344 }
345
346 void insertAll(int index, Iterable<Map> iterable) {
347 throw new UnsupportedError("Cannot add to immutable List.");
348 }
349
350 void setAll(int index, Iterable<Map> iterable) {
351 throw new UnsupportedError("Cannot modify an immutable List.");
352 }
353
354 Map removeAt(int pos) {
355 throw new UnsupportedError("Cannot remove from immutable List.");
356 }
357
358 Map removeLast() {
359 throw new UnsupportedError("Cannot remove from immutable List.");
360 }
361
362 void remove(Object object) {
363 throw new UnsupportedError("Cannot remove from immutable List.");
364 }
365
366 void removeWhere(bool test(Map element)) {
367 throw new UnsupportedError("Cannot remove from immutable List.");
368 }
369
370 void retainWhere(bool test(Map element)) {
371 throw new UnsupportedError("Cannot remove from immutable List.");
372 }
373
374 void setRange(int start, int end, Iterable<Map> iterable, [int skipCount]) {
375 throw new UnsupportedError("Cannot setRange on immutable List.");
376 }
377
378 void removeRange(int start, int end) {
379 throw new UnsupportedError("Cannot removeRange on immutable List.");
380 }
381
382 void replaceRange(int start, int end, Iterable<Map> iterable) {
383 throw new UnsupportedError("Cannot modify an immutable List.");
384 }
385
386 void fillRange(int start, int end, [Map fillValue]) {
387 throw new UnsupportedError("Cannot modify an immutable List.");
388 }
389
390 Iterable<Map> getRange(int start, int end) =>
391 IterableMixinWorkaround.getRangeList(this, start, end);
392
393 List<Map> sublist(int start, [int end]) {
394 if (end == null) end = length;
395 return Lists.getRange(this, start, end, <Map>[]);
396 }
397
398 Map<int, Map> asMap() =>
399 IterableMixinWorkaround.asMapList(this);
400
401 String toString() {
402 StringBuffer buffer = new StringBuffer('[');
403 buffer.writeAll(this, ', ');
404 buffer.write(']');
405 return buffer.toString();
406 }
407
408 // -- end List<Map> mixins.
409
410 @DomName('SQLResultSetRowList.item')
411 @DocsEditable
412 @Creates('=Object')
413 Map item(int index) {
414 return convertNativeToDart_Dictionary(_item_1(index));
415 }
416 @JSName('item')
417 @DomName('SQLResultSetRowList.item')
418 @DocsEditable
419 @Creates('=Object')
420 _item_1(index) native;
421 }
422 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
423 // for details. All rights reserved. Use of this source code is governed by a
424 // BSD-style license that can be found in the LICENSE file.
425
426
427 @DocsEditable
428 @DomName('SQLTransaction')
429 @SupportedBrowser(SupportedBrowser.CHROME)
430 @SupportedBrowser(SupportedBrowser.SAFARI)
431 @Experimental
432 class SqlTransaction native "*SQLTransaction" {
433
434 @DomName('SQLTransaction.executeSql')
435 @DocsEditable
436 void executeSql(String sqlStatement, List arguments, [SqlStatementCallback cal lback, SqlStatementErrorCallback errorCallback]) native;
437 }
438 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
439 // for details. All rights reserved. Use of this source code is governed by a
440 // BSD-style license that can be found in the LICENSE file.
441
442
443 @DocsEditable
444 @DomName('DatabaseSync')
445 @SupportedBrowser(SupportedBrowser.CHROME)
446 @SupportedBrowser(SupportedBrowser.SAFARI)
447 @Experimental
448 abstract class _DatabaseSync native "*DatabaseSync" {
449 }
450 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
451 // for details. All rights reserved. Use of this source code is governed by a
452 // BSD-style license that can be found in the LICENSE file.
453
454
455 @DocsEditable
456 @DomName('SQLTransactionSync')
457 @SupportedBrowser(SupportedBrowser.CHROME)
458 @SupportedBrowser(SupportedBrowser.SAFARI)
459 @Experimental
460 abstract class _SQLTransactionSync native "*SQLTransactionSync" {
461 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698