7 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
9 * @package Magic3 Framework
10 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11 * @copyright Copyright 2006-2009 Magic3 Project.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: specificDb.php 1909 2009-05-21 03:14:52Z fishbone $
14 * @link http://www.magic3.org
16 require_once(M3_SYSTEM_INCLUDE_PATH . '/db/baseDb.php');
18 class specificDb extends BaseDb
20 protected $_dbName; // DB名
25 function __construct()
28 parent::__construct();
30 $this->_dbName = $this->getDbName();
35 * @param string $tableName テーブル名
36 * @param array $row 取得データ
37 * @return true=正常、false=異常
39 function getTableDataSize($tableName, &$row)
42 $dbType = $this->getDbType();
44 case M3_DB_TYPE_MYSQL: // MySQLの場合
45 $queryStr = 'SELECT DATA_LENGTH AS size FROM `information_schema`.`TABLES` ';
46 $queryStr .= 'WHERE `TABLE_SCHEMA` = ? ';
47 $queryStr .= 'AND TABLE_NAME = ?';
48 $ret = $this->selectRecord($queryStr, array($this->_dbName, $tableName), $row);
50 case M3_DB_TYPE_PGSQL: // PostgreSQLの場合
51 $queryStr = 'SELECT pg_relation_size(\'' . addslashes($tableName) . '\') AS size';
52 $ret = $this->selectRecord($queryStr, array(), $row);
60 * @param array $row 取得データ
61 * @return true=正常、false=異常
63 function getDbDataSize(&$row)
66 $dbType = $this->getDbType();
68 case M3_DB_TYPE_MYSQL: // MySQLの場合
69 /*$queryStr = 'SELECT DATA_LENGTH AS size FROM `information_schema`.`TABLES` ';
70 $queryStr .= 'WHERE `TABLE_SCHEMA` = ? ';
71 $queryStr .= 'AND TABLE_NAME = ?';
72 $ret = $this->selectRecord($queryStr, array($this->_dbName, $tableName), $row);*/
74 case M3_DB_TYPE_PGSQL: // PostgreSQLの場合
75 $queryStr = 'SELECT pg_database_size(\'' . addslashes($this->_dbName) . '\') AS size';
76 $ret = $this->selectRecord($queryStr, array(), $row);