public static function get_driver_instance($type, $library, $external = false) {
        global $CFG;

        $classname = $type.'_'.$library.'_moodle_database';
        $libfile   = "$CFG->libdir/dml/$classname.php";

        if (!file_exists($libfile)) {
            return null;
        }

        require_once($libfile);
        return new $classname($external);
    }
public static function get_driver_instance($type, $library, $external = false) {
        global $CFG;

        $classname = $type.'_'.$library.'_moodle_database';
        $libfile   = "$CFG->libdir/dml/$classname.php";

        if (!file_exists($libfile)) {
            return null;
        }

        require_once($libfile);
        return new $classname($external);
    }
public static function get_driver_instance ( $ type , $ library , $ external = false ) { global $ CFG ; $ classname = $ type . '_' . $ library . '_moodle_database' ; $ libfile = "$CFG->libdir/dml/$classname.php" ; if ( ! file_exists ( $ libfile ) ) { return null ; } require_once ( $ libfile ) ; return new $ classname ( $ external ) ; }
Loads and returns a database instance with the specified type and library.

The loaded class is within lib/dml directory and of the form: $type.'_'.$library.'_moodle_database'

@param string $type Database driver's type. (eg: mysqli, pgsql, mssql, sqldrv, oci, etc.)
@param string $library Database driver's library (native, pdo, etc.)
@param bool $external True if this is an external database.
@return moodle_database driver object or null if error, for example of driver object see {@link mysqli_native_moodle_database}
Loads and returns a database instance with the specified type and library .