Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

  • Hello,

    I made a simple table for testing. The table has 2 columns named A and B. The values are 1 and 2. The data is readable with both column based and row based query.

    I used this statement for reading "SELECT A, B FROM deebee.Test LIMIT 0, 1000 ;"

    How should the update statement look like? Any examples?

    I tried some statements but they did nothing or caused the following alarm "Exception while setting point TestPoint: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0)."

    Regards
    Jokke


  • Hi,

    the SQL-Update syntax is

    UPDATE tablenname
    SET A=3, B=4
    where A=1

    Hope this helps

    Arne


  • Yeah, the documentation is a bit lite on the matter. You need a "?" parameter in your statement, where the parameter is value to which the point is being set.

    For example, i created a table thus:

    create table testTable ( c1 int, c2 int);
    

    ... and added a couple rows:

    insert into testTable (c1, c2) values (1, 10), (2, 11)
    

    Then, i created a data source with a row-based query:

    select c1, c2 from testTable
    

    ... and a couple of points with row identifiers "1" and "2". On the second point i added this update statement:

    update testTable set c2=? where c1=2
    

    Then, when i go to the watchlist and set the point to "20" and then check the table contents, i see that the c2 value for the correct row is "20".

    Hope this helps.


  • Such a small thing but thanks it helped.

    Is '??' used as escape if '?' is needed in the statement? In mysql, I think there should not be such need but just curiosity.

    Regards
    Jokke


  • After years of using prepared statements in many databases, i have to admin i have no idea. It never came up.