Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "HybridNitroSQLite.hpp"
#include "../NitroSQLiteException.hpp"
#include "../importSqlFile.hpp"
#include "../logs.hpp"
#include "../macros.hpp"
#include "../operations.hpp"
#include "../sqliteExecuteBatch.hpp"
#include "HybridNitroSQLiteQueryResult.hpp"
#include "NitroSQLiteException.hpp"
#include "importSqlFile.hpp"
#include "logs.hpp"
#include "macros.hpp"
#include "operations.hpp"
#include "sqliteExecuteBatch.hpp"
#include <exception>
#include <iostream>
#include <map>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#pragma once

#include "../types.hpp"
#include "HybridNitroSQLiteQueryResultSpec.hpp"
#include "HybridNitroSQLiteSpec.hpp"
#include "types.hpp"

using namespace margelo::rnnitrosqlite;

namespace margelo::nitro::rnnitrosqlite {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#pragma once

#include "../types.hpp"
#include "HybridNitroSQLiteQueryResultSpec.hpp"
#include "types.hpp"
#include <map>

using namespace margelo::rnnitrosqlite;

namespace margelo::nitro::rnnitrosqlite {

class HybridNitroSQLiteQueryResult : public HybridNitroSQLiteQueryResultSpec {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-nitro-sqlite/cpp/importSqlFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <fstream>
#include <iostream>

namespace margelo::rnnitrosqlite {
namespace margelo::nitro::rnnitrosqlite {

SQLiteOperationResult importSqlFile(const std::string& dbName, const std::string& fileLocation) {
return importSqlFile(sqliteGetOpenDatabase(dbName), fileLocation);
Expand Down Expand Up @@ -50,4 +50,4 @@ SQLiteOperationResult importSqlFile(const SQLiteConnectionPtr& connection, const
}
}

} // namespace margelo::rnnitrosqlite
} // namespace margelo::nitro::rnnitrosqlite
4 changes: 2 additions & 2 deletions packages/react-native-nitro-sqlite/cpp/importSqlFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include "types.hpp"
#include <memory>

namespace margelo::rnnitrosqlite {
namespace margelo::nitro::rnnitrosqlite {

struct SQLiteConnection;

SQLiteOperationResult importSqlFile(const std::string& dbName, const std::string& fileLocation);
SQLiteOperationResult importSqlFile(const std::shared_ptr<SQLiteConnection>& connection, const std::string& fileLocation);

} // namespace margelo::rnnitrosqlite
} // namespace margelo::nitro::rnnitrosqlite
6 changes: 2 additions & 4 deletions packages/react-native-nitro-sqlite/cpp/operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
#endif

using namespace facebook;
using namespace margelo::nitro;
using namespace margelo::nitro::rnnitrosqlite;

namespace margelo::rnnitrosqlite {
namespace margelo::nitro::rnnitrosqlite {

static constexpr double kInt64MinAsDouble = static_cast<double>(std::numeric_limits<int64_t>::min());
static constexpr double kInt64UpperBoundAsDouble = -kInt64MinAsDouble;
Expand Down Expand Up @@ -355,4 +353,4 @@ SQLiteOperationResult sqliteExecuteCommand(const SQLiteConnectionPtr& connection
return {.rowsAffected = isReadOnly ? 0 : sqlite3_changes(db)};
}

} // namespace margelo::rnnitrosqlite
} // namespace margelo::nitro::rnnitrosqlite
4 changes: 2 additions & 2 deletions packages/react-native-nitro-sqlite/cpp/operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <sqlite3.h>
#include <string>

namespace margelo::rnnitrosqlite {
namespace margelo::nitro::rnnitrosqlite {

// Calls against one connection are serialized by `mutex`. Separate connections
// intentionally remain independent, so SQLITE_THREADSAFE=0 still requires the
Expand Down Expand Up @@ -53,4 +53,4 @@ SQLiteOperationResult sqliteExecuteCommand(const SQLiteConnectionPtr& connection

void sqliteCloseAll();

} // namespace margelo::rnnitrosqlite
} // namespace margelo::nitro::rnnitrosqlite
4 changes: 2 additions & 2 deletions packages/react-native-nitro-sqlite/cpp/sqliteExecuteBatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "operations.hpp"
#include <utility>

namespace margelo::rnnitrosqlite {
namespace margelo::nitro::rnnitrosqlite {

std::vector<BatchQuery> batchParamsToCommands(const std::vector<BatchQueryCommand>& batchParams) {
auto commands = std::vector<BatchQuery>();
Expand Down Expand Up @@ -67,4 +67,4 @@ SQLiteOperationResult sqliteExecuteBatch(const SQLiteConnectionPtr& connection,
}
}

} // namespace margelo::rnnitrosqlite
} // namespace margelo::nitro::rnnitrosqlite
7 changes: 2 additions & 5 deletions packages/react-native-nitro-sqlite/cpp/sqliteExecuteBatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
#include "types.hpp"
#include <memory>

using namespace facebook;
using namespace margelo::nitro;

namespace margelo::rnnitrosqlite {
namespace margelo::nitro::rnnitrosqlite {

struct SQLiteConnection;

Expand All @@ -31,4 +28,4 @@ std::vector<BatchQuery> batchParamsToCommands(const std::vector<BatchQueryComman
SQLiteOperationResult sqliteExecuteBatch(const std::string& dbName, const std::vector<BatchQuery>& commands);
SQLiteOperationResult sqliteExecuteBatch(const std::shared_ptr<SQLiteConnection>& connection, const std::vector<BatchQuery>& commands);

} // namespace margelo::rnnitrosqlite
} // namespace margelo::nitro::rnnitrosqlite
9 changes: 3 additions & 6 deletions packages/react-native-nitro-sqlite/cpp/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
#include <NitroModules/ArrayBuffer.hpp>
#include <string>

using namespace margelo::nitro;
using namespace margelo::nitro::rnnitrosqlite;
namespace margelo::nitro::rnnitrosqlite {

namespace margelo::rnnitrosqlite {

using SQLiteValue = std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>;
using SQLiteValue = std::variant<NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>;
using SQLiteQueryParams = std::vector<SQLiteValue>;
using SQLiteQueryResultRow = std::unordered_map<std::string, SQLiteValue>;
using SQLiteQueryResults = std::vector<SQLiteQueryResultRow>;
Expand Down Expand Up @@ -40,4 +37,4 @@ inline ColumnType mapSQLiteTypeToColumnType(const char* type) {
}
}

} // namespace margelo::rnnitrosqlite
} // namespace margelo::nitro::rnnitrosqlite
4 changes: 2 additions & 2 deletions packages/react-native-nitro-sqlite/cpp/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string>
#include <sys/stat.h>

namespace margelo::rnnitrosqlite {
namespace margelo::nitro::rnnitrosqlite {

bool folder_exists(const std::string& foldername) {
struct stat buffer;
Expand Down Expand Up @@ -57,4 +57,4 @@ std::string get_db_path(const std::string& dbName, const std::string& docPath) {
return docPath + "/" + dbName;
}

} // namespace margelo::rnnitrosqlite
} // namespace margelo::nitro::rnnitrosqlite
Loading