Page 1 of 1

Problems with importing SQLite3 with Exec in Gambas

Posted: Tuesday 2nd April 2024 7:08pm
by gambafeliz
I have a file with data that I want to add to an empty table. But when I use this statement on an already open database, it doesn't work. But when I do it from within in SQLite3 this same statement works perfectly fine. Give me some clue why it doesn't work. Indicate tells me that the (.) in front of import is the problem.

      sSQL = ".import " & Application.Path & "/" & "file.dat table1" 
      mg.gConn.Exec(sSQL)

Re: Problems with importing SQLite3 with Exec in Gambas

Posted: Tuesday 2nd April 2024 10:14pm
by thatbruce
Thats because ".import" is an sqlite (the terminal front end) command, not an SQL verb. The gb.db.sqlite component works with the sqlite library, not the front end. You need to send the command to the front end via Shell or Exec.
b

Re: Problems with importing SQLite3 with Exec in Gambas

Posted: Wednesday 3rd April 2024 7:37am
by gambafeliz
Thank you very much, it will surely be like that.