How to Add SQL Keywords - cDbUpdateFunctionLibrary

SQL Keywords can be added to the framework and can then be used with e.g the SqlUtilExecuteQuery message.


The framework uses an array of SQL keywords to construct SQL statements to be executed with e.g. the SqlUtilExecuteQuery message. This is how it works;


The helper function _SqlFindKeyWord can be used to find an SQL keyword for the current psDriverID and piDbType (SQL database type). It takes one argument that is a constant integer and returns the SQL keyword as a string. The constant integer must be one of the constants in the enum_list of the cDbUpdateFunctionsLibray.inc file. They all have a prefix of "CI_SQL". Example: CI_SQLAterTable.


The Procedure SetupSQLKeywordArray in the cDbUpdateFunctionLibrary_Mixin.pkg is used to add new keywords. In the SetupSQLKeywordArray message use the syntax: E.g. "Send Add_Element CI_SQLMyNewSQLKeyWord EN_dbTypeXXX "NEW SQL KEYWORD(s)". Note: When adding a new keyword it must be added for all the five supported SQL back-ends; MS-SQL, MySQL, Oracle, DB2 & PostgreSQL. The same constant integer will be used for all five added Add_Element, only the EN_dbTypeXXX will vary.


All of these keywords are automatically added to an array and sorted with a special sorting function when the framework is initialized. This makes it efficient when finding an SQL keyword for a particular SQL back-end with the _SqlFindKeyWord function. Of course this has been done because SQL back-ends uses different wordings for ESQL statement execution.