# Update query in sqlite3 with fob id coming from gateway code

**URL:** <https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292>\
**Category:** General\
**Created:** [1 September 2020 10:08 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292 "2020-09-01T10:08:49Z")\
**Posts on this page:** 20\
**Page:** 6

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 09:33 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/101 "2020-09-08T09:33:50Z")

</div>

I am using my own laptop (node red and db running on same machine)  
1.Processor: Intel® Core™ i3-4005U CPU @ 1.70GHz × 4  
2. linux 64-bit (16.04 ubuntu)  
3.RAM-3.8  
4.Memory-3.8 GiB  
5.1 day at least

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 September 2020 09:52 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/102 "2020-09-08T09:52:18Z")

</div>

Shipra, you said:

> [@shipra](#):
>
> Sir this node red i have to run on a arm board

That is the computer I am asking about. You said:

> [@shipra](#):
>
> Acc to first scenerio,my db gets fulled and my ram gets filled and my code get stuck

so please clarify, which computer is the DB getting full on, ram getting full and the code gets stuck? If it is the arm computer then what type of computer is it and answer the five questions about it. Thank you.

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 09:54 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/103 "2020-09-08T09:54:55Z")

</div>

Sir,for time being I am testing first this whole flow in my laptop for testing purpose.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 September 2020 09:58 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/104 "2020-09-08T09:58:48Z")

</div>

Why bother to test it on your laptop if the 'arm' computer freezes when running the flow?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 10:00 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/105 "2020-09-08T10:00:34Z")

</div>

Sir ,thats true but for now i have to complete this project with testing So kindly help.

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 10:02 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/106 "2020-09-08T10:02:46Z")

</div>

Sir ,because on one platform we need to freeze code for reference

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 September 2020 10:09 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/107 "2020-09-08T10:09:14Z")

</div>

Fine, I will try to guide you so you can solve your issue.

If you now want to add a row to the database each time someone uses the FOB, how do you add a row to a database?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 10:10 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/108 "2020-09-08T10:10:43Z")

</div>

ok thank you sir.  
we have to trigger everytime the add command in sqlite i think but how i dont know

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 September 2020 10:18 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/109 "2020-09-08T10:18:12Z")

</div>

So this would be a good time to go and do a sqllite tutorial where you will learn how to add rows to a database. I seem to remember suggesting you take a dabase tutorial back in July. You should go back and review it to see how to add rows to a database

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 10:20 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/110 "2020-09-08T10:20:57Z")

</div>

Sir that add would be done by insert command that thing i have watched and learned ,but how can i add everytime when a successful fob id is received that i want to know

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 10:22 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/111 "2020-09-08T10:22:54Z")

</div>

and with timestamp of uk and india it should insert

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 10:51 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/112 "2020-09-08T10:51:01Z")

</div>

Sir please help how can i update timestamp in sqlite db in node red

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 September 2020 11:03 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/113 "2020-09-08T11:03:13Z")

</div>

> [@shipra](#):
>
> and with timestamp of uk and india it should insert

you should only store the date/time in the database as a UTC value. Then you can convert it to the local time when you read the database and present it.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 September 2020 11:04 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/114 "2020-09-08T11:04:48Z")

</div>

> [@shipra](#):
>
> ir please help how can i update timestamp in sqlite db in node red

Why whoul you update the timestamp? When you insert the record, the timestamp should be part of the data you are inserting.

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 11:05 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/115 "2020-09-08T11:05:56Z")

</div>

How to do that I want to insert timestamp in a Date-and-time column

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 September 2020 11:12 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/116 "2020-09-08T11:12:22Z")

</div>

Have you done a google search asking that question?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 11:14 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/117 "2020-09-08T11:14:10Z")

</div>

Sir what i learned from google is ,i tried and got the result as this

```auto
9/8/2020, 4:44:00 PMnode: 6133b2fa.5dafbc
UPDATE NCS_DATABASE SET Date_and_Time='2020-09-08T11:14:00.195Z' WHERE Person_ID='undefined' : msg.payload : undefined
undefined

```

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 11:16 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/118 "2020-09-08T11:16:14Z")

</div>

First flaw is:  
the time is getting updated only when i am triggering the insert timestamp node  
Second flaw:  
I am using moment node which is giving me correct date but i want UK tine as well as India time.  
third flaw:  
person id is showing undefined.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 September 2020 11:42 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/119 "2020-09-08T11:42:39Z")

</div>

So why is the person id not filled in? What are you putting in it that it would show up as undefined?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [8 September 2020 11:44 UTC](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292/120 "2020-09-08T11:44:40Z")

</div>

because it is coming from my gateway side and in my flow it is set as flow.id

[Previous page](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292.md?page=5)

[Next page](https://discourse.nodered.org/t/update-query-in-sqlite3-with-fob-id-coming-from-gateway-code/32292.md?page=7)
