Source for file SC_DB_DBFactory_PGSQL.php
Documentation is available at SC_DB_DBFactory_PGSQL.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(CLASS_PATH .
"db/SC_DB_DBFactory.php");
* PostgreSQL 固有の処理をするクラス.
* 必ず SC_DB_DBFactory クラスを経由してインスタンス化する.
* また, SC_DB_DBFactory クラスの関数を必ずオーバーライドしている必要がある.
* @author LOCKON CO.,LTD.
* @version $Id:SC_DB_DBFactory_PGSQL.php 15532 2007-08-31 14:39:46Z nanasess $
* @param string $dsn データソース名
* @return string データベースのバージョン
$val =
$objQuery->getOne("select version()");
$arrLine =
split(" " , $val);
return $arrLine[0] .
" " .
$arrLine[1];
* DB_TYPE が PostgreSQL の場合は何もしない
* @param string $sql SQL 文
* @return string MySQL 用に置換した SQL 文
* テーブルの存在チェックを行う SQL 文を返す.
* @return string テーブルの存在チェックを行う SQL 文
return " SELECT relname "
.
" WHERE (relkind = 'r' OR relkind = 'v') "
* @param string $index_name インデックス名
* @param string $table_name テーブル名(PostgreSQL では使用しない)
* @return array インデックスの検索結果の配列
$objQuery =
new SC_Query("", true, true);
return $objQuery->getAll("SELECT relname FROM pg_class WHERE relname = ?",
* @param string $index_name インデックス名
* @param string $table_name テーブル名
* @param string $col_name カラム名
* @param integer $length 作成するインデックスのバイト長
$objQuery =
new SC_Query($dsn, true, true);
$objQuery->query("CREATE INDEX ? ON ? (?)", array($index_name, $table_name, $col_name));
* @param string $table_name テーブル名
* @return array テーブルのカラム一覧の配列
$sql =
" SELECT a.attname "
.
" FROM pg_class c, pg_attribute a "
.
" AND c.oid=a.attrelid "
.
" LIKE '........pg.dropped.%........' "
$arrColList =
$objQuery->getAll($sql, array($table_name));
return $arrColList["attname"];
* @param string $expression 検索文字列
$sql =
" SELECT c.relname AS name, "
.
" WHEN 'r' THEN 'table' "
.
" WHEN 'v' THEN 'view' END AS type "
.
" FROM pg_catalog.pg_class c "
.
"LEFT JOIN pg_catalog.pg_namespace n "
.
" ON n.oid = c.relnamespace "
.
" WHERE c.relkind IN ('r','v') "
.
" AND n.nspname NOT IN ('pg_catalog', 'pg_toast') "
.
" AND pg_catalog.pg_table_is_visible(c.oid) "
.
" AND c.relname LIKE ?"
$arrColList =
$objQuery->getAll($sql, array("%" .
$expression .
"%"));
$arrColList =
SC_Utils_Ex::sfswaparray($arrColList, false);
Documentation generated on Tue, 28 Apr 2009 18:13:15 +0900 by phpDocumentor 1.4.2