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.

AdsGetString & AdsGetField

3 posts in FoxPro Last posting was on 2007-01-30 23:58:51.0Z
Andrej Svajger Posted on 2007-01-30 12:56:40.0Z
Reply-To: "Andrej Svajger" <andrej.svajger@jaksa-group.si>
From: "Andrej Svajger" <andrej.svajger@jaksa-group.si>
Newsgroups: advantage.foxpro
Subject: AdsGetString & AdsGetField
Date: Tue, 30 Jan 2007 13:56:40 +0100
Lines: 22
Organization: Jaksa group
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 213.253.88.97
Message-ID: <45bf3f70@solutions.advantagedatabase.com>
X-Trace: 30 Jan 2007 05:52:00 -0700, 213.253.88.97
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!213.253.88.97
Xref: solutions.advantagedatabase.com Advantage.FoxPro:225
Article PK: 1109577

Hi, i'm having problems using AdsGetString and AdsGetField functions for
getting data from the table. Since length parameter (pulLen) MUST indicate
the size of the data to be retrieved, i use AdsGetFieldLength to get this
size. But when i try to retrieve data from the table, i allways get 5005 -
AE_INSUFFICIENT_BUFFER result and the PulLen indicates the same size as mine
was + 1.
Because i use result as indicator of proper use (should be 0), i can't
retrieve data from table. Any suggestions ?
One can overcome such awkward behaviour by simply adding 1 to the size
parameter, but i'm more interested about other possible "cases" with Visual
FoxPro.

RetVal = adsGetFieldLength(hTab, cFieldName, @nLen)
-- nLen is 3 (field length IS 3)
-- works ok (RetVal = 0), if i increase nLen by 1
cRet = space(nLen)
RetVal = adsGetString(hTab, cFieldName, @cRet, @nLen, ads_none)
-- RetVal is 5005 and nLen is 4

Thanks for the answer.


Jeremy Mullin Posted on 2007-01-30 23:58:51.0Z
Date: Tue, 30 Jan 2007 23:58:51 +0000 (UTC)
Message-ID: <886edc152231b8c912a70d7f826f@devzone.advantagedatabase.com>
From: Jeremy Mullin <no@email.com>
Subject: Re: AdsGetString & AdsGetField
Newsgroups: Advantage.FoxPro
References: <45bf3f70@solutions.advantagedatabase.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=iso-8859-1; format=flowed
X-Newsreader: JetBrains Omea Reader 928.2
NNTP-Posting-Host: 10.24.38.110
X-Trace: 30 Jan 2007 16:54:30 -0700, 10.24.38.110
Lines: 36
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!10.24.38.110
Xref: solutions.advantagedatabase.com Advantage.FoxPro:227
Article PK: 1109580

Hi Andrej,

The length parameter does not have to indicate the size of the data to be
retrieved, it has to indicate the size of the buffer you are giving the API
call. If you have a buffer that is 1024 bytes, for example, you can pass
a length of 1024, and after the API returns, it will have changed the length
parameter to indicate how many bytes it put into your buffer. If there wasn't
enough room, you will get the AE_INSUFFICIENT_BUFFER error as you have seen,
and then you can try again with a buffer that is big enough.

J.D. Mullin
Advantage R&D

> Hi, i'm having problems using AdsGetString and AdsGetField functions
> for
> getting data from the table. Since length parameter (pulLen) MUST
> indicate
> the size of the data to be retrieved, i use AdsGetFieldLength to get
> this
> size. But when i try to retrieve data from the table, i allways get
> 5005 -
> AE_INSUFFICIENT_BUFFER result and the PulLen indicates the same size
> as mine
> was + 1.
> Because i use result as indicator of proper use (should be 0), i can't
> retrieve data from table. Any suggestions ?
> One can overcome such awkward behaviour by simply adding 1 to the size
> parameter, but i'm more interested about other possible "cases" with
> Visual
> FoxPro.
> RetVal = adsGetFieldLength(hTab, cFieldName, @nLen)
>
> Thanks for the answer.
>


Paul Posted on 2007-01-30 14:51:45.0Z
Date: Tue, 30 Jan 2007 14:51:45 +0000
From: Paul <paul.hill@hoist-technology.com>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: advantage.foxpro
Subject: Re: AdsGetString & AdsGetField
References: <45bf3f70@solutions.advantagedatabase.com>
In-Reply-To: <45bf3f70@solutions.advantagedatabase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 217.41.78.65
Message-ID: <45bf5a79@solutions.advantagedatabase.com>
X-Trace: 30 Jan 2007 07:47:21 -0700, 217.41.78.65
Lines: 28
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!217.41.78.65
Xref: solutions.advantagedatabase.com Advantage.FoxPro:226
Article PK: 1109581

Hi Andrej

Andrej Svajger wrote:
> Hi, i'm having problems using AdsGetString and AdsGetField functions for
> getting data from the table. Since length parameter (pulLen) MUST indicate
> the size of the data to be retrieved, i use AdsGetFieldLength to get this
> size. But when i try to retrieve data from the table, i allways get 5005 -
> AE_INSUFFICIENT_BUFFER result and the PulLen indicates the same size as mine
> was + 1.
> Because i use result as indicator of proper use (should be 0), i can't
> retrieve data from table. Any suggestions ?
> One can overcome such awkward behaviour by simply adding 1 to the size
> parameter, but i'm more interested about other possible "cases" with Visual
> FoxPro.
>
> RetVal = adsGetFieldLength(hTab, cFieldName, @nLen)
> -- nLen is 3 (field length IS 3)
> -- works ok (RetVal = 0), if i increase nLen by 1
> cRet = space(nLen)
> RetVal = adsGetString(hTab, cFieldName, @cRet, @nLen, ads_none)
> -- RetVal is 5005 and nLen is 4

adsGetFieldLength() returns the width of the field, but you must
allocate 1 extra character for the data because adsGetString() returns
the string + a zero byte terminator.

--
Paul