Using the Select into for ADS

Xbase++ 2.0 Build 554 or later
Post Reply
Message
Author
omni
Posts: 531
Joined: Thu Jan 28, 2010 9:34 am

Using the Select into for ADS

#1 Post by omni »

Roger,

Ran across an issue with this and not sure what the best alternative is, or if you have another suggestion.

In some cases, especially on those requests with a date range, there may be no records selected. This routine is used in hundreds of programs, so thinking about maybe one solution without updating and testing each one individually. The no records will be rare, but do not want to have a chance of any errors.

For example:
for ADS:
Select into zz013999 from oppro where opconscode=123456 and flag="T' order by oppronum
For Alaska
use oppro
sort on oppronum to zz013999 for opconscode=123456 .and. flag="T"

Later in the code the file zz013999 is opened. If no records exist the user receives a message to that effect.

When using the ADS no file is created.

I think the best method is to use my ADS function call that creates the file and check to see if that file exists before going back to the calling program, and if not, create an empty file from OPPRO (in this example) . Any thoughts, or what command is best in ADS to do that?
(I hope this makes sense)

Thanks,

Fred

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Using the Select into for ADS

#2 Post by rdonnay »

If you need to create and empty file, I can think of 2 ways.

dbCreate()

COPY STRUCTURE
The eXpress train is coming - and it has more cars.

omni
Posts: 531
Joined: Thu Jan 28, 2010 9:34 am

Re: Using the Select into for ADS

#3 Post by omni »

Thanks. I was trying to do it using sql. Guess my mind was on my web php page at the moment. A senior moment.

But I did run across what was really happening, ignore my original question.

I remember one of our original issues was that the sql command that created the file left the file open in another thread and we could not close it..and it caused some open file errors in many cases. You fixed that. It appears that the file is still open in another thread, but then closed right away. Is that right?

We are getting a file open error when attempting to open the file exclusive on our users network. When we were testing and added an alert to check some things after the file was created, the file open error did not occur. The problem appears to be in waiting for the other thread to close the file. The file, empty or not empty, is always there.

Is there a way to not open the file at all, or do we just need to change the way we open the file (with retries and delays) when opening exclusive. This did not occur on my local drive when testing, but it would have been much faster than a users network.

Fred

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Using the Select into for ADS

#4 Post by rdonnay »

I don't remember your code.

I can't answer your question.
The eXpress train is coming - and it has more cars.

omni
Posts: 531
Joined: Thu Jan 28, 2010 9:34 am

Re: Using the Select into for ADS

#5 Post by omni »

This is from the other topic where you fixed it....

Here is a new _DCADS.PRG file.

I added 2 lines of code to be sure to close both the cursor handle and the statement handle.

Copy it to \exp20\source\dclipx.

Run BUILD20.BAT or BUILD19_SL1.BAT to rebuild DCLIPX.DLL.

Anyway, I tested it with another method of opening to retry 10 times if not successful, and it appears to work for the open exclusive on these work files. Takes 2 to 3 tried most of the time. User will not know we are doing the retries as its automatic.


Fred

Post Reply