Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

xp_read_file filespec no longer defaults to starting directory

2 posts in General Discussion Last posting was on 2005-10-02 17:14:47.0Z
Breck Carter [TeamSybase] Posted on 2005-10-02 17:12:54.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: xp_read_file filespec no longer defaults to starting directory
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <hn40k1l73rhqa42586uposdgen3pqdu2v4@4ax.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: 208.254.244.99
X-Original-Trace: 2 Oct 2005 10:10:43 -0700, 208.254.244.99
Lines: 40
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 2 Oct 2005 10:10:43 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 2 Oct 2005 10:12:54 -0700
X-Trace: forums-1-dub 1128273174 10.22.108.75 (2 Oct 2005 10:12:54 -0700)
X-Original-Trace: 2 Oct 2005 10:12:54 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!forums-2-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4824
Article PK: 8565

In 9.0.2.3193 the xp_read_file filespec no longer defaults to the
starting directory of the database server as it did previously; e.g.,
in 8.0.3.5122.

I cannot figure out *what* the default value is, I tried all the usual
suspects (win32, root, windows, various folders under Documents and
Settings, etc).

The bottom line is, the following code works in 8.0.3.5122 but does
not find the file in 9.0.2.3193, even though the file is located in
the same folder that the engine was started in. In 9.0.2.3193 you must
provide the full drive and path:

=====
BEGIN

DECLARE @contents LONG BINARY;

SELECT xp_read_file ( 'test.txt' )
INTO @contents;

MESSAGE STRING (
'contents = "',
COALESCE ( @contents, '[NULL]' ),
'"' ) TO CLIENT;

END;
=====

This makes it a challenge to write portable code; e.g., code that does
not care where it is installed or run from.

Breck

--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com


Breck Carter [TeamSybase] Posted on 2005-10-02 17:14:47.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: xp_read_file filespec no longer defaults to starting directory
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <b750k11c9bfjke8mmotcogb1tvu1mksp6i@4ax.com>
References: <hn40k1l73rhqa42586uposdgen3pqdu2v4@4ax.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: 208.254.244.99
X-Original-Trace: 2 Oct 2005 10:12:34 -0700, 208.254.244.99
Lines: 11
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 2 Oct 2005 10:12:36 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 2 Oct 2005 10:14:47 -0700
X-Trace: forums-1-dub 1128273287 10.22.108.75 (2 Oct 2005 10:14:47 -0700)
X-Original-Trace: 2 Oct 2005 10:14:47 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!forums-2-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4825
Article PK: 8566

oops, wrong ng, reposting...

Breck


--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com