summaryrefslogtreecommitdiff
path: root/trunk/reprap/web/james-bom/MDB2/MDB2-2.4.1/tests/MDB2_Connect_Test.php
blob: 0f12339af3fea3fc56a8a14a599cc5f70303b1e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
// {{{ MDB2_Connect_Test
/**
 * This is just a dummy class to perform the tests.
 */
class MDB2_Connect_Test
{
    var $_dsn;
    var $dbc;

    // {{{ constructor php5 valid
    /**
     * Straightforward? The constructor
     */
    function __construct()
    {
        require_once 'MDB2.php';
        require_once 'config.php';

        $this->_dsn = array(
                'phptype'  => DSN_PHPTYPE,
                'username' => DSN_USERNAME,
                'password' => DSN_PASSWORD,
                'hostspec' => DSN_HOSTNAME,
                'database' => DSN_DATABASE,
        );

    }
    // }}}
    // {{{ PHP4 constructor..
    function MDB2_Connect_Test()
    {
        $this->__construct($connect);
    }
    // }}}
    // {{{ connect
    function connect()
    {
        // connect to database
        $options = array(
            'portability' => (MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL),
        );

        $this->dbc =& MDB2::singleton($this->_dsn, $options);
        if (PEAR::isError($this->dbc)) {
            return $this->dbc;
        }
    }
    // }}}
}
// }}}
?>