Administrator

Configuring Query Constant Files for Agentry Applications

Query constant files are configuration files containing constant values that may be referenced by any SQL script run by SAP Mobile Platform Server. Each SQL database system connection can have its own query constant file.

By default, there are two such files installed in the SAP Mobile Platform installation directory (SMP_HOME\Server\Configuration\com.sap.mobile.platform.server.agentry\):
  • Oracle_sd.ini – used by a system connection to an Oracle database systems
  • SqlServer_sd.ini – used by a system connection to an SQL Server database systems

The values in these scripts are intended to make SQL commands more portable when executed, either from definitions within the application, or from the query initialization file (SqlBe.ini). You can use the values in these files to write a single SQL statement that executes properly throughout the applicable database system.

SDML data tags make the values within these files accessible to SQL statements that are run by the server. Like all other configuration files for the server, the query constant files can contain multiple sections. By default, each contains the single section [Database], which includes these values:
  • name – do not change this value, which represents the database type.
  • getSystemTime – the database function that is called to return the current date and time.
  • timeStampFormat – do not change this value, except in exceptional circumstances. The value represents the format of a date and time value that is inserted into a table column for a date and time data type. This is also the format used by the SDML processor within SAP Mobile Platform Server when a date and time SDML data tag is expanded.
  • dateFormat – do not change this value, except in exceptional circumstances. The value represents the format of a date value that is inserted into a table column of a date or date and time data type. This is also the format used by the SDML processor within SAP Mobile Platform Server when a date data tag is expanded.
  • timeFormat – do not change this value, except in exceptional circumstances. The value represents the format of a time value such that is inserted into a table column of a time or date and time data type. This is also the format used by the SDML processor within SAP Mobile Platform Server when a time data tag is expanded.
  • tempdate – a temporary date value of 1/1/1901 12:00:00, which represents the proper format for the database type to use as a date and time value. The default value is assumed to be unlikely for real data; if it is a valid date and time for the system, change it to reflect an invalid date and time.
  • substring – the database function that is called to return a range of characters from within a larger string.
  • stringcat – the database function or operator that concatenates two string values.
  • charFunction – the database function that converts a value to a character data type.
  • nullFunction – the database function that determines whether a value is null.
  • singleRow – Oracle databases require every SELECT statement to include a FROM clause. When you select literal values, for example, SELECT ‘X’..., the table object DUAL is used. The singleRow value in the Oracle constant file contains the text "FROM DUAL." In the SQL Server script, this value contains an empty string.
  • unicodePrefix – the value that is prefixed to a Unicode value, that identifies it as such to the database.
  • terminalErrorCodes – a semicolon-delimited list of return values that are treated as terminal error codes by SAP Mobile Platform Server. When such an error is returned, the server ends the synchronization with the client, and returns an error message.
  • retryWithChangeErrorCodes – a semicolon-delimited list of return values that may be received from the database system as the result of processing a SQL statement. The values listed here are treated as a retry-with-change error for the purposes of transaction failure handling. If this functionality is not enabled, this setting has no affect on server behavior.
  • retryWithoutChangeErrorCodes – a semicolon-delimited list of return values that may be received from the database system as the result of processing a SQL statement. The values listed here are treated as a retry-without-change error for the purposes of transaction failure handling. If this functionality is not enabled, this setting has no affect on server behavior.
  • fatalWithMessageErrorCodes – a semicolon-delimited list of return values that may be received from the database system as the result of processing a SQL statement. The values listed here are treated as a fatal-with-message error for the purposes of transaction failure handling. If this functionality is not enabled, this setting has no affect on server behavior.
  • fatalWithoutMessageErrorCodes – a semicolon-delimited list of return values that may be received from the database system as the result of processing a SQL statement. The values listed here are treated as a fatal-without-message error for the purposes of transaction failure handling. If this functionality is not enabled, this setting has no affect on server behavior.

Additional Query Constant File Sections

You can add other sections to the query constants files, which includes values or functionality for application-specific purposes. The contents of this file are usually modified by, or at the direction of, the application developer, as the values are referenced as a part of the application’s business logic. Before making any changes, understand the effect that such changes will have, and how the configuration options are used. The default values provided with SAP Mobile Platform Server should only be changed in the rarest of situations, particularly those related to date and time formats.

Examples of application-specific changes:
  • The application extends a back-end system that may be deployed on different database systems, and certain values or functionality is different within those systems.
  • The application extends a back-end system that is deployed in multiple languages. As a result, certain constant values, such as Y and N flags, are different in different languages. You can represent such values as options in an application-specific section, to become the items referenced via SDML in the SQL statements. When the application is deployed to different languages, you can update the constant file with the proper language-specific value.
  • Additional functions may be needed beyond those in the standard version of the query constants file. It may be more straightforward to add a separate section that differentiates between the functions that are provided by default, and those that are added later.

Configuring the Query Constant Files for a System Connection

A single SQL database system connection might use multiple query constant files. You can also change the name of the file that is referenced for the connection.

If a different file name is to be used, or if multiple constant files are needed for a system connection, modify the queryConstantFiles configuration option, in the [SQL-n] section, of the Agentry.ini file. For multiple file listings, each file name is separated by a semicolon.
-- different file name
[SQL-1]
...
queryConstantFiles=MyConstantFile_sd.ini
...
--- multiple constant files
[SQL-1]
...
queryConstantFiles=Oracle_sd.ini;MyApplicationConstantFile_sd.ini

If you use a query constant file other than the default, the file you use must contain the [Database] section, including all configuration options.