Skip to content

Commit b64df9e

Browse files
chrispaderclaude
andcommitted
refactor: rename the prepared statement hybrid object
Nitro V1 registers hybrid objects under the module's namespace, so NitroSQLitePreparedStatement no longer needs its prefix to stay unique. The spec, its C++ implementation and the generated bindings now use PreparedStatement. The public NitroSQLitePreparedStatement type keeps its name because the JavaScript API already exports a PreparedStatement interface. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d23790d commit b64df9e

23 files changed

Lines changed: 125 additions & 125 deletions

‎packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "../NitroSQLiteLogs.hpp"
77
#include "../NitroSQLiteMacros.hpp"
88
#include "../NitroSQLiteOperations.hpp"
9-
#include "HybridNitroSQLitePreparedStatement.hpp"
9+
#include "HybridPreparedStatement.hpp"
1010
#include <exception>
1111
#include <filesystem>
1212
#include <iostream>
@@ -234,8 +234,8 @@ Promise<NitroSQLiteQueryResult> HybridNitroSQLite::executeAsync(const std::strin
234234
});
235235
};
236236

237-
std::shared_ptr<HybridNitroSQLitePreparedStatementSpec> HybridNitroSQLite::prepare(const std::string& dbName, const std::string& query) {
238-
return std::make_shared<HybridNitroSQLitePreparedStatement>(sqlitePrepare(_connections.get(dbName), query));
237+
std::shared_ptr<HybridPreparedStatementSpec> HybridNitroSQLite::prepare(const std::string& dbName, const std::string& query) {
238+
return std::make_shared<HybridPreparedStatement>(sqlitePrepare(_connections.get(dbName), query));
239239
}
240240

241241
BatchQueryResult HybridNitroSQLite::executeBatch(const std::string& dbName, const std::vector<BatchQueryCommand>& batchParams) {

‎packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLite.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "../NitroSQLiteDatabaseConnections.hpp"
44
#include "../NitroSQLiteTypes.hpp"
5-
#include <RNNitroSQLite/HybridNitroSQLitePreparedStatementSpec.hpp>
5+
#include <RNNitroSQLite/HybridPreparedStatementSpec.hpp>
66
#include <RNNitroSQLite/HybridNitroSQLiteSpec.hpp>
77

88
namespace margelo::nitro::rnnitrosqlite {
@@ -74,7 +74,7 @@ class HybridNitroSQLite : public HybridNitroSQLiteSpec {
7474
const std::optional<Callback<void(SQLiteQueryResults)>>& onRows) override;
7575

7676
/** Prepare one SQL statement for repeated execution on an open connection. */
77-
std::shared_ptr<HybridNitroSQLitePreparedStatementSpec> prepare(const std::string& dbName, const std::string& query) override;
77+
std::shared_ptr<HybridPreparedStatementSpec> prepare(const std::string& dbName, const std::string& query) override;
7878

7979
/** Run a nonempty batch in one exclusive transaction on the calling thread.
8080
* A failed command rolls back the batch.

packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.cpp renamed to packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridPreparedStatement.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "HybridNitroSQLitePreparedStatement.hpp"
1+
#include "HybridPreparedStatement.hpp"
22
#include <NitroModules/ArrayBuffer.hpp>
33

44
namespace margelo::nitro::rnnitrosqlite {
@@ -26,30 +26,30 @@ namespace {
2626

2727
} // namespace
2828

29-
HybridNitroSQLitePreparedStatement::HybridNitroSQLitePreparedStatement(std::shared_ptr<SQLitePreparedStatement> statement)
29+
HybridPreparedStatement::HybridPreparedStatement(std::shared_ptr<SQLitePreparedStatement> statement)
3030
: _statement(std::move(statement)) {}
3131

32-
NitroSQLiteQueryResult HybridNitroSQLitePreparedStatement::execute(const std::optional<SQLiteQueryParams>& params) {
32+
NitroSQLiteQueryResult HybridPreparedStatement::execute(const std::optional<SQLiteQueryParams>& params) {
3333
return _statement->execute(params);
3434
}
3535

36-
Promise<NitroSQLiteQueryResult> HybridNitroSQLitePreparedStatement::executeAsync(const std::optional<SQLiteQueryParams>& params) {
36+
Promise<NitroSQLiteQueryResult> HybridPreparedStatement::executeAsync(const std::optional<SQLiteQueryParams>& params) {
3737
const auto copiedParams = copyArrayBufferParamsForBackground(params);
3838
const auto statement = _statement;
3939

4040
return Promise<NitroSQLiteQueryResult>::async(
4141
[statement, copiedParams]() -> NitroSQLiteQueryResult { return statement->execute(copiedParams); });
4242
}
4343

44-
void HybridNitroSQLitePreparedStatement::finalize() {
44+
void HybridPreparedStatement::finalize() {
4545
_statement->finalize();
4646
}
4747

48-
bool HybridNitroSQLitePreparedStatement::getIsFinalized() {
48+
bool HybridPreparedStatement::getIsFinalized() {
4949
return _statement->isFinalized();
5050
}
5151

52-
size_t HybridNitroSQLitePreparedStatement::getExternalMemorySize() noexcept {
52+
size_t HybridPreparedStatement::getExternalMemorySize() noexcept {
5353
return sizeof(*this) + _statement->getExternalMemorySize();
5454
}
5555

packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridNitroSQLitePreparedStatement.hpp renamed to packages/react-native-nitro-sqlite/cpp/hybridObjects/HybridPreparedStatement.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
#include "../NitroSQLiteOperations.hpp"
44
#include "../NitroSQLiteTypes.hpp"
5-
#include <RNNitroSQLite/HybridNitroSQLitePreparedStatementSpec.hpp>
5+
#include <RNNitroSQLite/HybridPreparedStatementSpec.hpp>
66
#include <memory>
77

88
namespace margelo::nitro::rnnitrosqlite {
99

1010
/** Nitro hybrid object for a reusable native SQLite statement. */
11-
class HybridNitroSQLitePreparedStatement : public HybridNitroSQLitePreparedStatementSpec {
11+
class HybridPreparedStatement : public HybridPreparedStatementSpec {
1212
public:
1313
/** Wrap a prepared statement for calls from JavaScript. */
14-
explicit HybridNitroSQLitePreparedStatement(std::shared_ptr<SQLitePreparedStatement> statement);
14+
explicit HybridPreparedStatement(std::shared_ptr<SQLitePreparedStatement> statement);
1515

1616
/** Execute with new bindings on the calling thread. */
1717
NitroSQLiteQueryResult execute(const std::optional<SQLiteQueryParams>& params) override;

‎packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/react-native-nitro-sqlite/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/HybridNitroSQLitePreparedStatementSpecClass.cpp‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/HybridNitroSQLiteSpecClass.cpp‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/react-native-nitro-sqlite/nitrogen/generated/android/c++/HybridPreparedStatementSpecClass.cpp‎

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/react-native-nitro-sqlite/nitrogen/generated/hybrid-classes.json‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)