SQL item properties

The SQL item properties specify characteristics that are meaningful when an item is used in a record of type SQLRecord. You do not need to specify any of the SQL item properties, however, as default values are available.

The properties are as follows:

column = columnName

The property column refers to the name of the database table column that is associated with the item. The default is the name of the item. The column and related item affect the default SQL statements, as described in SQL support.

For columnName, substitute a quoted string; a variable of a character type; or a concatenation, as in this example:

  column = "Column" + "01"

A special syntax applies if a column name is one of the following SQL reserved words:

As shown in the following example, each of those names must be embedded in a doubled pair of quote marks, and each of the internal quote marks must be preceded with an escape character (\):

  column = "\"SELECT\""

(A similar situation applies if you use of those reserved words as a table name.)

isNullable = yes, isNullable = no

The property isNullable indicates whether the item can be set to null, as is appropriate if the table column associated with the item can be set to NULL. Valid values are yes (the default) and no.

For a given item in an SQL record, the following features are available only if isNullable is set to yes:

  • Your program can accept a NULL value from the database into the item.

  • Your program can use a set statement to null the item, as described in set. The effect is also to initialize the item, as described in Data initialization.

  • Your program can use an if statement to test whether the item is set to null.

isReadOnly = no, isReadOnly = yes

The property isReadOnly indicates whether the item and related column should be omitted from the default SQL statements that write to the database or include a FOR UPDATE OF clause. The default value is no; but EGL treats the structure item as "read only" in these situations:

  • The property key of the SQL record indicates that the column that is associated with the structure item is a key column; or

  • The SQL record part is associated with more than one table; or

  • The SQL column name is an expression.

sqlDataCode = code

The value of property sqlDataCode is a number that identifies the SQL data type that is associated with the record item. The data code is used by the database management system when you access that system at declaration time, validation time, or generated-program run time.

The property sqlDataCode is available only if you have set up your environment for VisualAge Generator compatibility. For details, see Compatibility with VisualAge Generator.

The default value depends on the primitive type and length of the record item, as shown in the next table. For other details, see SQL data codes.

EGL primitive type Length SQL data code
BIN 4 501
9 497
CHAR <=254 453
>254 and <=4000 449
>4000 457
DBCHAR <=127 469
>127 and <=2000 465
>2000 473
DECIMAL any 485
HEX any 481
UNICODE <=127 469
>127 and <=2000 465
>2000 473

sqlVar = no, sqlVar = yes

The value of property sqlVar indicates whether trailing blanks and nulls in a character field are truncated before the EGL run time writes the data to an SQL database. This property has no effect on non-character data.

Specify yes if the corresponding SQL table column is a varchar or vargraphic SQL data type.

Related concepts
Compatibility with VisualAge Generator
Record types and properties
SQL support
Structure
Typedef

Related tasks
Retrieving SQL table data

Related reference
add
close
Data initialization
delete
execute
get
get next
open
prepare
Primitive types
Record and file type cross-reference
replace
set
SQL data codes and EGL host variables
sysVar.terminalID
VAGCompatibility