193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)/* 293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Copyright (C) 2010 Google Inc. All rights reserved. 393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * modification, are permitted provided that the following conditions 693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * are met: 793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 1. Redistributions of source code must retain the above copyright 993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 1093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 2. Redistributions in binary form must reproduce the above copyright 1193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * notice, this list of conditions and the following disclaimer in the 1293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * documentation and/or other materials provided with the distribution. 1393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 1493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 1593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 1693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 1793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 1893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 1993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 2093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 2193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) */ 2593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 2693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#ifndef WebIDBDatabase_h 2793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#define WebIDBDatabase_h 2893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 2993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebCommon.h" 3093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebIDBMetadata.h" 3193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 3293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)namespace WebKit { 3393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 3493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebData; 3593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBCallbacks; 3693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBDatabaseCallbacks; 3793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBDatabaseError; 3893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBKey; 3993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBKeyPath; 4093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBKeyRange; 4193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 4293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)// See comment in WebIDBFactory for a high level overview of these classes. 4393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebIDBDatabase { 4493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)public: 4593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual ~WebIDBDatabase() { } 4693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 4793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void createObjectStore(long long transactionId, long long objectStoreId, const WebString& name, const WebIDBKeyPath&, bool autoIncrement) { WEBKIT_ASSERT_NOT_REACHED(); } 4893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void deleteObjectStore(long long transactionId, long long objectStoreId) { WEBKIT_ASSERT_NOT_REACHED(); } 4993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void createTransaction(long long id, WebIDBDatabaseCallbacks* callbacks, const WebVector<long long>&, unsigned short mode) { WEBKIT_ASSERT_NOT_REACHED(); } 5093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void close() { WEBKIT_ASSERT_NOT_REACHED(); } 5193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void forceClose() { WEBKIT_ASSERT_NOT_REACHED(); } 5293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 5393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void abort(long long transactionId) { WEBKIT_ASSERT_NOT_REACHED(); } 5493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void commit(long long transactionId) { WEBKIT_ASSERT_NOT_REACHED(); } 5593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 5693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void createIndex(long long transactionId, long long objectStoreId, long long indexId, const WebString& name, const WebIDBKeyPath&, bool unique, bool multiEntry) { WEBKIT_ASSERT_NOT_REACHED(); } 5793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void deleteIndex(long long transactionId, long long objectStoreId, long long indexId) { WEBKIT_ASSERT_NOT_REACHED(); } 5893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 5993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) enum TaskType { 6093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) NormalTask = 0, 6193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) PreemptiveTask 6293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) }; 6393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 6493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) enum PutMode { 6593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) AddOrUpdate, 6693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) AddOnly, 6793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) CursorUpdate 6893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) }; 6993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 7093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) typedef WebVector<WebIDBKey> WebIndexKeys; 7193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 7293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void get(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, bool keyOnly, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } 7393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) // Note that 'value' may be consumed/adopted by this call. 7493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void put(long long transactionId, long long objectStoreId, const WebData& value, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebVector<long long>& indexIds, const WebVector<WebIndexKeys>&) { WEBKIT_ASSERT_NOT_REACHED(); } 7593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void setIndexKeys(long long transactionId, long long objectStoreId, const WebIDBKey&, const WebVector<long long>& indexIds, const WebVector<WebIndexKeys>&) { WEBKIT_ASSERT_NOT_REACHED(); } 7693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void setIndexesReady(long long transactionId, long long objectStoreId, const WebVector<long long>& indexIds) { WEBKIT_ASSERT_NOT_REACHED(); } 7793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void openCursor(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, unsigned short direction, bool keyOnly, TaskType, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } 7893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void count(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } 7993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void deleteRange(long long transactionId, long long objectStoreId, const WebIDBKeyRange&, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } 8093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void clear(long long transactionId, long long objectStoreId, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } 8193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 8293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)protected: 8393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) WebIDBDatabase() { } 8493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)}; 8593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 8693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)} // namespace WebKit 8793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 8893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#endif // WebIDBDatabase_h 89