< DATE: Setting Column Type   (Previous) Table of Contents (Next)   DATE: Formatting >

DATE: Getting Column Type

/**
 * Returns the SQL keyword for DATE data types in CREATE TABLE statements
 *
 * @return  string   the query fragment your DBMS needs
 */
function getDateType() {
    return $this->DateType;
}

require 'connect.inc';

$query = 'CREATE TABLE xyz (d ' . $p->getDateType() . ')';
echo $query;
$db->query($query);
$db->query('DROP TABLE xyz ' . $p->getDropRestrict());
mssql
CREATE TABLE xyz (d DATETIME )
pgsql
CREATE TABLE xyz (d DATE )