@op-engineering/op-sqlite 9.1.3 → 9.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,36 +29,18 @@ void DBHostObject::auto_register_update_hook() {
29
29
  }
30
30
 
31
31
  auto hook = [this](std::string name, std::string table_name,
32
- std::string operation, int rowId) {
32
+ std::string operation, int rowid) {
33
33
  if (update_hook_callback != nullptr) {
34
- std::vector<JSVariant> params;
35
- std::vector<DumbHostObject> results;
36
- std::shared_ptr<std::vector<SmartHostObject>> metadata =
37
- std::make_shared<std::vector<SmartHostObject>>();
38
-
39
- if (operation != "DELETE") {
40
- std::string query = "SELECT * FROM " + table_name +
41
- " where rowid = " + std::to_string(rowId) + ";";
42
- opsqlite_execute_host_objects(name, query, &params, &results, metadata);
43
- }
44
-
45
34
  jsCallInvoker->invokeAsync(
46
35
  [this,
47
- results = std::make_shared<std::vector<DumbHostObject>>(results),
48
36
  callback = update_hook_callback, table_name,
49
- operation = std::move(operation), &rowId] {
37
+ operation = std::move(operation), rowid] {
50
38
  auto res = jsi::Object(rt);
51
39
  res.setProperty(rt, "table",
52
40
  jsi::String::createFromUtf8(rt, table_name));
53
41
  res.setProperty(rt, "operation",
54
42
  jsi::String::createFromUtf8(rt, operation));
55
- res.setProperty(rt, "rowId", jsi::Value(rowId));
56
- if (!results->empty()) {
57
- res.setProperty(
58
- rt, "row",
59
- jsi::Object::createFromHostObject(
60
- rt, std::make_shared<HostObject>(results->at(0))));
61
- }
43
+ res.setProperty(rt, "rowId", jsi::Value(rowid));
62
44
 
63
45
  callback->asObject(rt).asFunction(rt).call(rt, res);
64
46
  });
@@ -85,7 +67,7 @@ void DBHostObject::auto_register_update_hook() {
85
67
  } else { // If ids are specified, then we should check if the rowId
86
68
  // matches
87
69
  for (const auto &discrimator_id : discriminator.ids) {
88
- if (rowId == discrimator_id) {
70
+ if (rowid == discrimator_id) {
89
71
  shouldFire = true;
90
72
  break;
91
73
  }