-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathHybridNitroSQLiteQueryResult.hpp
More file actions
47 lines (39 loc) · 1.59 KB
/
HybridNitroSQLiteQueryResult.hpp
File metadata and controls
47 lines (39 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "HybridNitroSQLiteQueryResultSpec.hpp"
#include "types.hpp"
#include <map>
using namespace margelo::rnnitrosqlite;
namespace margelo::nitro::rnnitrosqlite {
class HybridNitroSQLiteQueryResult : public HybridNitroSQLiteQueryResultSpec {
public:
HybridNitroSQLiteQueryResult() : HybridObject(TAG) {}
HybridNitroSQLiteQueryResult(SQLiteQueryResults results, std::optional<double> insertId, double rowsAffected,
std::optional<SQLiteQueryTableMetadata> metadata)
: HybridObject(TAG), _insertId(insertId), _rowsAffected(rowsAffected), _results(std::move(results)), _metadata(metadata) {}
private:
std::optional<double> _insertId;
double _rowsAffected;
SQLiteQueryResults _results;
std::optional<SQLiteQueryTableMetadata> _metadata;
public:
// Properties
std::optional<double> getInsertId() override;
double getRowsAffected() override;
SQLiteQueryResults getResults() override;
std::optional<SQLiteQueryTableMetadata> getMetadata() override;
/**
* Approximate the native memory used by this query result.
*
* We account for:
* - The size of this C++ object (`sizeof(*this)`),
* - All rows and columns (including column name strings),
* - String values stored in the result set,
* - ArrayBuffers used for BLOB columns (object overhead + raw byte size),
* - Column metadata strings.
*
* This is a best-effort estimate and intentionally focuses on external
* heap allocations that can put pressure on the JS GC.
*/
size_t getExternalMemorySize() noexcept override;
};
} // namespace margelo::nitro::rnnitrosqlite