On 9/6/06, Stephen the Cook <[EMAIL PROTECTED]> wrote:
Paul Hill <> wrote:
> Hi Peeps,
>
> I'm connecting to a SQL Server using server side cursors.  If I do the
> following:
>
> SELECT * FROM big_table
>
> Followed by:
>
> RecordSet.FindFirst("keyfield = 123")

I was getting my DAO and ADO confused here, what I really wanted was
RecordSet.Seek("123").  This seems to actually work.

Sounds like you know that this process is wrong, yet you look for approval
because your "fixing" it.  Sorry but you really need to get the refactoring
hat on and map out the proper path for C/S because when you ask for all the
rows from a big_table your stuck.  :(

As it's a server side cursor not all the data is returned to the
client.  I know it's a hack, but I'm thinking about a 1st step.

ADO or ADO.NET it's just not built on
lots of rows in the object.  Never has, and only going to ADO.NET in VS2005
will it work much better even though it still WRONG.

The problem is I'm working on a fairly big project (600+ PRGs) and
we're not a large company.  It's actually the market that is demanding
SQL support.

The code is full of classic Fox code like this:

SELECT table
SET ORDER TO xx
SEEK "1"
SCAN WHILE status="1"
  ...
ENDSCAN

OK, that's a lie.  Actually it's more like this:

table->(ORDSETFOCUS( "xx" ))
table->(DBSEEK("1"))                                                //
status blocked
DO WHILE table->status == "1"
     table->(DBSKIP())
ENDDO

OK, it's not Fox, so sue me :-)  It's XBase++ (a Clipper compiler) but
I'm a fox programmer by trade which is why I hang out here.

My idea was to make 'table' an object and implement xbase stubs that
talk to SQL server.  That way it's just a search and replace job.

Obviously the best way would be something like this:

oResults = myExecuteSQL("Select * from table where status='1'")
DO WHILE !oResults.EOF()
  ...
  oResults()->MoveNext()
ENDDO

But this is a pretty trivial example.  In reality there are often
Seeks() within the loop.  The original programmer had an odd style
sometimes (but not necessarily bad).

It would be a hell of a lot of work to re-work it like this.

Use the Force.

Cheers Yoda!

--
Paul


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to