Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. sql query update ... Error: near "SET": syntax error ... not find it.
Forum Updated to NodeBB v4.3 + New Features

sql query update ... Error: near "SET": syntax error ... not find it.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gfxx
    wrote on 6 Apr 2019, 07:19 last edited by
    #1

    In a component I have these function ... it work, but when close my app, these function is call again (i have an other one very similar that send no error) and the application output show me these error:

    qrc:filexxxx:335 : Error: near "SET": syntax error impoossible to execute the command (one error for every component istance, i reuse the component 4 time ... so 4 error like these. 335 is exactly the row that contains UPDATE command)

    property string nameChartPage: nameChartPage
    
    property var settingDataStrPro:[]
    
    function myfunc() {
    
    db.transaction(
                    function(tx1) {
                        tx1.executeSql('UPDATE ' + nameChartPage + ' SET swA0=?, swA1=?, swA2=?, swA3=?, swA4=?, swA5=?, swA6=?, swA7=?, swA8=?, swA9=? WHERE idx=1', [ settingDataStrPro[0], settingDataStrPro[1], settingDataStrPro[2], settingDataStrPro[3], settingDataStrPro[4], settingDataStrPro[5], settingDataStrPro[6], settingDataStrPro[7], settingDataStrPro[8], settingDataStrPro[9] ]);
                    }
                    )
    }
    
    console.log(settingDataStrPro)
    

    Not know why I have these error. Console show me exactly 10 string (0 to 9). If scan database with a browser, all seems ok. Exist idx=1 and the column value is changed. Ok the table contains more than 10 column ... but i try to UPDATE entire row the error not disappear!!

    bkt

    J 1 Reply Last reply 6 Apr 2019, 13:41
    0
    • G gfxx
      6 Apr 2019, 07:19

      In a component I have these function ... it work, but when close my app, these function is call again (i have an other one very similar that send no error) and the application output show me these error:

      qrc:filexxxx:335 : Error: near "SET": syntax error impoossible to execute the command (one error for every component istance, i reuse the component 4 time ... so 4 error like these. 335 is exactly the row that contains UPDATE command)

      property string nameChartPage: nameChartPage
      
      property var settingDataStrPro:[]
      
      function myfunc() {
      
      db.transaction(
                      function(tx1) {
                          tx1.executeSql('UPDATE ' + nameChartPage + ' SET swA0=?, swA1=?, swA2=?, swA3=?, swA4=?, swA5=?, swA6=?, swA7=?, swA8=?, swA9=? WHERE idx=1', [ settingDataStrPro[0], settingDataStrPro[1], settingDataStrPro[2], settingDataStrPro[3], settingDataStrPro[4], settingDataStrPro[5], settingDataStrPro[6], settingDataStrPro[7], settingDataStrPro[8], settingDataStrPro[9] ]);
                      }
                      )
      }
      
      console.log(settingDataStrPro)
      

      Not know why I have these error. Console show me exactly 10 string (0 to 9). If scan database with a browser, all seems ok. Exist idx=1 and the column value is changed. Ok the table contains more than 10 column ... but i try to UPDATE entire row the error not disappear!!

      J Online
      J Online
      JonB
      wrote on 6 Apr 2019, 13:41 last edited by
      #2

      @gfxx
      Since you say you get

      Error: near "SET": syntax error

      show us exactly what nameChartPage is at the instant this line is executed, prove it by echoing the whole line before sending to SQL.

      G 1 Reply Last reply 8 Apr 2019, 08:25
      3
      • J JonB
        6 Apr 2019, 13:41

        @gfxx
        Since you say you get

        Error: near "SET": syntax error

        show us exactly what nameChartPage is at the instant this line is executed, prove it by echoing the whole line before sending to SQL.

        G Offline
        G Offline
        gfxx
        wrote on 8 Apr 2019, 08:25 last edited by
        #3

        @JonB so I control nameChartPage.lenght .... I use these query at desruption of my app page .... the query is call 2 time (not by myself but from my some error in code I supposed) .... the second time it is = 0 .... so query is for sure in error!!!!

        bkt

        1 Reply Last reply
        0

        1/3

        6 Apr 2019, 07:19

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved