Difference between revisions of "SQL Overview"

From Recital Documentation Wiki
Jump to: navigation, search
(Embedded Recital SQL)
 
(One intermediate revision by one user not shown)
Line 5: Line 5:
  
 
==Recital Terminal Developer Interactive Mode==
 
==Recital Terminal Developer Interactive Mode==
Recital SQL statements may be typed interactively at the command prompt.  The command [[SET SQL|SET SQL ON]] must first be issued.  This changes the command prompt to the following: 'Recital/SQL>'.
+
Recital SQL statements may be typed interactively at the command prompt.  The command [[SET SQL|SET SQL ON]] is no longer required.
  
 
When in interactive SQL mode, Recital SQL and Recital/4GL commands can be intermixed.  The following Recital SQL commands take precedence over their Recital/4GL equivalents:
 
When in interactive SQL mode, Recital SQL and Recital/4GL commands can be intermixed.  The following Recital SQL commands take precedence over their Recital/4GL equivalents:
Line 14: Line 14:
 
* [[SQL UPDATE|UPDATE]]
 
* [[SQL UPDATE|UPDATE]]
  
In interactive SQL mode, Recital SQL statements must be terminated with a semi-colon (;).  Pressing [RETURN] without terminating the statement with a semi-colon continues the statement onto the next line. NOTE: If [[SET SQL|SQL] is set to VFP, the semi-colon is not required.
+
No statement terminator is required.  The semi-colon (''';''') is used to continue the statement on the next line.
 
+
The default Recital/SQL> prompt may be changed with the [[SET SQLPROMPT|SET SQLPROMPT TO <expC>]] command.
+
 
+
  
 
==Embedded Recital SQL==
 
==Embedded Recital SQL==
SQL statements may be embedded in Recital/4GL programs.  If [[SET SQL|SQL]] is set to the default RECITAL, SQL statements must be preceded by the [[EXEC SQL]] command and terminated with a semi-colon (;).
+
SQL statements may be embedded in Recital/4GL programs.  The [[EXEC SQL]] command is no longer required.  No terminator is required.  The semi-colon (''';''') operates as the line-continuation character as in the Recital/4GL.
  
 
<code lang="recital">
 
<code lang="recital">
 
// Embedded Recital SQL statement in program
 
// Embedded Recital SQL statement in program
exec sql
+
select * from accounts;
select * from accounts
+
where account_no = "00010"
where account_no = "00010";
+
 
dialog box [end of select]
 
dialog box [end of select]
 
</code>
 
</code>
 
All lines that follow the EXEC SQL line up to the terminating semi-colon are treated as a single SQL statement.  [[SET SQL|SET SQL ON]] may be used as an alternative to EXEC SQL.
 
 
  
 
==.sql Programs==
 
==.sql Programs==

Latest revision as of 16:07, 5 July 2011

Recital SQL is SQL ANSI 92 compliant and compatible with both Microsoft® Visual FoxPro® and MySQL™ SQL. Where Recital, MySQL and Visual FoxPro differ in their SQL syntax, the SET SQL TO <dialect> command can be used to select the syntax to be used.

Recital SQL commands may be used interactively at the command prompt in Recital Terminal Developer products, embedded within Recital/4GL programs, issued from '.sql' programs or sent from SQL clients for direct execution by the Recital Database Server.


Recital Terminal Developer Interactive Mode

Recital SQL statements may be typed interactively at the command prompt. The command SET SQL ON is no longer required.

When in interactive SQL mode, Recital SQL and Recital/4GL commands can be intermixed. The following Recital SQL commands take precedence over their Recital/4GL equivalents:

No statement terminator is required. The semi-colon (;) is used to continue the statement on the next line.

Embedded Recital SQL

SQL statements may be embedded in Recital/4GL programs. The EXEC SQL command is no longer required. No terminator is required. The semi-colon (;) operates as the line-continuation character as in the Recital/4GL.

// Embedded Recital SQL statement in program
select * from accounts;
where account_no = "00010"
dialog box [end of select]

.sql Programs

Programs consisting entirely of SQL statements may be given a '.sql' file extension to differentiate them from standard Recital/4GL programs (.prg files). When a '.sql' file is run, SQL is automatically set ON and SQL is set to MYSQL. Compiled '.sql' files are given a '.sqo' file extension.


Database Server execution

Database Server SQL clients such as the Recital Universal JDBC Driver and the Recital Universal ODBC Driver, send individual SQL commands for execution and process the results.

rs = stmt.executeQuery("SELECT * from jdbctest");