OJSyntax

Description

Specifies how PocketBuilder formats the SQL syntax for outer joins for the database back end you are accessing.

Applies to

Syntax

OJSyntax = value

Parameter

Description

value

Specifies how you want SQL syntax to be formatted. Values are:

  • ANSI_Escape Apply ANSI standards and enclose the outer joins in escape notation { oj ... } that is parsed by the driver and replaced with DBMS-specific grammar.

  • ANSI Apply ANSI standards.

  • PB Maintain rules that applied to PowerBuilder 7.

Default

OJSyntax = ANSI_ESCAPE

Usage

PocketBuilder provides support for ANSI SQL-92 outer join SQL syntax generation. It supports both left and right outer joins in graphics mode and full outer and inner joins in syntax mode.

You must set the OJSyntax DBParm to indicate the version of outer join SQL syntax you want PocketBuilder to generate. The default is ANSI_Escape, and the default can be reset to ANSI or PB (native).

OJSyntax is a dynamic DBParm in all database drivers that support it. It can therefore be changed at any time during the life of a database connection with a PowerScript statement such as:

SQLCA.DBParm="OJSyntax='ANSI_ESCAPE' "

Define outer joins in the SQL painter for portability When you define an outer join SELECT statement graphically in the SQL painter, the DataWindow object stores the SQL in pseudocode. At runtime, the outer join syntax is generated based on the current OJSyntax DBParm setting. This provides some degree of portability for DataWindow objects among multiple DMBSs.

When you define an outer join SELECT statement in syntax mode, the DataWindow object stores the SQL as syntax. This syntax is used without modification at runtime. The OJSyntax DBParm setting does not affect the SQL.

Using native outer join syntax The option PB generates native outer join syntax. It is available for ODBC only if PBOuterJoin and PBOuterJoinOperator syntax entries are set in the appropriate SYNTAX section for your DBMS in the Sybase\PocketBuilder 2.5\pkodb25.ini file.

When you migrate applications from PowerBuilder 7 and earlier versions of PowerBuilder, using ANSI outer join syntax might produce errors, depending on how the joins were defined in the painter. If a table is joined to multiple other tables with right outer joins, a valid ANSI outer join statement cannot be generated.

For more information about outer joins, see the section on using ANSI outer joins in the Users Guide.

Examples

Example 1

To set the value of OJSyntax: