| Subject |
Re: Command Window Commands |
| From |
Gaetano D. <gaetanoddRemoveThis@andThatHotmail.com> |
| Date |
Fri, 21 May 2021 04:28:33 +1000 |
| Newsgroups |
dbase.getting-started |
On 20/05/2021 17:08, Mervyn Bick wrote:
> On 2021/05/20 07:25, Rouke wrote:
>> When I double click a program in the Navigator, a 'do' command shows
>> in the Command Window.
> .........
>> When I double click or select 'Run SQL' in the Navigator, there's no
>> command in the Command Window
>> What is the command to run an SQL from the Command Window?
>
> I'm afraid you can't run a .sql file created by the SQL designer from
> the Command Panel.
>
> The .sql files produced by the designer are meant to be assigned to
> the sql property of a query object. When you double-click on the
> icon, dBASE creates a form with a query object and a grid object which
> is used to display the result of the query. Quite a bit of work is
> done behind the scenes before you see the result.
>
> The way the contents of a .sql file created by the SQL designer is
> laid out makes it unsuitable to be run as a program.
>
> Firstly the dBASE DO command doesn't recognise the --Directory or
> --databasename in the first line so this causes an error. A query
> object does know how to deal with this line when it is in the code
> assigned to its sql property.
>
> Secondly, for the DO command to be able to execute an instruction the
> entire instruction must be on one line or the ; line continuation must
> be used to continue code on the next line. The code in a .sql file is
> a SELECT statement which is spread over many lines to improve
> readability. The designer does not, however, add ; line continuation
> markers at the end of each line. A query object does have the ability
> to use the code without line continuation markers. So, even if the
> first --Directory line is removed the DO command can't handle the code.
>
> If you remove the first -- line and add ; line continuation characters
> you could DO whatever.sql from the Command Panel but all this does is
> open the rowset in an XDLM workarea. You would still need to BROWSE
> to see the data and then USE to delete the rowset. And once you've
> made these changes the SQL designer won't be happy with the file.
>
> Mervyn.
>
>
>
>
Mervyn,
Sorry, I didn't make it clear that the inputFile was generated by the
SQL designer but it was. SQLexec() does take that file as an input, I
cannot say if that applies to all types of statements, but this one
worked fine, it generated the output file:
sqlexec('inputFile.sql','outputFile.dbf')
content of inputFile.sql:
--Database:DBASESAMPLES
Select sample.*
From sample
--
Gaetano.
|
|