datbase error msg: no such table: xxxx

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

datbase error msg: no such table: xxxx

Post by francof » Tue Feb 23, 2016 6:22 pm

Hi all,
testing my app on simulator I get error in subject, but the table exixts. in run mode works fine.
the opening code:

Code: Select all

on Connetti_DB                                                                                                         --connette il db
   local tConId
   
   put specialFolderPath("documents") & "/Gradazione-Babo.sqlite" into tDatabasePath
   put revOpenDatabase("sqlite", tDatabasePath, , , , ) into tConID
   
   if tConID is "" then 
      answer warning "Problem creating or accessing database!"
   else
      put tConID into gConID
      answer  "database aperto!"
   end if 
end Connetti_DB
and here the data acquisition code (in preOpenCard script):

Code: Select all

 put "SELECT * FROM Vitigni" into tSQL                               --ricava i dati vitigni dal db
   put revDataFromQuery(,,gConID,tSQL) into gListaViti
   
   handleRevDBerror gListaViti
   if the result is not empty then 
      answer warning the result
      exit preOpenCard
   end if
I have created and filled the DB with the progr. SqliteBrowser.

one more question: I have put the DB in the folder Documents of the pc and declared the DB in specialFolderPath documents, why the progr. create an empty copy of it in the folder where the progr. is? why does it looking for in that folder?

thanks for help
franco

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: datbase error msg: no such table: xxxx

Post by Simon » Wed Feb 24, 2016 3:23 am

Hi franco,
Do you copy the database using the Copy Files tab in the standalone builder?
It will end up in specialFolderPath("engine") from there you have to copy it to specialFolderPath("documents") to work with it.

But I probably misunderstood your question :oops:

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: datbase error msg: no such table: xxxx

Post by francof » Wed Feb 24, 2016 6:57 pm

hi Simon,
i have tested it only on the simulator, the db is both in the folders (of the pc) documents and in the folder where the app is saved.
I do not have connection error, have a valid conn.id number, so I think app find the db. but not the table!!
I will try on real device.

thanks, ciao
franco

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: datbase error msg: no such table: xxxx

Post by Simon » Wed Feb 24, 2016 7:03 pm

Hi franco,
That is one of the problems (?) with revOpenDatabase, if the database isn't there it will create a new empty db.
Check it out in the dictionary.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: datbase error msg: no such table: xxxx

Post by francof » Thu Feb 25, 2016 4:18 pm

ciao Simon,
I found it out. you got me the solution in your first post: specialFolderPath("engine") from where to copy the db file.
foolishly :oops: , I do not have carefully evaluated your suggestion.

now the app find the correct db and all works.
thanks again
franco

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: datbase error msg: no such table: xxxx

Post by Simon » Thu Feb 25, 2016 9:21 pm

Great to hear Franco!
Have fun coding :)

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: datbase error msg: no such table: xxxx

Post by francof » Fri Feb 26, 2016 10:43 am

Simon wrote:Great to hear Franco!
Have fun coding :)

Simon
Yes, surely in coding there is fun, many times just a bit and a lot of trouble :)
solved an (a?) issue, I stumble upon another one...

see you soon :wink:
franco

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: datbase error msg: no such table: xxxx

Post by francof » Fri Feb 26, 2016 5:21 pm

francof wrote: ... I stumble upon another one...
famous last words!

ok, now it run in mobile devices but... no more in windows.
maybe do I must to use 2 different controls, and hide/show the right one depending by the environment in use?

franco

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: datbase error msg: no such table: xxxx

Post by Simon » Fri Feb 26, 2016 6:19 pm

Hi,
Yes, you do have to use 2 different setups.
Check out "the platform" in the dictionary.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: datbase error msg: no such table: xxxx

Post by francof » Sat Feb 27, 2016 12:55 pm

ciao Simon,

usually I use "environment" to select which code must run. not sure to undrestand which is the difference with "platform"
from the dictionary:
platform: Returns the name of the operating system LiveCode is running on.
environment: Returns the type of running environment the stack is in.

anyway, I changed the Option Menu with a standard button and a field.

franco

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: datbase error msg: no such table: xxxx

Post by SparkOut » Sat Feb 27, 2016 1:48 pm

In place of specialFolderPath("engine") try specialFolderPath("resources")

"resources" is a more recent(ish) addition which works on desktop and mobile to evaluate the equivalent path for bundled files.


"environment" determines whether you're working in "development" (the IDE) or as a standalone on mobile or desktop, which can be further identified with "platform" more specifically.

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: datbase error msg: no such table: xxxx

Post by francof » Sat Feb 27, 2016 2:28 pm

Hi Sparkout,

thanks for your clarification.
I will take a look for "resources"

franco

Post Reply