Changeset 80308 in webkit
- Timestamp:
- Mar 3, 2011 6:18:45 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r80293 r80308 1 2011-03-02 Jeremy Orlow <jorlow@chromium.org> 2 3 Reviewed by Steve Block. 4 5 Cursor.continue with a key param should test less than, not equal to 6 https://bugs.webkit.org/show_bug.cgi?id=55640 7 8 * storage/indexeddb/cursor-continue-expected.txt: Added. 9 * storage/indexeddb/cursor-continue.html: Added. 10 1 11 2011-03-03 Mihai Parparita <mihaip@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r80304 r80308 1 2011-03-02 Jeremy Orlow <jorlow@chromium.org> 2 3 Reviewed by Steve Block. 4 5 Cursor.continue with a key param should test less than, not equal to 6 https://bugs.webkit.org/show_bug.cgi?id=55640 7 8 If you supply a param to cursor.continue, we sould guarantee that 9 the item we continue to is greater than or equal to the parameter. 10 Right now, we only test equality. 11 12 http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#widl-IDBCursor-continue 13 http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#dfn-steps-for-iterating-a-cursor 14 15 Test: storage/indexeddb/cursor-continue.html 16 17 * storage/IDBCursorBackendImpl.cpp: 18 (WebCore::IDBCursorBackendImpl::continueFunctionInternal): 19 * storage/IDBKey.cpp: 20 (WebCore::IDBKey::isLessThan): 21 (WebCore::IDBKey::isEqual): 22 * storage/IDBKey.h: 23 1 24 2011-03-03 Brent Fulgham <bfulgham@webkit.org> 2 25 -
trunk/Source/WebCore/storage/IDBBackingStore.cpp
r80265 r80308 669 669 class CursorImplCommon : public IDBBackingStore::Cursor { 670 670 public: 671 CursorImplCommon(SQLiteDatabase& sqliteDatabase, String query, bool uniquenessConstraint )671 CursorImplCommon(SQLiteDatabase& sqliteDatabase, String query, bool uniquenessConstraint, bool iterateForward) 672 672 : m_query(sqliteDatabase, query) 673 673 , m_db(sqliteDatabase) 674 674 , m_uniquenessConstraint(uniquenessConstraint) 675 , m_iterateForward(iterateForward) 675 676 { 676 677 } … … 693 694 SQLiteDatabase& m_db; 694 695 bool m_uniquenessConstraint; 696 bool m_iterateForward; 695 697 int64_t m_currentId; 696 698 RefPtr<IDBKey> m_currentKey; … … 710 712 continue; 711 713 712 // If a key was supplied, we must loop until we find that key (or hit the end). 713 if (key && !key->isEqual(m_currentKey.get())) 714 continue; 714 // If a key was supplied, we must loop until we find a key greater than or equal to it (or hit the end). 715 if (key) { 716 if (m_iterateForward) { 717 if (m_currentKey->isLessThan(key)) 718 continue; 719 } else { 720 if (key->isLessThan(m_currentKey.get())) 721 continue; 722 } 723 } 715 724 716 725 // If we don't have a uniqueness constraint, we can stop now. … … 726 735 class ObjectStoreCursorImpl : public CursorImplCommon { 727 736 public: 728 ObjectStoreCursorImpl(SQLiteDatabase& sqliteDatabase, String query, bool uniquenessConstraint )729 : CursorImplCommon(sqliteDatabase, query, uniquenessConstraint )737 ObjectStoreCursorImpl(SQLiteDatabase& sqliteDatabase, String query, bool uniquenessConstraint, bool iterateForward) 738 : CursorImplCommon(sqliteDatabase, query, uniquenessConstraint, iterateForward) 730 739 { 731 740 } … … 763 772 class IndexKeyCursorImpl : public CursorImplCommon { 764 773 public: 765 IndexKeyCursorImpl(SQLiteDatabase& sqliteDatabase, String query, bool uniquenessConstraint )766 : CursorImplCommon(sqliteDatabase, query, uniquenessConstraint )774 IndexKeyCursorImpl(SQLiteDatabase& sqliteDatabase, String query, bool uniquenessConstraint, bool iterateForward) 775 : CursorImplCommon(sqliteDatabase, query, uniquenessConstraint, iterateForward) 767 776 { 768 777 } … … 801 810 class IndexCursorImpl : public CursorImplCommon { 802 811 public: 803 IndexCursorImpl(SQLiteDatabase& sqliteDatabase, String query, bool uniquenessConstraint )804 : CursorImplCommon(sqliteDatabase, query, uniquenessConstraint )812 IndexCursorImpl(SQLiteDatabase& sqliteDatabase, String query, bool uniquenessConstraint, bool iterateForward) 813 : CursorImplCommon(sqliteDatabase, query, uniquenessConstraint, iterateForward) 805 814 { 806 815 } … … 858 867 sql += "keyString DESC, keyDate DESC, keyNumber DESC"; 859 868 860 RefPtr<ObjectStoreCursorImpl> cursor = adoptRef(new ObjectStoreCursorImpl(m_db, sql, direction == IDBCursor::NEXT_NO_DUPLICATE || direction == IDBCursor::PREV_NO_DUPLICATE)); 869 RefPtr<ObjectStoreCursorImpl> cursor = adoptRef(new ObjectStoreCursorImpl(m_db, sql, direction == IDBCursor::NEXT_NO_DUPLICATE || direction == IDBCursor::PREV_NO_DUPLICATE, 870 direction == IDBCursor::NEXT_NO_DUPLICATE || direction == IDBCursor::NEXT)); 861 871 862 872 bool ok = cursor->m_query.prepare() == SQLResultOk; … … 897 907 sql += "IndexData.keyString DESC, IndexData.keyDate DESC, IndexData.keyNumber DESC, IndexData.id DESC"; 898 908 899 RefPtr<IndexKeyCursorImpl> cursor = adoptRef(new IndexKeyCursorImpl(m_db, sql, direction == IDBCursor::NEXT_NO_DUPLICATE || direction == IDBCursor::PREV_NO_DUPLICATE)); 909 RefPtr<IndexKeyCursorImpl> cursor = adoptRef(new IndexKeyCursorImpl(m_db, sql, direction == IDBCursor::NEXT_NO_DUPLICATE || direction == IDBCursor::PREV_NO_DUPLICATE, 910 direction == IDBCursor::NEXT_NO_DUPLICATE || direction == IDBCursor::NEXT)); 900 911 901 912 bool ok = cursor->m_query.prepare() == SQLResultOk; … … 936 947 sql += "IndexData.keyString DESC, IndexData.keyDate DESC, IndexData.keyNumber DESC, IndexData.id DESC"; 937 948 938 RefPtr<IndexCursorImpl> cursor = adoptRef(new IndexCursorImpl(m_db, sql, direction == IDBCursor::NEXT_NO_DUPLICATE || direction == IDBCursor::PREV_NO_DUPLICATE)); 949 RefPtr<IndexCursorImpl> cursor = adoptRef(new IndexCursorImpl(m_db, sql, direction == IDBCursor::NEXT_NO_DUPLICATE || direction == IDBCursor::PREV_NO_DUPLICATE, 950 direction == IDBCursor::NEXT_NO_DUPLICATE || direction == IDBCursor::NEXT)); 939 951 940 952 bool ok = cursor->m_query.prepare() == SQLResultOk; -
trunk/Source/WebCore/storage/IDBKey.cpp
r80220 r80308 40 40 } 41 41 42 bool IDBKey::isEqual(IDBKey* other) const 42 bool IDBKey::isLessThan(const IDBKey* other) const 43 { 44 ASSERT(other); 45 if (other->m_type < m_type) 46 return true; 47 if (other->m_type > m_type) 48 return false; 49 50 switch (m_type) { 51 case StringType: 52 return codePointCompare(other->m_string, m_string) > 0; 53 case DateType: 54 return other->m_date > m_date; 55 case NumberType: 56 return other->m_number > m_number; 57 case NullType: 58 return true; 59 } 60 61 ASSERT_NOT_REACHED(); 62 return false; 63 } 64 65 bool IDBKey::isEqual(const IDBKey* other) const 43 66 { 44 67 if (!other || other->m_type != m_type) -
trunk/Source/WebCore/storage/IDBKey.h
r80220 r80308 100 100 } 101 101 102 bool isEqual(IDBKey* other) const; 102 bool isLessThan(const IDBKey* other) const; 103 bool isEqual(const IDBKey* other) const; 103 104 104 105 using ThreadSafeShared<IDBKey>::ref;
Note: See TracChangeset
for help on using the changeset viewer.