lithium\data\source\database\adapter\PostgreSql::enabled PHP Method

enabled() public static method

Check for required PHP extension, or supported database feature.
public static enabled ( string $feature = null ) : boolean
$feature string Test for support for a specific feature, i.e. `"transactions"` or `"arrays"`.
return boolean Returns `true` if the particular feature (or if PostgreSQL) support is enabled, otherwise `false`.
    public static function enabled($feature = null)
    {
        if (!$feature) {
            return extension_loaded('pdo_pgsql');
        }
        $features = array('arrays' => false, 'transactions' => true, 'booleans' => true, 'schema' => true, 'relationships' => true, 'sources' => true);
        return isset($features[$feature]) ? $features[$feature] : null;
    }

Usage Example

Ejemplo n.º 1
0
 public function testEnabledFeatures()
 {
     $supported = array('booleans', 'schema', 'relationships', 'sources', 'transactions');
     $notSupported = array('arrays');
     foreach ($supported as $feature) {
         $this->assertTrue(PostgreSql::enabled($feature));
     }
     foreach ($notSupported as $feature) {
         $this->assertFalse(PostgreSql::enabled($feature));
     }
     $this->assertNull(PostgreSql::enabled('unexisting'));
 }
All Usage Examples Of lithium\data\source\database\adapter\PostgreSql::enabled