accessing database table on iPad

Ralph DiMola rdimola at evergreeninfo.net
Tue Sep 16 22:20:18 EDT 2014


Frantz,

Let's see if we get to the bottom of this.
First: If the db does not exist SQLite will create a blank one. This is the
good news! You know that your DB code is working.
You can always check if your "real" db is open by making sure one or more of
your tables is returned by the revDatabaseTableNames(databaseID) function.
Make sure you have the DB in the "copy files" pane of the standalone
settings. If so the check "the result" after the file copy.

Also this would be faster if the file is large.
put url ("binfile:" & sPath) into url ("binfile:" &
(specialFolderPath("Documents") & theMobilePath))

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net


-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Frantz Charles
Sent: Tuesday, September 16, 2014 9:28 PM
To: use-livecode at lists.runrev.com
Subject: accessing database table on iPad

To all,
I need your expertise help to solve this issue I encounter in the app I am
creating. Here is the problem:I create a SQLite database with 2 tables
containing data. The database is saved in the same folder than the app. I
can access with ease the database and read the records from my desktop. But
when I test the app with the emulator or with my iPad, even though a
database id is returned - proof that the database is open - I got the
following error: revdberr, Database Error: No such table Histoire" .  Here
are my codes.Here are the codes to open the database:

# Open the database

put "/users/frantzcharles/Documents/All About
LiveCode/Cric-Crac/CricCracDB.sqlite" into thePath
put "/CricCracDB.sqlite" into theMobilePath
if the environment = "mobile" then
 if there is not a file (specialFolderPath("Documents") & theMobilePath)
then        
  put (specialFolderPath("engine") & theMobilePath) into sPath        
  put url ("binfile:" & sPath) into dPath        
  put dPath into url ("binfile:" & (specialFolderPath("Documents") &
theMobilePath))     
 end if  

 put (specialFolderPath("Documents") & "/CricCracDB.sqlite") into tDBPath 
 put revOpenDatabase("sqlite", tDBPath ,,,,,,) into tConID
else 
 ## this is not mobile 
 put revOpenDatabase("sqlite", thePath ,,,,,,) into tConID
end if

Here are the codes to access the table
put "Select Hist_Question from Histoire where Hist_Id = " & tNextQ into tSQL
put revdb_querylist(,,g_ConID, tSQL) into tList


I am missing something. Which I can not put my finger on. Can any of you
help me? Thanks a lot
Frantz 		 	   		  
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list