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.
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 $
23 * This class implements authentication against XML file with roles for Flex Builder.
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
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);
50 * Describe database object.
53 * $inspector->describeTable('Pdo_Mysql',
55 * 'host' => '127.0.0.1',
56 * 'username' => 'webuser',
57 * 'password' => 'xxxxxxxx',
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);
77 * Test database connection
79 * @param string $dbType Database adapter type for Zend_Db
80 * @param array|object $dbDescription Adapter-specific connection settings
82 * @see Zend_Db::factory()
84 public function connect($dbType, $dbDescription)
86 $db = $this->_connect($dbType, $dbDescription);
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();