Class Resources

Contents

Database Classes

The fSQLTranslation class is an internal class used by fDatabase for translating Flourish SQL into the dialect of SQL supported by the current database. To take advantage of the features of this class, be sure to call translatedQuery() instead of query().

For more information about translatedQuery() and query(), please see the Queries section of the fDatabase page.

Debugging

When debugging is enabled, the class will print the original and translated queries, allowing developers to track down translation issues.

$sql_translation->enableDebugging(TRUE);

Caching

Part of the functionality that fSQLTranslation provides is to provide a way to get national character data (NCHAR, NVARCHAR and NTEXT columns) out of Microsoft SQL Server. Most of the MSSQL extensions for PHP do not properly retrieve national character data since it is encoded in UCS-2, which contains NULL bytes. fSQLTranslation translates the SQL query to request data from such columns as binary data, which allows NULL bytes, and then changes the encoding to UTF-8 before being returned to the developer.

Part of this process is to retrieve a list of all national character columns. The enableCaching() method accepts an instance of the fCache class, and will save the appropriate database schema information so it does not need to be fetched on each page load.