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.

VFP and CursorAdapter

3 posts in FoxPro Last posting was on 2010-08-05 09:46:04.0Z
Jürgen Meijerink Posted on 2010-07-30 09:54:31.0Z
From: "Jürgen Meijerink" <meijerink@mekodata.de>
Newsgroups: advantage.foxpro
Subject: VFP and CursorAdapter
Date: Fri, 30 Jul 2010 11:54:31 +0200
Lines: 67
Organization: mekoDATA GbR
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 91.190.230.220
Message-ID: <4c52a0a6@solutions.advantagedatabase.com>
X-Trace: 30 Jul 2010 03:51:34 -0700, 91.190.230.220
Path: solutions.advantagedatabase.com!91.190.230.220
Xref: solutions.advantagedatabase.com Advantage.FoxPro:368
Article PK: 1109723

Hello,

I make my first steps with ADS under VFP and have problems to get all
records from a table. With "SELECT * FROM adressen" I get an empty cursor.
"SELECT TOP 5000000 * FROM adressen" gives me all records. Why?

Here is my sourcecode:

LOCAL loCA AS CursorAdapter, ;
loConn AS ADODB.Connection, ;
loRS AS ADODB.Recordset, ;
loException AS Exception, ;
lcConnString AS String

lcConnString = "Provider=Advantage.OLEDB.1;User ID=adssys;Data
Source=\\192.168.10.241:6262\ADS_Daten\018\2010\mandant.add;" + ;
"ServerType=ADS_REMOTE_SERVER;Initial Catalog=mandant.add;Persist Security
Info = False;" + ;
"SecurityMode=ADS_IGNORERIGHTS;Advantage Locking
Mode=ADS_COMPATIBLE_LOCKING"

TRY
loConn = CREATEOBJECT("ADODB.Connection")
loConn.Open(lcConnString)

loRS = CREATEOBJECT("ADODB.Recordset")
loRS.DataSource.CursorLocation = 3
loRS.DataSource.LockType = 3
loRS.ActiveConnection = loConn

loCA = CREATEOBJECT("CursorAdapter")
loCA.DataSourceType = "ADO"
loCA.DataSource = loRS
loCA.MapBinary = .T.
loCA.MapVarchar = .T.

loCA.Alias = "adressen"
loCA.SelectCmd = "SELECT * FROM adressen"

IF !loCA.CursorFill()
LOCAL laError
DIMENSION laError[1]
AERROR(laError)
MESSAGEBOX(laError[2])

ELSE
LOCAL laFlds, lcStr, lnFldCount, i
DIMENSION laFlds[1]
lnFldCount = AFIELDS(laFlds)
lcStr = ""
FOR i = 1 TO lnFldCount
lcStr = lcStr + laFlds[m.i, 1] + ","
ENDFOR
loCA.UpdatableFieldList = lcStr
BROWSE

ENDIF

CATCH TO loException
MESSAGEBOX(loException.Message)

ENDTRY

Best regards,
Jürgen Meijerink


Mark Wilkins Posted on 2010-08-02 20:41:43.0Z
From: "Mark Wilkins" <mark.wilkins@nospamplease>
Newsgroups: advantage.foxpro
References: <4c52a0a6@solutions.advantagedatabase.com>
In-Reply-To: <4c52a0a6@solutions.advantagedatabase.com>
Subject: Re: VFP and CursorAdapter
Date: Mon, 2 Aug 2010 14:41:43 -0600
Lines: 1
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response
Content-Transfer-Encoding: 8bit
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
NNTP-Posting-Host: 10.24.40.128
Message-ID: <4c572cd7@solutions.advantagedatabase.com>
X-Trace: 2 Aug 2010 14:38:47 -0700, 10.24.40.128
Path: solutions.advantagedatabase.com!10.24.40.128
Xref: solutions.advantagedatabase.com Advantage.FoxPro:369
Article PK: 1109722

Hi,

It is not clear to me what the problem is (I ran your example code and could
not find any obvious problems). I am wondering if there is a problem with a
field type. The usage of the "TOP" clause would result in a static cursor
instead of a live cursor. It should have the same type, but maybe there
could be a difference if the base table type is a DBF. The underlying table
type of static cursors is ADT.

Would it be possible to post a copy of the table (without any records in
it)?

One suggestion (that shouldn't have any affect on fixing the problem) but
could help with performance would be to change the DataSource.CursorLocation
from 3 to 2 (from client-side to server-side cursor). With client-side
cursors, VFP will end up reading the entire result set from the server to
the client when the query is executed. With a server-side cursor, the data
is typically read on demand.

Mark Wilkins
Advantage R&D

"Jürgen Meijerink" <meijerink@mekodata.de> wrote in message
news:4c52a0a6@solutions.advantagedatabase.com...
> Hello,
>
> I make my first steps with ADS under VFP and have problems to get all
> records from a table. With "SELECT * FROM adressen" I get an empty cursor.
> "SELECT TOP 5000000 * FROM adressen" gives me all records. Why?
>
> Here is my sourcecode:
>
> LOCAL loCA AS CursorAdapter, ;
> loConn AS ADODB.Connection, ;
> loRS AS ADODB.Recordset, ;
> loException AS Exception, ;
> lcConnString AS String
>
> lcConnString = "Provider=Advantage.OLEDB.1;User ID=adssys;Data
> Source=\\192.168.10.241:6262\ADS_Daten\018\2010\mandant.add;" + ;
> "ServerType=ADS_REMOTE_SERVER;Initial Catalog=mandant.add;Persist Security
> Info = False;" + ;
> "SecurityMode=ADS_IGNORERIGHTS;Advantage Locking
> Mode=ADS_COMPATIBLE_LOCKING"
>
> TRY
> loConn = CREATEOBJECT("ADODB.Connection")
> loConn.Open(lcConnString)
>
> loRS = CREATEOBJECT("ADODB.Recordset")
> loRS.DataSource.CursorLocation = 3
> loRS.DataSource.LockType = 3
> loRS.ActiveConnection = loConn
>
> loCA = CREATEOBJECT("CursorAdapter")
> loCA.DataSourceType = "ADO"
> loCA.DataSource = loRS
> loCA.MapBinary = .T.
> loCA.MapVarchar = .T.
>
> loCA.Alias = "adressen"
> loCA.SelectCmd = "SELECT * FROM adressen"
>
> IF !loCA.CursorFill()
> LOCAL laError
> DIMENSION laError[1]
> AERROR(laError)
> MESSAGEBOX(laError[2])
>
> ELSE
> LOCAL laFlds, lcStr, lnFldCount, i
> DIMENSION laFlds[1]
> lnFldCount = AFIELDS(laFlds)
> lcStr = ""
> FOR i = 1 TO lnFldCount
> lcStr = lcStr + laFlds[m.i, 1] + ","
> ENDFOR
> loCA.UpdatableFieldList = lcStr
> BROWSE
>
> ENDIF
>
> CATCH TO loException
> MESSAGEBOX(loException.Message)
>
> ENDTRY
>
> Best regards,
> Jürgen Meijerink
>


Jürgen Meijerink Posted on 2010-08-05 09:46:04.0Z
From: "Jürgen Meijerink" <meijerink@mekodata.de>
Newsgroups: advantage.foxpro
References: <4c52a0a6@solutions.advantagedatabase.com> <4c572cd7@solutions.advantagedatabase.com>
Subject: Re: VFP and CursorAdapter
Date: Thu, 5 Aug 2010 11:46:04 +0200
Lines: 104
Organization: mekoDATA GbR
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 91.190.230.220
Message-ID: <4c5a87ac@solutions.advantagedatabase.com>
X-Trace: 5 Aug 2010 03:43:08 -0700, 91.190.230.220
Path: solutions.advantagedatabase.com!91.190.230.220
Xref: solutions.advantagedatabase.com Advantage.FoxPro:370
Article PK: 1109725

Hi,

with DataSource.CursorLocation=2 everything works fine. Thanks for your
help!

Jürgen Meijerink
mekoDATA GbR

"Mark Wilkins" <mark.wilkins@nospamplease> schrieb im Newsbeitrag
news:4c572cd7@solutions.advantagedatabase.com...

> Hi,
>
> It is not clear to me what the problem is (I ran your example code and
> could not find any obvious problems). I am wondering if there is a
> problem with a field type. The usage of the "TOP" clause would result in
> a static cursor instead of a live cursor. It should have the same type,
> but maybe there could be a difference if the base table type is a DBF.
> The underlying table type of static cursors is ADT.
>
> Would it be possible to post a copy of the table (without any records in
> it)?
>
> One suggestion (that shouldn't have any affect on fixing the problem) but
> could help with performance would be to change the
> DataSource.CursorLocation from 3 to 2 (from client-side to server-side
> cursor). With client-side cursors, VFP will end up reading the entire
> result set from the server to the client when the query is executed. With
> a server-side cursor, the data is typically read on demand.
>
> Mark Wilkins
> Advantage R&D
>
>
>
> "Jürgen Meijerink" <meijerink@mekodata.de> wrote in message
> news:4c52a0a6@solutions.advantagedatabase.com...
>> Hello,
>>
>> I make my first steps with ADS under VFP and have problems to get all
>> records from a table. With "SELECT * FROM adressen" I get an empty
>> cursor. "SELECT TOP 5000000 * FROM adressen" gives me all records. Why?
>>
>> Here is my sourcecode:
>>
>> LOCAL loCA AS CursorAdapter, ;
>> loConn AS ADODB.Connection, ;
>> loRS AS ADODB.Recordset, ;
>> loException AS Exception, ;
>> lcConnString AS String
>>
>> lcConnString = "Provider=Advantage.OLEDB.1;User ID=adssys;Data
>> Source=\\192.168.10.241:6262\ADS_Daten\018\2010\mandant.add;" + ;
>> "ServerType=ADS_REMOTE_SERVER;Initial Catalog=mandant.add;Persist
>> Security Info = False;" + ;
>> "SecurityMode=ADS_IGNORERIGHTS;Advantage Locking
>> Mode=ADS_COMPATIBLE_LOCKING"
>>
>> TRY
>> loConn = CREATEOBJECT("ADODB.Connection")
>> loConn.Open(lcConnString)
>>
>> loRS = CREATEOBJECT("ADODB.Recordset")
>> loRS.DataSource.CursorLocation = 3
>> loRS.DataSource.LockType = 3
>> loRS.ActiveConnection = loConn
>>
>> loCA = CREATEOBJECT("CursorAdapter")
>> loCA.DataSourceType = "ADO"
>> loCA.DataSource = loRS
>> loCA.MapBinary = .T.
>> loCA.MapVarchar = .T.
>>
>> loCA.Alias = "adressen"
>> loCA.SelectCmd = "SELECT * FROM adressen"
>>
>> IF !loCA.CursorFill()
>> LOCAL laError
>> DIMENSION laError[1]
>> AERROR(laError)
>> MESSAGEBOX(laError[2])
>>
>> ELSE
>> LOCAL laFlds, lcStr, lnFldCount, i
>> DIMENSION laFlds[1]
>> lnFldCount = AFIELDS(laFlds)
>> lcStr = ""
>> FOR i = 1 TO lnFldCount
>> lcStr = lcStr + laFlds[m.i, 1] + ","
>> ENDFOR
>> loCA.UpdatableFieldList = lcStr
>> BROWSE
>>
>> ENDIF
>>
>> CATCH TO loException
>> MESSAGEBOX(loException.Message)
>>
>> ENDTRY
>>
>> Best regards,
>> Jürgen Meijerink
>>