Database readwrite and read only detection

Post Reply
Gilbert
Posts: 74
Joined: Thu Oct 20, 2005 4:30 pm
Location: Canada

Database readwrite and read only detection

Post by Gilbert »

Hi all,


I would like to know if any of you has a way of detecting if a database has been opened in readwrite or readonly mode.

In Clipper 5.3 there is a function called dbInfo() which allows to detect retreive multiple information from an opened database, but could not find anything that would retreive this information.

Also have another situation where I need to retreive either the number of opened index or a list of opened index of an area. This can be known if using OrderBag, but for technical reasons (interfacing with an external application) I must open each index individually. Since I don`t want to keep track of how many indexes have been opened or closed while processing, I`m looking for a function that could evaluate the opened indexes when needed.

Regards, :!:
Gilbert Vaillancourt
turbolog@videotron.ca
User avatar
Badara Thiam
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France
Contact:

Re: Database readwrite and read only detection

Post by Badara Thiam »

Bonjour Gilbert,
Gilbert wrote:I`m looking for a function that could evaluate the opened indexes when needed.
Voici une fonction 100 % opérationnelle !

Code: Select all

*******************
FUNCTION INDEXACTIF()
*******************
* Creation le 10/09/1998
* Auteur Badara Thiam
* Retourne les index actifs dans la base de données courante,
* sous forme d'un tableau dont chaque élément est un index
LOCAL TT := { {}, 1, NIL }
DO WHILE .T.
  TT[3] := ORDNAME(TT[2], ORDBAGNAME(TT[2]))
  IF TT[3] != ""
    AADD(TT[1], TT[3])
    TT[2] ++
  ELSE
    EXIT
  ENDIF
ENDDO
RETURN ACLONE(TT[1])
Regards, :lol: :wink:
Badara Thiam
http://www.icim.fr
Gilbert
Posts: 74
Joined: Thu Oct 20, 2005 4:30 pm
Location: Canada

Post by Gilbert »

Bonjour Badara,


Merci, je teste ca immédiatement et je t`en donnes des nouvelles.




8)
Gilbert Vaillancourt
turbolog@videotron.ca
Gilbert
Posts: 74
Joined: Thu Oct 20, 2005 4:30 pm
Location: Canada

Post by Gilbert »

Bonjour Badara,


Je te remercie pour le petit truc. Ca fonctionne à merveille avec les index multiples .CDX, par contre j`ai aussi besoin de faire la même chose avec des index indépendants. C`est à dire plusieurs .CDX ouvert individuellement.

Grace à ton truc j`ai réussi à faire les deux. Il fallait y penser et ton truc ma mis sur la piste. Voici le code:

local cOrders
local nOrders := 0

do while .T.
cOrders := OrdBagName(nOrders +1)
if cOrder == ``
exit
endif
++nOrders
enddo

Et voilà, le tour est joué.

Merci :D

[/code]
Gilbert Vaillancourt
turbolog@videotron.ca
Post Reply