This is how I count the open servers when I close the shellwindow.
This in case I made some code addition and forget to close one or more servers. Doesnt take long to do so.
FOR wAlias := 1 UPTO 1024
IF .NOT. ( ALIAS(wAlias) == NULL_STRING )
dwMethresult += 1
ENDIF
NEXT
John
Johan Nel schreef op 29-1-2015 om 14:58:
Chris,
No, what I do is to have a STATIC var that basically works on the following principle:
STATIC LOCAL aDbServers AS ARRAY
aDbServers := {}
Then I have a class/function/method that interacts with my open DbServers
FUNCTION ServerOpen(sAlias AS STRING)
IF (nPos := Ascan(aDbServers, {|a| a[1] == sAlias})) > 0
oDb := aDbServer[nPos, 2]
aDbServer[nPos, 3] += 1
ELSE
oDb := <Open your server>
Aadd(aDbServers, {sAlias, oDb, 1})
ENDIF
RETURN oDb
FUNCTION ServerClose(sAlias AS STRING)
IF (nPos := Ascan(aDbServers, {|a| a[1] == sAlias})) = 0
// Throw error the server is not open
ELSE
aDbServers[nPos, 3] -= 1
IF aDbServers[nPos, 3] <= 0
ADel(aDbServers, nPos)
ENDIF
ENDIF
RETURN lClosed
FUNCTION ServerGet(sAlias)
nPos := AScan(aDbServers, {|a| a[1] == sAlias})
RETURN aDbServers[nPos, 2]
Basically all my interactions with servers are handled by the above three FUNCTIONS that keep track of how many references to each one is active. You have only 1 "workarea" for each DbServer.
HTH,
Johan
On Thursday, January 29, 2015 at 3:19:31 PM UTC+2, CMc wrote:
Thanks Johan. So is there an easy way to determine the total number of work areas already open? As a quick fix I could trap the error and let the user know they need to close some other windows.
Thanks,
Chris
On Thursday, January 29, 2015 at 12:12:15 AM UTC-6, Johan Nel wrote:
Chris,
Yes this is still the limitation. You need to externalise your connections to tables into a shared collection that handles your interface to the database. Very unlikely that any process ever will need 1024 open tables to perform a task.
Regards,
Johan Nel
Vulcan VIP
Durban, South Africa.
Sorry to dig old subject out but just recently I have been hit with a
problem that when on one PC many windows with many DBF's have been
opened (alhough far from 1024) another PC could not add a record to a particular shared DBF - Append() yelded FALSE. As soon as I closed
some windows on another PC all returned to proper work. Where should
I seek for error - is it a local app (VO 2.8) or server (QNAP file
sever) limit. If it's is the app setup like in old CLIPPER (Set files
= xxx) where I can change it?
Hi Gregory,
Sorry to dig old subject out but just recently I have been hit with a problem that when on one PC many windows with many DBF's have beenVO has a limit of 1023 open work areas, but since you can open the DBF closing a table on another PC it sounds really like a limit on your NAS (probably Linux, but maybe also Windows Storage Server if it is a
opened (alhough far from 1024) another PC could not add a record to a particular shared DBF - Append() yelded FALSE. As soon as I closed
some windows on another PC all returned to proper work. Where should
I seek for error - is it a local app (VO 2.8) or server (QNAP file
sever) limit. If it's is the app setup like in old CLIPPER (Set files
= xxx) where I can change it?
highend NAS).
Wolfgang
--Hello Wolfgang
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 286 |
Nodes: | 16 (3 / 13) |
Uptime: | 92:01:14 |
Calls: | 6,498 |
Calls today: | 9 |
Files: | 12,100 |
Messages: | 5,277,848 |