Function OdbcListSqlKeywords() Professional
Retrieves SQL keywords of the current data source.
OdbcListSqlKeywords([<oSession>]) --> aKeywords
The function returns an array containing SQL keywords used by the current ODBC data source.
SQL (Structured Query Language) has - like any other programming language - so called keywords (in Xbase++ more strictly referred to as reserved keywords) which are used to construct a query statement, but also to manage the database. These keywords might not be used to name items of the database, like table or field names inside of a CREATE - statement.
Since not all data sources are conform to the same SQL standard and every vendor adds specific data types or other commands to the set of keywords it should be retrieved dynamically by using this function.
// DbCreate()
PROCEDURE Test
// This is translated by the ODBCDBE into
// CREATE TABLE View (TIMESTAMP TIMESTAMP)
// Since "View" and "TIMESTAMP" are considered as keywords, this
// DbCreate() call will fail.
DbCreate( "View", {"TIMESTAMP", "D", 0, 0} )
RETURN
// This is translated by the ODBCDBE into
// CREATE TABLE View_ (TIMESTAMP_ TIMESTAMP)
PROCEDURE CreateTable(cName, aStruct)
LOCAL aKw
aKw := OdbcListSqlKeywords(DacSession():getDefault())
AEval( aStruct, {|e,i| IF(AScan(aKw, aStruct[i][1]) > 0, aStruct[i][1]] += "_")} )
IF AScan( aKw, cName) > 0
cName += "_"
ENDIF
DbCreate( cName, aStruct )
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.