Bug 1841050 - Disable webgl.gl_khr_no_error on Windows. r=gfx-reviewers,bradwerth
[gecko.git] / storage / mozStorageAsyncStatement.h
blobceaead17716dcd2e0b0ffebec81f178f5768ba84
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_storage_mozStorageAsyncStatement_h_
8 #define mozilla_storage_mozStorageAsyncStatement_h_
10 #include "nsString.h"
12 #include "nsTArray.h"
14 #include "mozStorageBindingParamsArray.h"
15 #include "mozStorageStatementData.h"
16 #include "mozIStorageAsyncStatement.h"
17 #include "StorageBaseStatementInternal.h"
18 #include "mozilla/Attributes.h"
20 namespace mozilla {
21 namespace storage {
23 class AsyncStatementJSHelper;
24 class AsyncStatementParamsHolder;
25 class Connection;
27 class AsyncStatement final : public mozIStorageAsyncStatement,
28 public StorageBaseStatementInternal {
29 public:
30 NS_DECL_THREADSAFE_ISUPPORTS
31 NS_DECL_MOZISTORAGEASYNCSTATEMENT
32 NS_DECL_MOZISTORAGEBASESTATEMENT
33 NS_DECL_MOZISTORAGEBINDINGPARAMS
34 NS_DECL_STORAGEBASESTATEMENTINTERNAL
36 AsyncStatement();
38 /**
39 * Initializes the object on aDBConnection by preparing the SQL statement
40 * given by aSQLStatement.
42 * @param aDBConnection
43 * The Connection object this statement is associated with.
44 * @param aNativeConnection
45 * The native Sqlite connection this statement is associated with.
46 * @param aSQLStatement
47 * The SQL statement to prepare that this object will represent.
49 nsresult initialize(Connection* aDBConnection, sqlite3* aNativeConnection,
50 const nsACString& aSQLStatement);
52 /**
53 * Obtains and transfers ownership of the array of parameters that are bound
54 * to this statment. This can be null.
56 inline already_AddRefed<BindingParamsArray> bindingParamsArray() {
57 return mParamsArray.forget();
60 private:
61 ~AsyncStatement();
63 /**
64 * @return a pointer to the BindingParams object to use with our Bind*
65 * method.
67 mozIStorageBindingParams* getParams();
69 /**
70 * The SQL string as passed by the user. We store it because we create the
71 * async statement on-demand on the async thread.
73 nsCString mSQLString;
75 /**
76 * Holds the array of parameters to bind to this statement when we execute
77 * it asynchronously.
79 RefPtr<BindingParamsArray> mParamsArray;
81 /**
82 * Caches the JS 'params' helper for this statement.
84 nsMainThreadPtrHandle<AsyncStatementParamsHolder> mStatementParamsHolder;
86 /**
87 * Have we been explicitly finalized by the user?
89 bool mFinalized;
91 /**
92 * Required for access to private mStatementParamsHolder field by
93 * AsyncStatementJSHelper::getParams.
95 friend class AsyncStatementJSHelper;
98 } // namespace storage
99 } // namespace mozilla
101 #endif // mozilla_storage_mozStorageAsyncStatement_h_