WRAP
The WRAP function transforms a readable DDL statement into an obfuscated DDL statement.
In an obfuscated DDL statement, the procedural logic and embedded SQL statements are scrambled in such a way that any intellectual property in the logic cannot be easily extracted.
The schema is SYSIBMADM.
- object-definition-string
- A string of type CLOB containing a DDL statement. It can be one
of the following SQL statements:
- CREATE FUNCTION (SQL scalar)
- CREATE FUNCTION (SQL table)
- CREATE PROCEDURE (SQL)
- ppp identifies the product using the following 3 characters:
- QSQ for DB2® for i
- SQL for DB2 Database for Linux, UNIX, and Windows
- vv is a two-digit version identifier, such as '09'
- rr is a two-digit release identifier, such as '07'
- m is a one-character modification level identifier, such as '0'
This application server information is followed by a string of letters (a-z and A-Z), digits (0-9), underscores, and colons.
The encoded DDL statement may be up to one-third longer than the plain text form of the statement. If the result exceeds the maximum length for SQL statements, an error is issued (SQLSTATE 54001).
Note
The encoding of the statement is meant to obfuscate the content and should not be considered as a form of strong encryption.Example
Produce an obfuscated version of a function that computes a yearly salary from an hourly wage given a 40 hour work week.
VALUES WRAP('CREATE FUNCTION salary(wage DECFLOAT) RETURNS DECFLOAT
RETURN wage * 40 * 52')
The result of this statement would be something of the form:
CREATE FUNCTION salary(wage DECFLOAT) WRAPPED QSQ07010 <encoded-suffix>