
Takes a subset of SQL from IBM DB2, MySQL, PostgreSQL, Oracle, SQLite and MSSQL and translates into the various dialects allowing for cross-database code
1.0.0b20 | Added fix for PostgreSQL to handle INSERT statements that don't specify any columns or values 9/6/11 |
---|---|
1.0.0b19 | Removed the stray method removeSQLiteIndexes() that was left over from moving code into fSQLSchemaTranslation 5/17/11 |
1.0.0b18 | Fixed LENGTH() and SUBSTR() functions for non-ascii characters being stored in MySQL, SQLite and DB2, moved CREATE TABLE support to fSQLSchemaTranslation 5/9/11 |
1.0.0b17 | Internal Backwards Compatiblity Break - changed the array keys for translated queries returned from translate() to include a number plus : before the original SQL, preventing duplicate keys 7/14/10 |
1.0.0b16 | Added IBM DB2 support 4/13/10 |
1.0.0b15 | Fixed a bug with MSSQL national character conversion when running a SQL statement with a sub-select containing joins 12/18/09 |
1.0.0b14 | Changed PostgreSQL to cast columns in LOWER() calls to VARCHAR to allow UUID columns (which are treated as a VARCHAR by fSchema) to work with default primary key ordering in fRecordSet 12/16/09 |
1.0.0b13 | Added a parameter to enableCaching() to provide a key token that will allow cached values to be shared between multiple databases with the same schema 10/28/09 |
1.0.0b12 | Backwards Compatibility Break - Removed date translation functionality, changed the signature of translate(), updated to support quoted identifiers, added support for PostgreSQL, MSSQL and Oracle schemas 10/22/09 |
1.0.0b11 | Fixed a bug with translating MSSQL national columns over an ODBC connection 9/18/09 |
1.0.0b10 | Changed last bug fix to support PHP 5.1.6 9/18/09 |
1.0.0b9 | Fixed another bug with parsing table aliases for MSSQL national columns 9/18/09 |
1.0.0b8 | Fixed a bug with parsing table aliases that occurs when handling MSSQL national columns 9/9/09 |
1.0.0b7 | Fixed a bug with translating NOT LIKE operators in PostgreSQL 7/15/09 |
1.0.0b6 | Changed replacement values in preg_replace() calls to be properly escaped 6/11/09 |
1.0.0b5 | Update code to only translate data types inside of CREATE TABLE queries 5/22/09 |
1.0.0b4 | Added the missing __get() method for callback support 5/6/09 |
1.0.0b3 | Added Oracle and caching support, various bug fixes 5/4/09 |
1.0.0b2 | Fixed a notice with SQLite foreign key constraints having no ON clauses 2/21/09 |
1.0.0b | The initial implementation 9/25/07 |
Composes text using fText if loaded
string compose( string $message, mixed $component [, ... ] )
string | $message | The message to compose |
mixed | $component [, ... ] | A string or number to insert into the message |
The composed and possible translated message
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Callback for custom SQLite function; calculates the cotangent of a number
numeric sqliteCotangent( numeric $x )
numeric | $x | The number to calculate the cotangent of |
The contangent of $x
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Callback for custom SQLite function; returns the current date
string sqliteDate( )
The current date
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Callback for custom SQLite length function; returns the number of UTF-8 characters in a string
string sqliteLength( string $string )
string | $string | The string to measure |
The current date
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Callback for custom SQLite function; calculates the log to a specific base of a number
numeric sqliteLogBaseFirst( integer $base, numeric $num )
integer | $base | The base for the log calculation |
numeric | $num | The number to calculate the logarithm of |
The logarithm of $num to $base
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Callback for custom SQLite function; returns the sign of the number
numeric sqliteSign( numeric $x )
numeric | $x | The number to change the sign of |
-1 if a negative sign, 0 if zero, 1 if positive sign
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Callback for custom SQLite function; creates a substring
string sqliteSubstr( string $string, integer $start, integer $length )
string | $string | The string to take a substring of |
integer | $start | The one-based position to start the substring at |
integer | $length | The length of the substring to take |
The substring
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Callback for custom SQLite function; returns the current time
string sqliteTime( )
The current time
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Callback for custom SQLite function; returns the current timestamp
string sqliteTimestamp( )
The current date
Sets up the class and creates functions for SQLite databases
fSQLTranslation __construct( fDatabase $database )
fDatabase | $database | The database being translated for |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
All requests that hit this method should be requests for callbacks
callback __get( string $method )
string | $method | The method to create a callback for |
The callback for the method requested
Clears all of the schema info out of the object and, if set, the fCache object
void clearCache( )
Sets the schema info to be cached to the fCache object specified
void enableCaching( fCache $cache, $key_token=NULL )
fCache | $cache | The cache to cache to |
$key_token |
Sets if debug messages should be shown
void enableDebugging( boolean $flag )
boolean | $flag | If debugging messages should be shown |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Translates Flourish SQL into the dialect for the current database
array translate( array $statements, array &$rollback_statements=NULL )
array | $statements | The SQL statements to translate |
array | &$rollback_statements | SQL statements to rollback the returned SQL statements if something goes wrong - only applicable for MySQL ALTER TABLE statements |
The translated SQL statements all ready for execution. Statements that have been translated will have string key of the number, : and the original SQL, all other will have a numeric key.