<html>
<head><title>PHP TEST</title></head>
<body>

<?php

require_once 'DB.php';

print('MySQLへの接続:<br>');

$dsn = 'mysqli://testuser:testuser@localhost/uriage';

$db = DB::connect($dsn);
if (PEAR::isError($db)) {
    die($db->getMessage());
}

hantei($db);

$db->disconnect();

print('<br>PostgreSQLへの接続:<br>');

$dsn = 'pgsql://pguser:pguser@localhost/uriage';

$db = DB::connect($dsn);
if (PEAR::isError($db)) {
    die($db->getMessage());
}

hantei($db);

$db->disconnect();

print('<br>SQLiteへの接続:<br>');

$dsn = array(
    'phptype'  => 'sqlite',
    'database' => 'D:\Apache Group\Apache2\htdocs\sqlite\test.db',
);

$db = DB::connect($dsn);
if (PEAR::isError($db)) {
    die($db->getMessage());
}

hantei($db);

$db->disconnect();


function hantei($db){
    if ($db->provides('prepare')) {
        print('プリペアドステートメント:利用可能<br>');
    }else{
        print('プリペアドステートメント:不可<br>');
    }

    if ($db->provides('pconnect')) {
        print('持続的接続:利用可能<br>');
    }else{
        print('持続的接続:不可<br>');
    }

    if ($db->provides('transactions')) {
        print('トランザクション:利用可能<br>');
    }else{
        print('トランザクション:不可<br>');
    }

    if ($db->provides('limit')) {
        print('LIMIT:利用可能<br>');
    }else{
        print('LIMIT:不可<br>');
    }
}

?>

</body>
</html>