Help with code
Help with code
(OP)
I have some SQL code that I need to put into a dBase IV code and dont know how.
Here is the SQl code:
SELECT jono, SUBSTRING(MRRN, 3,6) as MRRN, MRRN, COST
FROM Comled
WHERE(JONO NOT LIKE SUBSTRING(MRRN, 3,6) and jono <> 'YY1122' and Jono <> 'PPq211'
Here is the SQl code:
SELECT jono, SUBSTRING(MRRN, 3,6) as MRRN, MRRN, COST
FROM Comled
WHERE(JONO NOT LIKE SUBSTRING(MRRN, 3,6) and jono <> 'YY1122' and Jono <> 'PPq211'
RE: Help with code
Here is the SQL format for dBase of DOS 5.0, I'm not sure how much it changed from the prior version: (Note that only SELECT and FROM are required clauses.)
CODE
INTO ...
FROM ...
WHERE ...
GROUP BY ...
HAVING ...
UNION <one or more SELECT commands>
ORDER BY ... / FOR UPDAE OF ...
SAVE TO TEMP ...
CODE
FROM Comled
WHERE SUBSTR(MRRN, 3,6) <> jono .AND. jono <> 'YY1122' .AND. jono <> 'PPq211'
CODE
FROM Comled
WHERE jono_MRRN <> jono .AND. jono <> 'YY1122' .AND. jono <> 'PPq211'
RE: Help with code
RE: Help with code
SET SQL ON
to enable the SQL mode for executing a query like that. Then SET SQL OFF to turn of that mode. (At least that's what I'm remembering - it HAS been a long, long time.)
RE: Help with code
Is there any performance difference between these options?
RE: Help with code
My experience from years ago would tell me that code executed from a procedure file would not execute any faster than that in a main program (.prg) file, it was simply another way of handling frequently re-used code, user defined functions, error handling routines, etc. It didn't necessarily speed things up or slow things down. Testing would be the ultimate means obviously of determing whether there would be advantage to either approach.
RE: Help with code
I don't know anything about .prs files. I agree with 1oldfoxman that the SQL itself would run the same speed wherever it is. Speed depends on compilation and file access.
Compilation - I seem to recall, not sure, that dbIII+ did not pre-compile any code. Perhaps dbIV does? dB5 always creates .DBO pre-compilation files that can be optionally compiled into an EXE.
File access - By putting multiple procedures into a PROCEDURE file and then using SET PROCEDURE TO ... the code is pulled into memory and then the programs run faster because you don't wait while the various files are read from the disk drive. Building an EXEcutable file has similar speed benefits.