Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #9522 > unrolled thread

How to open a DBF with a UNC path

Started byD.J.W. van Kooten <vankooten@removethis.ic2.com>
First post2016-07-13 12:49 +0200
Last post2016-07-18 09:06 +0100
Articles 8 — 5 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  How to open  a DBF with a UNC path D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2016-07-13 12:49 +0200
    Re: How to open  a DBF with a UNC path sherlocksoftware@gmail.com - 2016-07-13 04:10 -0700
      Re: How to open  a DBF with a UNC path D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2016-07-13 15:43 +0200
    Re: How to open a DBF with a UNC path "Wolfgang Riedmann" <wriedmann@gmail.com> - 2016-07-13 15:08 +0200
      Re: How to open a DBF with a UNC path D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2016-07-15 14:39 +0200
        Re: How to open a DBF with a UNC path sherlocksoftware@gmail.com - 2016-07-15 06:17 -0700
    Re: How to open  a DBF with a UNC path Leo_Bond <l.bond@bk.ru> - 2016-07-15 08:26 -0700
    Re: How to open a DBF with a UNC path Martin <Martin@spam.spam> - 2016-07-18 09:06 +0100

#9522 — How to open a DBF with a UNC path

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2016-07-13 12:49 +0200
SubjectHow to open a DBF with a UNC path
Message-ID<kq6coblvsun78482jq7lj6sklvrv7pj4ul@4ax.com>
Following my questions about how to run a program from Windows Task
Scheduler, I found that a mapped drive does not seem to work in later
Windows versions. I figured out (reading all posts here) that a UNC
path doesn't work because of in the init of dbserver, Curdrive() is
added so it looks a bit like this :

f:\\myserver\mydir etc.

I am not sure how to solve this except replacing the whole VO28RDD.DLL
with a modified source of that DLL. As soon as I I run a SUPER:INIT to
dbserver the error emerges. I can add a preinit but 1) it isn't even
called and 2) I guess I still can't prevent the addition of a drive
letter to happen.

How did others solve this?

Dick

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [next] | [standalone]


#9523

Fromsherlocksoftware@gmail.com
Date2016-07-13 04:10 -0700
Message-ID<fde25ae1-d32c-4eec-8b26-c1a002dfb2d8@googlegroups.com>
In reply to#9522
Dick

I open DBSERVER to UNC paths fine..

SetDefault('\\2012-pdc\zz_DATA\')   

oDB := DBSERVER{"mydata"}


Phil McGuinness

[toc] | [prev] | [next] | [standalone]


#9525

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2016-07-13 15:43 +0200
Message-ID<bvecobtj8smd6nniitmj7q2t5aadqk06sl@4ax.com>
In reply to#9523
Replying on message of Wed, 13 Jul 2016 04:10:46 -0700 (PDT) from
sherlocksoftware@gmail.com:


 Hello Phil,

>I open DBSERVER to UNC paths fine..
>
>SetDefault('\\2012-pdc\zz_DATA\')   
>
>oDB := DBSERVER{"mydata"}
>

This seems to work indeed!

I found quite a few posts about this but nore had this simple
solution.

Thank you very much.

Dick

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#9524 — Re: How to open a DBF with a UNC path

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2016-07-13 15:08 +0200
SubjectRe: How to open a DBF with a UNC path
Message-ID<dumsqqF2jc3U1@mid.individual.net>
In reply to#9522
Hi Dick,

> Following my questions about how to run a program from Windows Task
> Scheduler, I found that a mapped drive does not seem to work in later
> Windows versions. I figured out (reading all posts here) that a UNC
> path doesn't work because of in the init of dbserver, Curdrive() is
> added so it looks a bit like this :
> 
> f:\\myserver\mydir etc.


this is strange: for me UNC paths DOES work! And not from yesterday....
The DBServer:Init() method from 2.8 does not use any CurDrive() code.

You could try to pass in a FileSpec object instead of the file name in
string form.


> I am not sure how to solve this except replacing the whole VO28RDD.DLL
> with a modified source of that DLL. As soon as I I run a SUPER:INIT to
> dbserver the error emerges. I can add a preinit but 1) it isn't even
> called and 2) I guess I still can't prevent the addition of a drive
> letter to happen.

as I wrote: I don't have this problem, neither with the service,
neither with programs startet from the task scheduler, and also normal
GUI programs are working with UNC paths.

Wolfgang

-- 

[toc] | [prev] | [next] | [standalone]


#9527 — Re: How to open a DBF with a UNC path

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2016-07-15 14:39 +0200
SubjectRe: How to open a DBF with a UNC path
Message-ID<87mhob5ef298ccuvpfkab80sr8svmcfc5a@4ax.com>
In reply to#9524
Replying on message of Wed, 13 Jul 2016 15:08:34 +0200 from Wolfgang
Riedmann:


 Hello Wolfgang,

>this is strange: for me UNC paths DOES work! And not from yesterday....
>The DBServer:Init() method from 2.8 does not use any CurDrive() code.
>
>You could try to pass in a FileSpec object instead of the file name in
>string form.

That may be the cause. I found the message below in this NG in 2000,
from Adriano, which seems what happened here. I guess both your
solution and the solution from Phil prevent that from happening:


Dick

===========================================

Normally you shouldn't have any problems opening DBF files with UNC
paths...

However, if you are using the DbServer:init() method automatically
generated by the VO2.5 Dbserver Editor, you will find something like:

    IF IsString(cDBF)
        //  UH 01/18/2000
        oFSTemp := FileSpec{SELF:cDBFPath + SELF:cName}
        oFS     := FileSpec{cDBF}

        IF SLen(oFS:Drive) = 0 <--Here!
            oFS:Drive := CurDrive()
        ENDIF
        IF SLen(oFS:Path) = 0
            oFS:Path  := "\" + CurDir()
        ENDIF

... basically what VO is doing is inspecting the Filespec object
constructed with the supplied UNC path, and prefixing it with the
CurDrive(). In this case VO ends up trying to open...

C:\\NTSERVER1\DIRECTORY1\FILE.DBF

which will present you with a nice error box reporting that such file
does not exist...


--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#9528 — Re: How to open a DBF with a UNC path

Fromsherlocksoftware@gmail.com
Date2016-07-15 06:17 -0700
SubjectRe: How to open a DBF with a UNC path
Message-ID<1d8ca7cd-e419-4454-89f2-8086e3bcdb25@googlegroups.com>
In reply to#9527
Dick

Replaced the default VO generated code to work like this.

Phil McGuinness

CLASS _RECEIPTN INHERIT DBSERVER
	INSTANCE cDBFPath	  := "\SHERLOCK32\SHERDATA\" AS STRING
	INSTANCE cName		  := "RECEIPTN.DBF" AS STRING
	INSTANCE xDriver	  := "DBFCDX"		 AS USUAL
	INSTANCE lReadOnlyMode:= .F.		 AS LOGIC
	INSTANCE lSharedMode  := .T.	 AS USUAL
	INSTANCE nOrder 	  := 0	 AS INT
	//USER CODE STARTS HERE (do NOT remove this line)

METHOD Init(cDBF, lShare, lRO, xRdd) CLASS _RECEIPTN
    LOCAL oFS := FileSpec{} AS FILESPEC             
    SELF:PreInit()
    oFS:Filename := SELF:cDBFPath + SELF:cName
    //
    lShare := IIF( IsLogic( lShare ), lShare, SELF:lSharedMode ) 
    IF IsString(cDBF)
      oFS := FileSpec{SELF:cDBFPath + FileSpec{cDBF}:FileName + FileSpec{cDBF}:Extension}
    ENDIF
    SUPER:Init(oFS, lShare, lRO, xRdd )
    SELF:oHyperLabel := HyperLabel{#_RECEIPTN, "_RECEIPTN", "", "_RECEIPTN"}
    SELF:PostInit()
   RETURN SELF

METHOD PreInit() CLASS _RECEIPTN
    	//Put your PreInit additions here
    	cDBFPath := NULL_STRING
RETURN NIL

METHOD PostInit() CLASS _RECEIPTN
	//Put your PostInit additions here
	SELF:ConcurrencyControl := CCNONE
	RETURN NIL
==========
Change your CAVODED.TPL to this code

[CLASS]
CLASS %classname% INHERIT %superclass%
	INSTANCE cDBFPath	  := "%dbfpath%" AS STRING
	INSTANCE cName		  := "%dbfname%" AS STRING
	INSTANCE xDriver	  := %rdd%		 AS USUAL
	INSTANCE lReadOnlyMode:= %ro%		 AS LOGIC
	INSTANCE lSharedMode  := %share%	 AS USUAL
	INSTANCE nOrder 	  := %order%	 AS INT

[INIT]
METHOD Init(cDBF, lShare, lRO, xRdd) CLASS %classname%
    LOCAL oFS := FileSpec{} AS FILESPEC             
    SELF:PreInit()
    oFS:Filename := SELF:cDBFPath + SELF:cName
    //
    lShare := iif( IsLogic( lShare ), lShare, SELF:lSharedMode ) 
    IF IsString(cDBF)
      oFS := FileSpec{SELF:cDBFPath + FileSpec{cDBF}:FileName + FileSpec{cDBF}:Extension}
    ENDIF
    SUPER:Init(oFS, lShare, lRO, xRdd )
    self:oHyperLabel := HyperLabel{#%hlname%, "%hlcaption%", "%hldescription%", "%hlhelpcontext%"}
    SELF:PostInit()
   RETURN SELF

[FIELDDESC]
ACCESS FieldDesc CLASS %classname%
   LOCAL aRet := {}  AS ARRAY
   LOCAL nFields := %fieldcount% AS DWORD
   IF nFields > 0
      aRet := ArrayCreate(nFields)  // DBC_SYMBOL // DBC_NAME // DBC_FIELDSPEC
      %fielddesc%
   ENDIF
   RETURN aRet

[INDEXLIST]
ACCESS IndexList CLASS %classname%
   LOCAL aRet  := {} AS ARRAY // DBC_INDEXNAME // DBC_INDEXPATH // DBC_ORDERS
   LOCAL nIndexCount := %indexcount% AS DWORD    //{<cOrder>,<lDuplicates>,<lAscending>,<cKey>,<cFor>}
   IF nIndexCount > 0
     //DBC_TAGNAME/DBC_DUPLICATE/DBC_ASCENDING/DBC_KEYEXP/DBC_FOREXP
     aRet := ArrayCreate(nIndexCount)
     %indexlist%
   ENDIF
   RETURN aRet

[PREINIT]
METHOD PreInit() CLASS %classname%
	//Put your PreInit additions here
   cDBFPath := NULL_STRING
	RETURN NIL

[POSTINIT]
METHOD PostInit() CLASS %classname%
	//Put your PostInit additions here
	SELF:ConcurrencyControl := CCNONE
	RETURN NIL

[MACROS]
FieldDesc=\r\n\t\taRet[%pos%] := { #%hlname%, \"%fldname%\",  %classname%{}} \t// %hldescription%
Index=\r\n\t\taRet[%pos%] := { \"%indexname%\", \"%dbfpath%\",; \r\n \t\t\t\t\t{%orderlist% } }
Order={ \"%tag%\", %duplicate%, %ascending%, [%keyexp%], [%forexp%] }





[toc] | [prev] | [next] | [standalone]


#9529

FromLeo_Bond <l.bond@bk.ru>
Date2016-07-15 08:26 -0700
Message-ID<3bcd77ec-df06-4204-a044-8f081429ca4f@googlegroups.com>
In reply to#9522
My solution: added these 4 lines to CavoDed.tpl

oFS:Path:=cDataPath 
IF Left(oFS:Path,2) == "\\"
	oFS:Drive:=""
ENDIF

"cDataPath" is a global var that is initialised in the Start method of an App (read from Registry).

[toc] | [prev] | [next] | [standalone]


#9532 — Re: How to open a DBF with a UNC path

FromMartin <Martin@spam.spam>
Date2016-07-18 09:06 +0100
SubjectRe: How to open a DBF with a UNC path
Message-ID<nmi2lh$fli$2@dont-email.me>
In reply to#9522
Works perfectly for me

On 13/07/2016 11:49, D.J.W. van Kooten wrote:
> Following my questions about how to run a program from Windows Task
> Scheduler, I found that a mapped drive does not seem to work in later
> Windows versions. I figured out (reading all posts here) that a UNC
> path doesn't work because of in the init of dbserver, Curdrive() is
> added so it looks a bit like this :
>
> f:\\myserver\mydir etc.
>
> I am not sure how to solve this except replacing the whole VO28RDD.DLL
> with a modified source of that DLL. As soon as I I run a SUPER:INIT to
> dbserver the error emerges. I can add a preinit but 1) it isn't even
> called and 2) I guess I still can't prevent the addition of a drive
> letter to happen.
>
> How did others solve this?
>
> Dick
>
> --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web