LCOV - code coverage report
Current view: top level - storage - mozStorageStatement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       6             : 
       7             : #ifndef mozStorageStatement_h
       8             : #define mozStorageStatement_h
       9             : 
      10             : #include "nsAutoPtr.h"
      11             : #include "nsString.h"
      12             : 
      13             : #include "nsTArray.h"
      14             : 
      15             : #include "mozStorageBindingParamsArray.h"
      16             : #include "mozStorageStatementData.h"
      17             : #include "mozIStorageStatement.h"
      18             : #include "mozIStorageValueArray.h"
      19             : #include "StorageBaseStatementInternal.h"
      20             : #include "mozilla/Attributes.h"
      21             : 
      22             : class nsIXPConnectJSObjectHolder;
      23             : struct sqlite3_stmt;
      24             : 
      25             : namespace mozilla {
      26             : namespace storage {
      27             : class StatementJSHelper;
      28             : class Connection;
      29             : 
      30             : class Statement final : public mozIStorageStatement
      31             :                       , public mozIStorageValueArray
      32             :                       , public StorageBaseStatementInternal
      33             : {
      34             : public:
      35             :   NS_DECL_THREADSAFE_ISUPPORTS
      36             :   NS_DECL_MOZISTORAGESTATEMENT
      37             :   NS_DECL_MOZISTORAGEBASESTATEMENT
      38             :   NS_DECL_MOZISTORAGEBINDINGPARAMS
      39             :   // NS_DECL_MOZISTORAGEVALUEARRAY (methods in mozIStorageStatement)
      40             :   NS_DECL_STORAGEBASESTATEMENTINTERNAL
      41             : 
      42             :   Statement();
      43             : 
      44             :   /**
      45             :    * Initializes the object on aDBConnection by preparing the SQL statement
      46             :    * given by aSQLStatement.
      47             :    *
      48             :    * @param aDBConnection
      49             :    *        The Connection object this statement is associated with.
      50             :    * @param aNativeConnection
      51             :    *        The native Sqlite connection this statement is associated with.
      52             :    * @param aSQLStatement
      53             :    *        The SQL statement to prepare that this object will represent.
      54             :    */
      55             :   nsresult initialize(Connection *aDBConnection,
      56             :                       sqlite3* aNativeConnection,
      57             :                       const nsACString &aSQLStatement);
      58             : 
      59             : 
      60             :   /**
      61             :    * Obtains the native statement pointer.
      62             :    */
      63             :   inline sqlite3_stmt *nativeStatement() { return mDBStatement; }
      64             : 
      65             :   /**
      66             :    * Obtains and transfers ownership of the array of parameters that are bound
      67             :    * to this statment.  This can be null.
      68             :    */
      69           0 :   inline already_AddRefed<BindingParamsArray> bindingParamsArray()
      70             :   {
      71           0 :     return mParamsArray.forget();
      72             :   }
      73             : 
      74             : private:
      75             :     ~Statement();
      76             : 
      77             :     sqlite3_stmt *mDBStatement;
      78             :     uint32_t mParamCount;
      79             :     uint32_t mResultColumnCount;
      80             :     nsTArray<nsCString> mColumnNames;
      81             :     bool mExecuting;
      82             : 
      83             :     /**
      84             :      * @return a pointer to the BindingParams object to use with our Bind*
      85             :      *         method.
      86             :      */
      87             :     mozIStorageBindingParams *getParams();
      88             : 
      89             :     /**
      90             :      * Holds the array of parameters to bind to this statement when we execute
      91             :      * it asynchronously.
      92             :      */
      93             :     RefPtr<BindingParamsArray> mParamsArray;
      94             : 
      95             :     /**
      96             :      * The following two members are only used with the JS helper.  They cache
      97             :      * the row and params objects.
      98             :      */
      99             :     nsMainThreadPtrHandle<nsIXPConnectJSObjectHolder> mStatementParamsHolder;
     100             :     nsMainThreadPtrHandle<nsIXPConnectJSObjectHolder> mStatementRowHolder;
     101             : 
     102             :   /**
     103             :    * Internal version of finalize that allows us to tell it if it is being
     104             :    * called from the destructor so it can know not to dispatch events that
     105             :    * require a reference to us.
     106             :    *
     107             :    * @param aDestructing
     108             :    *        Is the destructor calling?
     109             :    */
     110             :   nsresult internalFinalize(bool aDestructing);
     111             : 
     112             :   friend class StatementJSHelper;
     113             : };
     114             : 
     115             : } // namespace storage
     116             : } // namespace mozilla
     117             : 
     118             : #endif // mozStorageStatement_h

Generated by: LCOV version 1.13