< TIMESTAMP: Formatting   (Previous) Table of Contents (Next)   TIMESTAMP: Executing System Setting >

TIMESTAMP: Setting System Setting

/**
 * Sets the named property according to which DBMS is in use
 *
 * @return boolean  true if successful.  Does die() if the DBMS is unkown.
 */
function setTimestampSettingQuery() {
    switch ($this->phptype . ':' . $this->dbsyntax) {
        case 'fbsql:fbsql':
        case 'ibase:firebird':
        case 'mysql:mysql':
        case 'mysqli:mysqli':
        case 'odbc:access':
        case 'odbc:db2':
        case 'sqlite:sqlite':
            $this->TimestampSettingQuery = '';
            break;
        case 'oci8:oci8':
            $this->TimestampSettingQuery = 'ALTER SESSION SET'
                    . " NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'";
            break;
        case 'pgsql:pgsql':
            $this->TimestampSettingQuery = "SET DATESTYLE = 'ISO'";
            break;
        case 'mssql:mssql':
        case 'sybase:sybase':
            $this->TimestampSettingQuery = 'SET DATEFORMAT ymd';
            break;
        default:
            $this->TimestampSettingQuery = false;
            die('unknown phptype/dbsyntax in setTimestampSettingQuery()');
    }
    return true;
}