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