Re: accessing database table on iPad

2014-09-17 Thread Dave Kilroy
Frantz

You are putting the result from revOpenDatabase() into tConID, but later on
with revdb_querylist() you are using g_ConID - does g_ConID hold the same
value as tConID?

Dave



-
Some are born coders, some achieve coding, and some have coding thrust upon 
them. - William Shakespeare  Hugh Senior

--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/accessing-database-table-on-iPad-tp4683322p4683335.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: accessing database table on iPad

2014-09-17 Thread Peter Haworth
Good catch, missed that.  I think, though, that if you specify an invalid
connection id, you get a runtime script error rather than the database
error he's getting back.
That's another thing that really should be changed so it returns an error
in the connection id instead of a run time error.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Wed, Sep 17, 2014 at 1:40 AM, Dave Kilroy d...@applicationinsight.com
wrote:

 Frantz

 You are putting the result from revOpenDatabase() into tConID, but later on
 with revdb_querylist() you are using g_ConID - does g_ConID hold the same
 value as tConID?

 Dave



 -
 Some are born coders, some achieve coding, and some have coding thrust
 upon them. - William Shakespeare  Hugh Senior

 --
 View this message in context:
 http://runtime-revolution.278305.n4.nabble.com/accessing-database-table-on-iPad-tp4683322p4683335.html
 Sent from the Revolution - User mailing list archive at Nabble.com.

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: accessing database table on iPad

2014-09-16 Thread Ralph DiMola
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
rdim...@evergreeninfo.net


-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
Of Frantz Charles
Sent: Tuesday, September 16, 2014 9:28 PM
To: use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: accessing database table on iPad

2014-09-16 Thread Peter Haworth
Sounds like the path to your db is wrong. LC happily creates an empty file
for you which is not even formatted as an sqlite db! I've always thought
that was flat out wrong.

I would check that your db  file exists before calling revdatabaseopen with
the exists() function.

Pete
lcSQL Software
On Sep 16, 2014 6:27 PM, Frantz Charles fzcharles0...@hotmail.com wrote:

 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 databaseput
 /users/frantzcharles/Documents/All About
 LiveCode/Cric-Crac/CricCracDB.sqlite into thePathput /CricCracDB.sqlite
 into theMobilePathif the environment = mobile then if there is not a
 file (specialFolderPath(Documents)  theMobilePath) thenput
 (specialFolderPath(engine)  theMobilePath) into sPathput url
 (binfile:  sPath) into dPathput dPath into url (binfile: 
 (specialFolderPath(Documents)  theMobilePath)) end if  put
 (specialFolderPath(Documents)  /CricCracDB.sqlite) into tDBPath  put
 revOpenDatabase(sqlite, tDBPath ,,) into tConIDelse  ## this is not
 mobile  put revOpenDatabase(sqlite, thePath ,,) into tConIDend ifHere
 are the codes to access the tableput 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@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode