*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Amf / Adobe / DbInspector.php
blob5157eb7fec3b894ca42005cc6f0bdd789c2fe53f
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Amf
17 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: DbInspector.php 16971 2009-07-22 18:05:45Z mikaelkael $
22 /**
23 * This class implements authentication against XML file with roles for Flex Builder.
25 * @package Zend_Amf
26 * @subpackage Adobe
27 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
28 * @license http://framework.zend.com/license/new-bsd New BSD License
30 class Zend_Amf_Adobe_DbInspector
33 /**
34 * Connect to the database
36 * @param string $dbType Database adapter type for Zend_Db
37 * @param array|object $dbDescription Adapter-specific connection settings
38 * @return Zend_Db_Adapter_Abstract
39 * @see Zend_Db::factory()
41 protected function _connect($dbType, $dbDescription)
43 if(is_object($dbDescription)) {
44 $dbDescription = get_object_vars($dbDescription);
46 return Zend_Db::factory($dbType, $dbDescription);
49 /**
50 * Describe database object.
52 * Usage example:
53 * $inspector->describeTable('Pdo_Mysql',
54 * array(
55 * 'host' => '127.0.0.1',
56 * 'username' => 'webuser',
57 * 'password' => 'xxxxxxxx',
58 * 'dbname' => 'test'
59 * ),
60 * 'mytable'
61 * );
63 * @param string $dbType Database adapter type for Zend_Db
64 * @param array|object $dbDescription Adapter-specific connection settings
65 * @param string $tableName Table name
66 * @return array Table description
67 * @see Zend_Db::describeTable()
68 * @see Zend_Db::factory()
70 public function describeTable($dbType, $dbDescription, $tableName)
72 $db = $this->_connect($dbType, $dbDescription);
73 return $db->describeTable($tableName);
76 /**
77 * Test database connection
79 * @param string $dbType Database adapter type for Zend_Db
80 * @param array|object $dbDescription Adapter-specific connection settings
81 * @return bool
82 * @see Zend_Db::factory()
84 public function connect($dbType, $dbDescription)
86 $db = $this->_connect($dbType, $dbDescription);
87 $db->listTables();
88 return true;
91 /**
92 * Get the list of database tables
94 * @param string $dbType Database adapter type for Zend_Db
95 * @param array|object $dbDescription Adapter-specific connection settings
96 * @return array List of the tables
98 public function getTables($dbType, $dbDescription)
100 $db = $this->_connect($dbType, $dbDescription);
101 return $db->listTables();