]> git.llucax.com Git - mecon/samurai.git/blob - sistema/www/include/lib/samurai/Samurai_DB.php
Se empieza a mover a la nueva estructura de directorios.
[mecon/samurai.git] / sistema / www / include / lib / samurai / Samurai_DB.php
1 <?php
2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +----------------------------------------------------------------------+
4 // | PHP Version 4                                                        |
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2003 The PHP Group                                |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license,      |
9 // | that is bundled with this package in the file LICENSE, and is        |
10 // | available at through the world-wide-web at                           |
11 // | http://www.php.net/license/2_02.txt.                                 |
12 // | If you did not receive a copy of the PHP license and are unable to   |
13 // | obtain it through the world-wide-web, please send a note to          |
14 // | license@php.net so we can mail you a copy immediately.               |
15 // +----------------------------------------------------------------------+
16 // | Created: Tue May 27 12:16:12 2003
17 // | Author:  Martin Marrese - Myrna Degano <mmarre@mecon.gov.ar - mdegan@mecon.gov.ar>
18 // +----------------------------------------------------------------------+
19 //
20 // $Id$
21 // $Author$
22 // $URL$
23 // $Date$
24 // $Rev$
25 //
26
27 #require_once 'PEAR.php';
28
29
30 // +X2C includes
31 require_once 'DB.php';
32 // ~X2C
33
34 // +X2C Class 265 :Samurai_DB
35 /**
36  * Manejo interno de las bases de datos.
37  *
38  * @access public
39  */
40 class Samurai_DB extends DB {
41     // ~X2C
42
43     // +X2C Operation 269
44     /**
45      * Realiza la conexion con la base de datos.
46      *
47      * @return DB
48      *
49      * @access public
50      */
51     function connect() // ~X2C
52     {
53         $conf = include 'configuracion.php';
54
55         $dsn = $conf['db_type'].'://'.$conf['db_user'].':'.$conf['db_pass'].'@'.$conf['db_host'].'/'.$conf['db_name'];
56
57         $db = DB::connect($dsn,true);
58         if (DB::isError($db)) {
59             die ($db->getMessage());
60         }
61         return $db;
62     }
63     // -X2C
64
65 } // -X2C Class :Samurai_DB
66
67 ?>