source/Core/DatabaseProvider.php
public static function getDb($fetchMode = \OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_NUM)
    {
        if (null === static::$db) {
            $databaseFactory = static::getInstance();
            static::$db = $databaseFactory->createDatabase();

            /** Post connect actions will be taken only once per connection */
            $databaseFactory->onPostConnect();
        }

        /** The following actions be taken on each call to getDb */
        static::$db->setFetchMode($fetchMode);

        return static::$db;
    }
public static function getDb($fetchMode = \OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_NUM)
    {
        if (null === static::$db) {
            $databaseFactory = static::getInstance();
            static::$db = $databaseFactory->createDatabase();

            /** Post connect actions will be taken only once per connection */
            $databaseFactory->onPostConnect();
        }

        /** The following actions be taken on each call to getDb */
        static::$db->setFetchMode($fetchMode);

        return static::$db;
    }
public static function getDb ( $ fetchMode = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_NUM ) { if ( null === static :: $ db ) { $ databaseFactory = static :: getInstance ( ) ; static :: $ db = $ databaseFactory -> createDatabase ( ) ; /** Post connect actions will be taken only once per connection */ $ databaseFactory -> onPostConnect ( ) ; } /** The following actions be taken on each call to getDb */ static :: $ db -> setFetchMode ( $ fetchMode ) ; return static :: $ db ; }
Return the database connection instance as a singleton.

@param int $fetchMode The fetch mode. Default is numeric (0).

@throws DatabaseConnectionException Error while initiating connection to DB.

@return DatabaseInterface
Return the database connection instance as a singleton .