Difference between revisions of "SET SQL"

From Lianjapedia
Jump to: navigation, search
 
m (Text replace - "Recital" to "Lianja")
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
''No longer required in Recital 10''
 
 
 
==Purpose==
 
==Purpose==
Enable or disable use of SQL statements
+
Configure SQL statement syntax
 
+
  
 
==Syntax==
 
==Syntax==
SET SQL ON | OFF | (<expL>)
+
SET SQL[DIALECT] TO RECITAL | VFP | MYSQL
 
+
SET SQL TO RECITAL | VFP | MYSQL
+
 
+
  
 
==See Also==
 
==See Also==
[[SET PAUSE]], [[SET SQLDIALECT]], [[:Category:SQL|SQL]]
+
[[:Category:SQL|SQL]]
 
+
  
 
==Description==
 
==Description==
When SQL is set ON, commands that follow are assumed to be SQL, not Recital/4GL.  In the development environment of Recital Terminal Developer, the interactive SQL prompt will be displayed and valid Recital/ SQL commands can be executed.  Most of the Recital non-SQL commands can also be executed, but commands that conflict with SQL are not permitted.  When SQL is set OFF, the normal Recital prompt is displayed.  By default, SQL is OFF.
+
Where Lianja, MySQL and VFP differ in their SQL syntax, the SET SQLDIALECT command can be used to select the syntax to be used.
  
The SET SQL ON command can also be used in config.db configuration files for session, application or system wide setting.  Since it affects the compilation of programs, it should be set prior to compilation rather than in a program itself.  Program files with a .sql’ file extension are automatically compiled and run with SET SQL ON.  When SQLDIALECT is set to Recital, embedded SQL commands within programs must be preceded by the EXEC SQL command unless SET SQL is ON.
+
By default, SET SQLDIALECT is set to RECITAL.  Since the SET SQLDIALECT setting affects program compilation, it should be set prior to compilation rather than in a program itself, for example in a config.db configuration file.
  
The SET SQL TO <dialect> command is synonymous with the SET SQLDIALECT TO <dialect> command.
+
====;====
 +
The semi-colon, ’;’, is used to terminate SQL statements when SQLDIALECT is set to MYSQL.  It is used as a line continuation character when SQLDIALECT is set to VFP or RECITAL.
  
 +
====.sql programs====
 +
When a program with a ’.sql’ file extension is run, SQLDIALECT is automatically set to MYSQL and SET SQL is set ON.
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
> set sql on
+
set sqldialect to vfp
Recital/SQL> select * from accounts;
+
 
 +
set sql to mysql
 
</code>
 
</code>
  
 
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 
[[Category:Set_Commands|SQL]]
 
[[Category:Set_Commands|SQL]]
 
[[Category:SQL]]
 
[[Category:SQL]]
[[Category:SQL Set Commands]]
 
[[Category:Terminal Environment]]
 
[[Category:Terminal Environment Set Commands]]
 

Latest revision as of 00:57, 9 December 2012

Purpose

Configure SQL statement syntax

Syntax

SET SQL[DIALECT] TO RECITAL | VFP | MYSQL

See Also

SQL

Description

Where Lianja, MySQL and VFP differ in their SQL syntax, the SET SQLDIALECT command can be used to select the syntax to be used.

By default, SET SQLDIALECT is set to RECITAL. Since the SET SQLDIALECT setting affects program compilation, it should be set prior to compilation rather than in a program itself, for example in a config.db configuration file.

;

The semi-colon, ’;’, is used to terminate SQL statements when SQLDIALECT is set to MYSQL. It is used as a line continuation character when SQLDIALECT is set to VFP or RECITAL.

.sql programs

When a program with a ’.sql’ file extension is run, SQLDIALECT is automatically set to MYSQL and SET SQL is set ON.

Example

set sqldialect to vfp
 
set sql to mysql