Link to home
Start Free TrialLog in
Avatar of IainMacb
IainMacbFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Controlling the ''Executing remote" message when using SQLEXEC()

I've got a routine that imports data from a Paradox file using an ODBC connection via the SQLEXEC() function.

When this executes, I get a message in the top-right of the program window saying

        Executing remote... Pres ESC to cancel

Is there any way of controlling the placement of this message - can I display it in one of my own error messages for instance? Is there any way of suppressing it perhaps?
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of IainMacb

ASKER

Excellent - that does the business!
I've now got one of my own messages displaying what's happening.

Your comment says "Of course, the original message can display the data transfer progress which is impossible in this case". Do you mean that it is possible to get the default message to display a progress thermometer or a count of some sort?
It was a mistake. The record counter is displayed in FoxPro status bar when the data set is large or when the data transfer is slow.

If you define your own message window then you have to handle record counter and/or thermometer in your program which is complex, not reliable, and slows the whole process down.

We are using following progress window when copying data over the slow network:
        llDisplayProgress=RECCOUNT()>500
        IF llDisplayProgress
          DEFINE WINDOW wDataCopyProgress ;
            AT 1,1 SIZE 5,50 TITLE "Data Retrieval Progress"

          ACTIVATE WINDOW wDataCopyProgress
          SET TALK WINDOW wDataCopyProgress
          SET TALK ON
        ENDIF

        COPY TO (lcFilename)

        IF llDisplayProgress
          SET TALK OFF
          RELEASE WINDOWS wDataCopyProgress
          ACTIVATE SCREEN
        ENDIF

Open in new window

This does not work for SQLEXEC().
Alas.

Take your point about slowing things down, but I do like to give users some idea of what's going on.

What I've done is to use the status bar record counter. I need to tell the user about how many records are being imported. I've done that with a little function which uses low-level file functions to read the record count from the top of the Paradox file, as in

*      PARADOX_RECCOUNT() - Return number of records in a Paradox .DB file
*      VARIABLES
LPARAMETERS tfParadox
LOCAL lhParadox, lnRecords
*            tfPARADOX - Name of Paradox file

lhParadox = FOPEN(tfParadox)                                    &&      Open file
IF ( lhParadox < 0 )
      RETURN -1
      ENDIF

FSEEK(lhParadox,6,0)                                                &&      Bytes 6-9 contain record-count
lnRecords = CTOBIN( FREAD(lhParadox,4), "RS" )            &&      Convert binary string to numeric : "R" = little-endian, "S" = unsigned.
FCLOSE(lhParadox)                                                      &&      Close file

RETURN lnRecords

I've then displayed this in a window so that the user can see the (eventual) record-count.
Sorry - the code in the previous comment should be presented tidily as

*	PARADOX_RECCOUNT() - Return number of records in a Paradox .DB file

LPARAMETERS tfParadox
LOCAL lhParadox, lnRecords

*		tfPARADOX - Name of Paradox file

lhParadox = FOPEN(tfParadox)						&&	Open file
IF ( lhParadox < 0 )
	RETURN -1
	ENDIF

FSEEK(lhParadox,6,0)								&&	Bytes 6-9 contain record-count
lnRecords = CTOBIN( FREAD(lhParadox,4), "RS" )		&&	Convert binary string to numeric : "R" = little-endian, "S" = unsigned.
FCLOSE(lhParadox)									&&	Close file

RETURN lnRecords

Open in new window