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