VRev ADK + Val Studio = Best Practice

william humphrey bill at bluewatermaritime.com
Mon May 14 09:02:05 CDT 2012


Thanks. I'm going to send all my error messages through that to eliminate
the case when the error is caused by the database not being connected.

On Sun, May 13, 2012 at 11:33 PM, Kay C Lan <lan.kc.macmail at gmail.com>wrote:

> I've can't claim best practice, but I notice in some of my older stacks
> I've commented out
> vDatabase_IsOpen(tDbRef)
> or
> vConnection_IsConnected(tDbRef)
> and ended up with
> Valentina_DatabaseCount()
>
> The first two return TRUE if you have a connection, and are empty if not.
> The last one returns the number of connected DBs or 0 if none.
>
> In my case I've used a simple IF statement to test for a connection and if
> not I pop up an ask dialog to advise that the DB is no longer connected and
> that I need to reconnect with the choice to cancel or proceed.
>
> if (Valentina_DatabaseCount() = 0) then --no DB connection
>   ask "The DB Connection is lost. Do you wish to reconnect?" with "No" or
> "Yes" titled "DB Connection Lost"
>   put it into tAnswer
>   if (tAnswer = "Yes) then
>     put fDbOpen() into tDbRef
>     put fDbQuery(tQuery,tDbRef) into tData
>   else --don't proceed
>     exit to top
>   end if
> else --there is a DB connection
>   put fDbQuery(tQuery,tDbRef) into tData
> end if
>
> I can't remember why I abandoned the first two in favour of the last.
>
> In my case I'm only currently dealing with single embedded DBs (although
> tentatively playing with using V Office Server - see previous posts) so
> Valentina_DatabaseCount() gives me an answer that is suitable. I imagine in
> a Server environment where you may be connected to several DBs a simple
> count will not give you the necessary info that you have a valid connection
> to a particular DB. Where multiple DBs are involved I'd assume
> _IsConnected(tDbRef) or _IsOpen(tDbRef) would provide a definitive response.
>
> HTH
>
> On Mon, May 14, 2012 at 8:43 AM, william humphrey <
> bill at bluewatermaritime.com> wrote:
>
>> I have another question about best practice. It's true I'm testing the
>> new betas and one thing that happens when you do that is you get the old
>> defaults that times-out your vServer connection. So I have to go find that
>> init file and increase the time but I was thinking.
>>
>> Does anyone have a suggestion using LiveCode to pop-up a warning that the
>> database connection has failed? I could see this being very useful say the
>> server went down. Right now when the connection goes down I get a whole
>> string of errors from calls that fail. It would be better to get one nice
>> message.
>>
>> Can anyone help me with this LiveCode programming request?
>>
>> _______________________________________________
>> Valentina mailing list
>> Valentina at lists.macserve.net
>> http://lists.macserve.net/mailman/listinfo/valentina
>>
>>
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>
>


-- 
http://www.bluewatermaritime.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macserve.net/pipermail/valentina/attachments/20120514/32f2f31f/attachment.html>


More information about the Valentina mailing list