| 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 */ |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 @DocsEditable | 186 @DocsEditable |
| 187 final int rowsAffected; | 187 final int rowsAffected; |
| 188 } | 188 } |
| 189 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 189 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 190 // for details. All rights reserved. Use of this source code is governed by a | 190 // for details. All rights reserved. Use of this source code is governed by a |
| 191 // BSD-style license that can be found in the LICENSE file. | 191 // BSD-style license that can be found in the LICENSE file. |
| 192 | 192 |
| 193 | 193 |
| 194 @DocsEditable | 194 @DocsEditable |
| 195 @DomName('SQLResultSetRowList') | 195 @DomName('SQLResultSetRowList') |
| 196 class SqlResultSetRowList implements JavaScriptIndexingBehavior, List<Map> nativ
e "SQLResultSetRowList" { | 196 class SqlResultSetRowList extends Object with ListMixin<Map>, ImmutableListMixin
<Map> implements JavaScriptIndexingBehavior, List<Map> native "SQLResultSetRowLi
st" { |
| 197 | 197 |
| 198 @DomName('SQLResultSetRowList.length') | 198 @DomName('SQLResultSetRowList.length') |
| 199 @DocsEditable | 199 @DocsEditable |
| 200 int get length => JS("int", "#.length", this); | 200 int get length => JS("int", "#.length", this); |
| 201 | 201 |
| 202 Map operator[](int index) => this.item(index); | 202 Map operator[](int index) => this.item(index); |
| 203 | 203 |
| 204 void operator[]=(int index, Map value) { | 204 void operator[]=(int index, Map value) { |
| 205 throw new UnsupportedError("Cannot assign element of immutable List."); | 205 throw new UnsupportedError("Cannot assign element of immutable List."); |
| 206 } | 206 } |
| 207 // -- start List<Map> mixins. | 207 // -- start List<Map> mixins. |
| 208 // Map is the element type. | 208 // Map is the element type. |
| 209 | 209 |
| 210 // From Iterable<Map>: | |
| 211 | 210 |
| 212 Iterator<Map> get iterator { | |
| 213 // Note: NodeLists are not fixed size. And most probably length shouldn't | |
| 214 // be cached in both iterator _and_ forEach method. For now caching it | |
| 215 // for consistency. | |
| 216 return new FixedSizeListIterator<Map>(this); | |
| 217 } | |
| 218 | |
| 219 Map reduce(Map combine(Map value, Map element)) { | |
| 220 return IterableMixinWorkaround.reduce(this, combine); | |
| 221 } | |
| 222 | |
| 223 dynamic fold(dynamic initialValue, | |
| 224 dynamic combine(dynamic previousValue, Map element)) { | |
| 225 return IterableMixinWorkaround.fold(this, initialValue, combine); | |
| 226 } | |
| 227 | |
| 228 bool contains(Map element) => IterableMixinWorkaround.contains(this, element); | |
| 229 | |
| 230 void forEach(void f(Map element)) => IterableMixinWorkaround.forEach(this, f); | |
| 231 | |
| 232 String join([String separator = ""]) => | |
| 233 IterableMixinWorkaround.joinList(this, separator); | |
| 234 | |
| 235 Iterable map(f(Map element)) => | |
| 236 IterableMixinWorkaround.mapList(this, f); | |
| 237 | |
| 238 Iterable<Map> where(bool f(Map element)) => | |
| 239 IterableMixinWorkaround.where(this, f); | |
| 240 | |
| 241 Iterable expand(Iterable f(Map element)) => | |
| 242 IterableMixinWorkaround.expand(this, f); | |
| 243 | |
| 244 bool every(bool f(Map element)) => IterableMixinWorkaround.every(this, f); | |
| 245 | |
| 246 bool any(bool f(Map element)) => IterableMixinWorkaround.any(this, f); | |
| 247 | |
| 248 List<Map> toList({ bool growable: true }) => | |
| 249 new List<Map>.from(this, growable: growable); | |
| 250 | |
| 251 Set<Map> toSet() => new Set<Map>.from(this); | |
| 252 | |
| 253 bool get isEmpty => this.length == 0; | |
| 254 | |
| 255 Iterable<Map> take(int n) => IterableMixinWorkaround.takeList(this, n); | |
| 256 | |
| 257 Iterable<Map> takeWhile(bool test(Map value)) { | |
| 258 return IterableMixinWorkaround.takeWhile(this, test); | |
| 259 } | |
| 260 | |
| 261 Iterable<Map> skip(int n) => IterableMixinWorkaround.skipList(this, n); | |
| 262 | |
| 263 Iterable<Map> skipWhile(bool test(Map value)) { | |
| 264 return IterableMixinWorkaround.skipWhile(this, test); | |
| 265 } | |
| 266 | |
| 267 Map firstWhere(bool test(Map value), { Map orElse() }) { | |
| 268 return IterableMixinWorkaround.firstWhere(this, test, orElse); | |
| 269 } | |
| 270 | |
| 271 Map lastWhere(bool test(Map value), {Map orElse()}) { | |
| 272 return IterableMixinWorkaround.lastWhereList(this, test, orElse); | |
| 273 } | |
| 274 | |
| 275 Map singleWhere(bool test(Map value)) { | |
| 276 return IterableMixinWorkaround.singleWhere(this, test); | |
| 277 } | |
| 278 | |
| 279 Map elementAt(int index) { | |
| 280 return this[index]; | |
| 281 } | |
| 282 | |
| 283 // From Collection<Map>: | |
| 284 | |
| 285 void add(Map value) { | |
| 286 throw new UnsupportedError("Cannot add to immutable List."); | |
| 287 } | |
| 288 | |
| 289 void addAll(Iterable<Map> iterable) { | |
| 290 throw new UnsupportedError("Cannot add to immutable List."); | |
| 291 } | |
| 292 | |
| 293 // From List<Map>: | |
| 294 void set length(int value) { | 211 void set length(int value) { |
| 295 throw new UnsupportedError("Cannot resize immutable List."); | 212 throw new UnsupportedError("Cannot resize immutable List."); |
| 296 } | 213 } |
| 297 | 214 |
| 298 void clear() { | |
| 299 throw new UnsupportedError("Cannot clear immutable List."); | |
| 300 } | |
| 301 | |
| 302 Iterable<Map> get reversed { | |
| 303 return IterableMixinWorkaround.reversedList(this); | |
| 304 } | |
| 305 | |
| 306 void sort([int compare(Map a, Map b)]) { | |
| 307 throw new UnsupportedError("Cannot sort immutable List."); | |
| 308 } | |
| 309 | |
| 310 int indexOf(Map element, [int start = 0]) => | |
| 311 Lists.indexOf(this, element, start, this.length); | |
| 312 | |
| 313 int lastIndexOf(Map element, [int start]) { | |
| 314 if (start == null) start = length - 1; | |
| 315 return Lists.lastIndexOf(this, element, start); | |
| 316 } | |
| 317 | |
| 318 Map get first { | |
| 319 if (this.length > 0) return this[0]; | |
| 320 throw new StateError("No elements"); | |
| 321 } | |
| 322 | |
| 323 Map get last { | |
| 324 if (this.length > 0) return this[this.length - 1]; | |
| 325 throw new StateError("No elements"); | |
| 326 } | |
| 327 | |
| 328 Map get single { | |
| 329 if (length == 1) return this[0]; | |
| 330 if (length == 0) throw new StateError("No elements"); | |
| 331 throw new StateError("More than one element"); | |
| 332 } | |
| 333 | |
| 334 void insert(int index, Map element) { | |
| 335 throw new UnsupportedError("Cannot add to immutable List."); | |
| 336 } | |
| 337 | |
| 338 void insertAll(int index, Iterable<Map> iterable) { | |
| 339 throw new UnsupportedError("Cannot add to immutable List."); | |
| 340 } | |
| 341 | |
| 342 void setAll(int index, Iterable<Map> iterable) { | |
| 343 throw new UnsupportedError("Cannot modify an immutable List."); | |
| 344 } | |
| 345 | |
| 346 Map removeAt(int pos) { | |
| 347 throw new UnsupportedError("Cannot remove from immutable List."); | |
| 348 } | |
| 349 | |
| 350 Map removeLast() { | |
| 351 throw new UnsupportedError("Cannot remove from immutable List."); | |
| 352 } | |
| 353 | |
| 354 bool remove(Object object) { | |
| 355 throw new UnsupportedError("Cannot remove from immutable List."); | |
| 356 } | |
| 357 | |
| 358 void removeWhere(bool test(Map element)) { | |
| 359 throw new UnsupportedError("Cannot remove from immutable List."); | |
| 360 } | |
| 361 | |
| 362 void retainWhere(bool test(Map element)) { | |
| 363 throw new UnsupportedError("Cannot remove from immutable List."); | |
| 364 } | |
| 365 | |
| 366 void setRange(int start, int end, Iterable<Map> iterable, [int skipCount=0]) { | |
| 367 throw new UnsupportedError("Cannot setRange on immutable List."); | |
| 368 } | |
| 369 | |
| 370 void removeRange(int start, int end) { | |
| 371 throw new UnsupportedError("Cannot removeRange on immutable List."); | |
| 372 } | |
| 373 | |
| 374 void replaceRange(int start, int end, Iterable<Map> iterable) { | |
| 375 throw new UnsupportedError("Cannot modify an immutable List."); | |
| 376 } | |
| 377 | |
| 378 void fillRange(int start, int end, [Map fillValue]) { | |
| 379 throw new UnsupportedError("Cannot modify an immutable List."); | |
| 380 } | |
| 381 | |
| 382 Iterable<Map> getRange(int start, int end) => | |
| 383 IterableMixinWorkaround.getRangeList(this, start, end); | |
| 384 | |
| 385 List<Map> sublist(int start, [int end]) { | |
| 386 if (end == null) end = length; | |
| 387 return Lists.getRange(this, start, end, <Map>[]); | |
| 388 } | |
| 389 | |
| 390 Map<int, Map> asMap() => | |
| 391 IterableMixinWorkaround.asMapList(this); | |
| 392 | |
| 393 String toString() { | |
| 394 StringBuffer buffer = new StringBuffer('['); | |
| 395 buffer.writeAll(this, ', '); | |
| 396 buffer.write(']'); | |
| 397 return buffer.toString(); | |
| 398 } | |
| 399 | |
| 400 // -- end List<Map> mixins. | 215 // -- end List<Map> mixins. |
| 401 | 216 |
| 402 @DomName('SQLResultSetRowList.item') | 217 @DomName('SQLResultSetRowList.item') |
| 403 @DocsEditable | 218 @DocsEditable |
| 404 @Creates('=Object') | 219 @Creates('=Object') |
| 405 Map item(int index) { | 220 Map item(int index) { |
| 406 return convertNativeToDart_Dictionary(_item_1(index)); | 221 return convertNativeToDart_Dictionary(_item_1(index)); |
| 407 } | 222 } |
| 408 @JSName('item') | 223 @JSName('item') |
| 409 @DomName('SQLResultSetRowList.item') | 224 @DomName('SQLResultSetRowList.item') |
| (...skipping 22 matching lines...) Expand all Loading... |
| 432 // BSD-style license that can be found in the LICENSE file. | 247 // BSD-style license that can be found in the LICENSE file. |
| 433 | 248 |
| 434 | 249 |
| 435 @DocsEditable | 250 @DocsEditable |
| 436 @DomName('SQLTransactionSync') | 251 @DomName('SQLTransactionSync') |
| 437 @SupportedBrowser(SupportedBrowser.CHROME) | 252 @SupportedBrowser(SupportedBrowser.CHROME) |
| 438 @SupportedBrowser(SupportedBrowser.SAFARI) | 253 @SupportedBrowser(SupportedBrowser.SAFARI) |
| 439 @Experimental | 254 @Experimental |
| 440 abstract class _SQLTransactionSync native "SQLTransactionSync" { | 255 abstract class _SQLTransactionSync native "SQLTransactionSync" { |
| 441 } | 256 } |
| OLD | NEW |