lithium\data\source\database\adapter\Sqlite3::enabled PHP Метод

enabled() публичный статический Метод

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'`.
Результат boolean Returns `true` if the particular feature (or if Sqlite) support is enabled, otherwise `false`.
    public static function enabled($feature = null)
    {
        if (!$feature) {
            return extension_loaded('pdo_sqlite');
        }
        $features = array('arrays' => false, 'transactions' => false, 'booleans' => true, 'schema' => true, 'relationships' => true, 'sources' => true);
        return isset($features[$feature]) ? $features[$feature] : null;
    }

Usage Example

Пример #1
0
 public function testEnabledFeatures()
 {
     $supported = array('booleans', 'schema', 'relationships', 'sources');
     $notSupported = array('arrays', 'transactions');
     foreach ($supported as $feature) {
         $this->assertTrue(Sqlite3::enabled($feature));
     }
     foreach ($notSupported as $feature) {
         $this->assertFalse(Sqlite3::enabled($feature));
     }
     $this->assertNull(Sqlite3::enabled('unexisting'));
 }
All Usage Examples Of lithium\data\source\database\adapter\Sqlite3::enabled