lithium\data\source\database\adapter\PostgreSql::enabled PHP Méthode

enabled() public static méthode

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"`.
Résultat 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

 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