Subject Re: Command Window Commands
From Rouke <moc.liamg@rekkabrg>
Date Thu, 20 May 2021 17:21:49 -0400
Newsgroups dbase.getting-started

Great detailed explanation Mervyn. Wonderful. Thanks.

Rouke

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.
>
>
>
>