source: branches/version-2_4/data/class/db/SC_DB_DBFactory.php @ 18734

Revision 18734, 4.1 KB checked in by nanasess, 14 years ago (diff)

Copyright の更新(#601)

  • Property charset set to UTF-8'
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24// {{{ requires
25require_once(CLASS_PATH . "db/dbfactory/SC_DB_DBFactory_MYSQL.php");
26require_once(CLASS_PATH . "db/dbfactory/SC_DB_DBFactory_PGSQL.php");
27
28/**
29 * DBに依存した処理を抽象化するファクトリークラス.
30 *
31 * @package DB
32 * @author LOCKON CO.,LTD.
33 * @version $Id:SC_DB_DBFactory.php 15532 2007-08-31 14:39:46Z nanasess $
34 */
35class SC_DB_DBFactory {
36
37    /**
38     * DB_TYPE に応じた DBFactory インスタンスを生成する.
39     *
40     * @return mixed DBFactory インスタンス
41     */
42    function getInstance() {
43        switch (DB_TYPE) {
44        case "mysql":
45            return new SC_DB_DBFactory_MYSQL();
46            break;
47
48        case "pgsql":
49            return new SC_DB_DBFactory_PGSQL();
50            break;
51
52        default:
53            return new SC_DB_DBFactory();
54        }
55    }
56
57    /**
58     * データソース名を取得する.
59     *
60     * 引数 $dsn が空の場合は, DEFAULT_DSN の値を返す.
61     * DEFAULT_DSN が未定義の場合は void となる.
62     * $dsn が空ではない場合は, $dsn の値を返す.
63     *
64     * @param string $dsn データソース名
65     * @return void|string データソース名
66     */
67    function getDSN($dsn = "") {
68        if(empty($dsn)) {
69            if(defined('DEFAULT_DSN')) {
70                $dsn = DEFAULT_DSN;
71            } else {
72                return "";
73            }
74        }
75        return $dsn;
76    }
77
78    /**
79     * DBのバージョンを取得する.
80     *
81     * @param string $dsn データソース名
82     * @return string データベースのバージョン
83     */
84    function sfGetDBVersion($dsn = "") { return null; }
85
86    /**
87     * MySQL 用の SQL 文に変更する.
88     *
89     * @param string $sql SQL 文
90     * @return string MySQL 用に置換した SQL 文
91     */
92    function sfChangeMySQL($sql) { return null; }
93
94    /**
95     * テーブルの存在チェックを行う SQL 文を返す.
96     *
97     * @return string テーブルの存在チェックを行う SQL 文
98     */
99    function getTableExistsSql() { return null; }
100
101    /**
102     * インデックスの検索結果を配列で返す.
103     *
104     * @param string $index_name インデックス名
105     * @param string $table_name テーブル名
106     * @return array インデックスの検索結果の配列
107     */
108    function getTableIndex($index_name, $table_name = "") { return array(); }
109
110    /**
111     * インデックスを作成する.
112     *
113     * @param string $index_name インデックス名
114     * @param string $table_name テーブル名
115     * @param string $col_name カラム名
116     * @param integer $length 作成するインデックスのバイト長
117     * @return void
118     */
119    function createTableIndex($index_name, $table_name, $col_name, $length = 0) {}
120
121    /**
122     * テーブルのカラム一覧を取得する.
123     *
124     * @param string $table_name テーブル名
125     * @return array テーブルのカラム一覧の配列
126     */
127    function sfGetColumnList($table_name) { return array(); }
128
129    /**
130     * テーブルを検索する.
131     *
132     * 引数に部分一致するテーブル名を配列で返す.
133     *
134     * @param string $expression 検索文字列
135     * @return array テーブル名の配列
136     */
137    function findTableNames($expression = "") { return array(); }
138}
139?>
Note: See TracBrowser for help on using the repository browser.