* ============================================================================================== * SQLPrepare () * ============================================================================================== SendMessage ("Prepairing to fetch records from remote source. Please wait...") cStartTime = Time () gObjtSQLcommand = "Select * From " + IIf (Empty (cTable_Owner), "", cTable_Owner + ".") + cTable_Name SQLSetProp (gSQLHandle, "Asynchronous", .F.) SQLSetProp (gSQLHandle, "QueryTimeOut", 300) If SqlPrepare (gSQLHandle, gObjtSQLcommand, "CurSQLbrowse") <> 1 ClearMessage () aError (SqlErrorTab) MessageBox ("SQL error (" + lTrim (Str (SqlErrorTab [1])) + ") issuing Select * From, procedure BrowseTableSQL." + Chr (13) + Chr (13) + ; AllTrim ( SqlErrorTab [2]), (0+16+0), cCaption) Release SqlErrorTab EnableMenus () Return endif * ============================================================================================== * SQLExec () Loop * ============================================================================================== ClearMessage () nFetchSize = 300 nFetchedRecords = 0 CursorSetProp ("FetchSize", nFetchSize , 0 ) SQLSetProp (gSQLHandle, "Asynchronous", .T.) Set Cursor Off Set Status Bar On Set Message To " Prepairing to fetch records. Please wait..." Do While SQLExec (gSQLHandle) = 0 nFetchedRecords = nFetchedRecords + nFetchSize nPercDone = nFetchedRecords / nRecCount * 100 If gSQLEngine <> "P" && PostgreSQL Set Message To Space (1) + lTrim (Transform (nFetchedRecords, "999,999,999")) + " records already fetched (" + lTrim (Transform (nPercDone, "999")) + " %)" + " Press <Esc> to interrupt" If InKey (.001) = 27 If MessageBox ("Do you want to stop record fetching ?", (4+48+256), cCaption) = 7 Loop endif SQLSetProp (gSQLHandle, "Asynchronous", .F.) SqlCancel (gSQLHandle) Exit endif else Set Message To Space (1) + lTrim (Transform (nFetchedRecords, "999,999,999")) + " records already fetched (" + lTrim (Transform (nPercDone, "999")) + " %)" endif EndDo Clear TypeAhead SQLSetProp (gSQLHandle , "Asynchronous", .F.) CursorSetProp ("FetchSize", -1, 0 ) Set Cursor On Set Status Bar Off