ODBC access (closing connections)

Bob Sneidar bobs at twft.com
Thu Mar 19 11:31:26 EDT 2009


Eventually the connection will time out and close. At least that is my  
experience with MySQL. I have had to write a function that checks to  
see if the database is open, traps for errors, opens it if it isn't  
open, and stores the database id in a global in any event. I call it  
every time I access the database (at least the first time in any  
script session). You never know how long a user is going to leave the  
app running idle.

BTW for multi-user apps, I also keep a table with the name of every  
table in the database and a number field associated with it. Whenever  
I update a table I increment it's number. That way I can check if a  
table I need has been updated since the last time I queried it, and if  
so I requery the whole dataset.

Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM

On Mar 19, 2009, at 6:41 AM, Roger.E.Eller at sealedair.com wrote:

>
> On Mon, 24 Mar 2008 01:53:27 -0700, Sarah Reichelt wrote:
>> Check out the docs for the revDataFromQuery function which I think
>> will do what you want in a lot less code.
>>
>> I think your script can be condensed to:
>>
>> put revOpenDatabase("ODBC","testdb",,,) into myDB
>> put "SELECT Item Id, Item Title from Item" into tSQL
>> revDataFromQuery(tab,return,myDB,tSQL) into fld "Item List"
>>
>> Cheers,
>> Sarah
>
> Source:
> http://www.mail-archive.com/use-revolution@lists.runrev.com/msg104599.html
>
> First of all, when I need database tips, I search the list for "Sarah
> Reichelt" because well... SHE'S AWESOME!  I have been using the  
> above 3
> lines very successfully in Rev 3.0 for accessing a Microsoft SQL  
> database
> via ODBC. I remember having to keep up with a connection id in the  
> past,
> and closing the database when done. Is that still required when  
> using the
> above method to retrieve a record? What happens if connections are  
> left
> open?
>
> Roger Eller <roger.e.eller at sealedair.com>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list