FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for CA-Clipper Database readwrite and read only detection
Posts: 74
Joined: Thu Oct 20, 2005 04:30 PM
Database readwrite and read only detection
Posted: Wed Nov 01, 2006 11:33 PM

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 dont want to keep track of how many indexes have been opened or closed while processing, Im looking for a function that could evaluate the opened indexes when needed.

Regards, :!:

Gilbert Vaillancourt
turbolog@videotron.ca
Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Re: Database readwrite and read only detection
Posted: Thu Nov 02, 2006 09:41 PM
Bonjour Gilbert,

Gilbert wrote:I`m looking for a function that could evaluate the opened indexes when needed.


Voici une fonction 100 % opérationnelle !


*******************
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, :-) :-)
Badara Thiam
http://www.icim.fr
Posts: 74
Joined: Thu Oct 20, 2005 04:30 PM
Database readwrite and read only detection
Posted: Fri Nov 03, 2006 01:27 AM

Bonjour Badara,

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

8)

Gilbert Vaillancourt
turbolog@videotron.ca
Posts: 74
Joined: Thu Oct 20, 2005 04:30 PM
Database readwrite and read only detection
Posted: Fri Nov 03, 2006 02:36 AM

Bonjour Badara,

Je te remercie pour le petit truc. Ca fonctionne à merveille avec les index multiples .CDX, par contre jai aussi besoin de faire la même chose avec des index indépendants. Cest à 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

Continue the discussion