f2s_table_letter_casing¶
Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers
Syntax¶
set_attribute f2s_table_letter_casing of {FileNumber} to {FILE_CASING_KEEP|FILE_CASING_LOWER|FILE_CASING_UPPER}
get_attribute f2s_table_letter_casing of {FileNumber} to {variable}
Parameter |
Description |
---|---|
FileNumber |
Number of the file (filename.File_Number) |
variable |
An integer value which will be FILE_CASING_KEEP (keep the original casing), FILE_CASING_LOWER (force to lowercase) or FILE_CASING_UPPER (force to uppercase) |
Description¶
This attribute controls the filename and column name casing of the table. Getting the attribute can be done anywhere in the code, however, setting the attribute must be done within a Structure_Start/Structure_End block. The attribute can only be set once within the Structure_Start/Structure_End block. If it is set multiple times, only the last one will implemented.
Example¶
In this example, 3 columns are added to the customer table, LowerCol, UpperCol and NoChangeCol. When looking at the column names after their creation, LowerCol becomes lowercol, UpperCol becomes UPPERCOL and NoChangeCol remains NoChangeCol. Notice that the table customer must be closed and then reopened after each column addition.
This example opens customer_MSSQL.int as the table customer.
This example assumes that the server has been logged into and that the database has been set.
Handle hFile
Integer iColumn iCasing
Open "customer_MSSQL.int" as customer
Move CUSTOMER.File_Number to hFile
Structure_Start hFile _f2s_ActiveDriver
Set_Attribute f2s_table_letter_casing of hFile to FILE_CASING_LOWER
Get_Attribute f2s_table_letter_casing of hFile to iCasing
Showln (sFormat("Lower casing is %1", iCasing))
Move 0 to iColumn
Create_Field hFile At iColumn
Set_Attribute DF_FIELD_NAME of hFile iColumn to "LowerCol"
Set_Attribute DF_FIELD_TYPE of hFile iColumn to DF_BCD
Set_Attribute DF_FIELD_LENGTH of hFile iColumn to 1
Structure_End hFile DF_STRUCTEND_OPT_NONE "." 0
Close CUSTOMER
Open "customer_MSSQL.int" as customer
Move CUSTOMER.File_Number to hFile
Structure_Start hFile _f2s_ActiveDriver
Set_Attribute f2s_table_letter_casing of hFile to FILE_CASING_UPPER
Get_Attribute f2s_table_letter_casing of hFile to iCasing
Showln (sFormat("Upper casing is %1", iCasing))
Move 0 to iColumn
Create_Field hFile at iColumn
Set_Attribute DF_FIELD_NAME of hFile iColumn to "UpperCol"
Set_Attribute DF_FIELD_TYPE of hFile iColumn to DF_BCD
Set_Attribute DF_FIELD_LENGTH of hFile iColumn to 1
Structure_End hFile DF_STRUCTEND_OPT_NONE "." 0
Close CUSTOMER
Open "customer_MSSQL.int" as customer
Move CUSTOMER.File_Number to hFile
Structure_Start hFile _f2s_ActiveDriver
Set_Attribute f2s_table_letter_casing of hFile to FILE_CASING_KEEP
Get_Attribute f2s_table_letter_casing of hFile to iCasing
Showln (sFormat("Keep casing is %1", iCasing))
Move 0 to iColumn
Create_Field hFile at iColumn
Set_Attribute DF_FIELD_NAME of hFile iColumn to "NoChangeCol"
Set_Attribute DF_FIELD_TYPE of hFile iColumn to DF_BCD
Set_Attribute DF_FIELD_LENGTH of hFile iColumn to 1
Structure_End hFile DF_STRUCTEND_OPT_NONE "." 0
Close CUSTOMER