| Flutter Impeller |

archive_database.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #pragma once
6
7 #include <map>
8 #include <memory>
9 #include <string>
10
11 #include "flutter/fml/macros.h"
12 #include "impeller/archivist/archive_transaction.h"
13
14 namespace impeller {
15
16 class ArchiveStatement;
17 class ArchiveClassRegistration;
18 struct ArchiveDef;
19
20 //------------------------------------------------------------------------------
21 /// @brief A handle to the underlying database connection for an archive.
22 ///
23 class ArchiveDatabase {
24 public:
25 ArchiveDatabase(const std::string& filename);
26
27 ~ArchiveDatabase();
28
29 bool IsValid() const;
30
31 int64_t GetLastInsertRowID();
32
33 const ArchiveClassRegistration* GetRegistrationForDefinition(
34 const ArchiveDef& definition);
35
36 ArchiveTransaction CreateTransaction(int64_t& transactionCount);
37
38 private:
39 struct Handle;
40 std::unique_ptr<Handle> handle_;
41 std::map<std::string, std::unique_ptr<ArchiveClassRegistration>>
42 registrations_;
43 std::unique_ptr<ArchiveStatement> begin_transaction_stmt_;
44 std::unique_ptr<ArchiveStatement> end_transaction_stmt_;
45 std::unique_ptr<ArchiveStatement> rollback_transaction_stmt_;
46
47 friend class ArchiveClassRegistration;
48
49 ArchiveStatement CreateStatement(const std::string& statementString) const;
50
51 FML_DISALLOW_COPY_AND_ASSIGN(ArchiveDatabase);
52 };
53
54 } // namespace impeller
impeller::ArchiveDatabase::GetLastInsertRowID
int64_t GetLastInsertRowID()
Definition: archive_database.cc:88
impeller::ArchiveDef
Definition: archivable.h:14
impeller::ArchiveDatabase
A handle to the underlying database connection for an archive.
Definition: archive_database.h:23
impeller::ArchiveClassRegistration
Definition: archive_class_registration.h:16
impeller::ArchiveDatabase::ArchiveDatabase
ArchiveDatabase(const std::string &filename)
Definition: archive_database.cc:53
impeller::ArchiveDatabase::Handle
Definition: archive_database.cc:19
impeller::ArchiveStatement
Represents a read/write query to an archive database. Statements are expensive to create and must be ...
Definition: archive_statement.h:20
impeller::ArchiveDatabase::GetRegistrationForDefinition
const ArchiveClassRegistration * GetRegistrationForDefinition(const ArchiveDef &definition)
Definition: archive_database.cc:103
archive_transaction.h
impeller::ArchiveTransaction
All writes made to the archive within a transaction that is not marked as ready for commit will be ro...
Definition: archive_transaction.h:23
impeller::ArchiveDatabase::IsValid
bool IsValid() const
Definition: archive_database.cc:84
impeller::ArchiveDatabase::~ArchiveDatabase
~ArchiveDatabase()
impeller
Definition: aiks_context.cc:10
impeller::ArchiveDatabase::CreateTransaction
ArchiveTransaction CreateTransaction(int64_t &transactionCount)
Definition: archive_database.cc:133