Node-Red : SQLite Node - DataBase

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ย. 2024

ความคิดเห็น • 10

  • @toey25391
    @toey25391 5 ปีที่แล้ว

    Thank you for teaching you how to add, delete and display information in Node-Red.
    thank you very much for your help.

  • @JBWilly4187
    @JBWilly4187 5 ปีที่แล้ว

    A very nice tutorial. Thanks alot!

  • @SA-oj3bo
    @SA-oj3bo 2 ปีที่แล้ว

    Hi, I not understand what the six "+ " are for in => "topic": "INSERT INTO RANDOMNUM VALUES ( " + msg.payload + ", " + randomNum + ", " + largeBool + ")" , can you explain that please?

  • @alexszilagyi
    @alexszilagyi 4 ปีที่แล้ว

    Hi there, How can you display decimals (like 10.20 for example) ? I am looking forward to display a REAL filed type from the database.

    • @dannylee4772
      @dannylee4772  4 ปีที่แล้ว

      Create a DB as shown below.
      CREATE TABLE REALTEST( TIMESTAMP INT PRIMARY KEY NOT NULL, VALUE REAL NOT NULL, BOOL INT NOT NULL)

    • @dannylee4772
      @dannylee4772  4 ปีที่แล้ว +1

      ==Node-REd Sample==
      [{"id":"d7d8970e.1187f8","type":"inject","z":"dcadcc70.cbb14","name":"CREATE DB","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CREATE TABLE REALTEST( TIMESTAMP INT PRIMARY KEY NOT NULL, VALUE REAL NOT NULL, BOOL INT NOT NULL)","payload":"","payloadType":"date","x":170,"y":160,"wires":[["7492730b.ba965c"]]},{"id":"e4811fc4.817d2","type":"inject","z":"dcadcc70.cbb14","name":"INSERT","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":220,"wires":[["645016a4.107e38"]]},{"id":"645016a4.107e38","type":"function","z":"dcadcc70.cbb14","name":"INSERT","func":"// var randomNum = Math.round(Math.random()*100);
      var randomNum = 11.1;
      var largeBool = (randomNum > 50)?1:0;
      var newMsg = {
      \"topic\": \"INSERT INTO REALTEST VALUES ( \" + msg.payload + \", \" + randomNum + \", \" + largeBool + \")\"
      }
      return newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":220,"wires":[["7492730b.ba965c"]]},{"id":"7bf8c1d6.e001c","type":"inject","z":"dcadcc70.cbb14","name":"SELECT","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"SELECT * FROM REALTEST ORDER BY TIMESTAMP DESC LIMIT 100;","payload":"","payloadType":"date","x":160,"y":280,"wires":[["6997e246.5f048c"]]},{"id":"6997e246.5f048c","type":"sqlite","z":"dcadcc70.cbb14","mydb":"885285ef.597a18","sqlquery":"msg.topic","sql":"","name":"db_002","x":480,"y":280,"wires":[["1b33ca13.9e8d86","6f25463b.938928"]]},{"id":"1b33ca13.9e8d86","type":"ui_template","z":"dcadcc70.cbb14","group":"a58c558e.b6c788","name":"","order":0,"width":"6","height":"7","format":"

      Index
      Timestamp
      Value
      Bool


      {{$index}}
      {{msg.payload[$index].TIMESTAMP}}
      {{msg.payload[$index].VALUE}}
      {{msg.payload[$index].BOOL}}

      ","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":660,"y":280,"wires":[[]]},{"id":"6f25463b.938928","type":"debug","z":"dcadcc70.cbb14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":320,"wires":[]},{"id":"7492730b.ba965c","type":"sqlite","z":"dcadcc70.cbb14","mydb":"885285ef.597a18","sqlquery":"msg.topic","sql":"","name":"db_002","x":480,"y":220,"wires":[[]]},{"id":"885285ef.597a18","type":"sqlitedb","z":"","db":"db_002","mode":"RWC"},{"id":"a58c558e.b6c788","type":"ui_group","name":"Group 1","tab":"2375ea1e.32e386","order":1,"disp":true,"width":6},{"id":"2375ea1e.32e386","type":"ui_tab","z":"","name":"Main Tab","icon":"dashboard","order":1}]

  • @임형준-q1v
    @임형준-q1v 5 ปีที่แล้ว +1

    감사합니다

  • @harryhino2267
    @harryhino2267 4 ปีที่แล้ว +1

    Where is the commentary?? I'm here to learn not be entertained....

  • @RadeckiRadzik
    @RadeckiRadzik 3 ปีที่แล้ว

    THX