DB
[ class tree: DB ] [ index: DB ] [ all elements ]

Source for file SC_DB_DBFactory.php

Documentation is available at SC_DB_DBFactory.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2011 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
  25. require_once CLASS_REALDIR 'db/dbfactory/SC_DB_DBFactory_MYSQL.php';
  26. require_once CLASS_REALDIR '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.  */
  35. class SC_DB_DBFactory {
  36.  
  37.     /**
  38.      * DB_TYPE に応じた DBFactory インスタンスを生成する.
  39.      *
  40.      * @param string $db_type 任意のインスタンスを返したい場合は DB_TYPE 文字列を指定
  41.      * @return mixed DBFactory インスタンス
  42.      */
  43.     function getInstance($db_type DB_TYPE{
  44.         switch ($db_type{
  45.         case 'mysql':
  46.             return new SC_DB_DBFactory_MYSQL();
  47.             break;
  48.  
  49.         case 'pgsql':
  50.             return new SC_DB_DBFactory_PGSQL();
  51.             break;
  52.  
  53.         default:
  54.             return new SC_DB_DBFactory();
  55.         }
  56.     }
  57.  
  58.     /**
  59.      * データソース名を取得する.
  60.      *
  61.      * 引数 $dsn が空の場合は, DEFAULT_DSN の値を返す.
  62.      * DEFAULT_DSN が未定義の場合は void となる.
  63.      * $dsn が空ではない場合は, $dsn の値を返す.
  64.      *
  65.      * @param string $dsn データソース名
  66.      * @return void|stringデータソース名
  67.      */
  68.     function getDSN($dsn ""{
  69.         if(empty($dsn)) {
  70.             if(defined('DEFAULT_DSN')) {
  71.                 $dsn DEFAULT_DSN;
  72.             else {
  73.                 return "";
  74.             }
  75.         }
  76.         return $dsn;
  77.     }
  78.  
  79.     /**
  80.      * DBのバージョンを取得する.
  81.      *
  82.      * @param string $dsn データソース名
  83.      * @return string データベースのバージョン
  84.      */
  85.     function sfGetDBVersion($dsn ""return null}
  86.  
  87.     /**
  88.      * MySQL 用の SQL 文に変更する.
  89.      *
  90.      * @param string $sql SQL 文
  91.      * @return string MySQL 用に置換した SQL 文
  92.      */
  93.     function sfChangeMySQL($sqlreturn null}
  94.  
  95.     /**
  96.      * 昨日の売上高・売上件数を算出する SQL を返す.
  97.      *
  98.      * @param string $method SUM または COUNT
  99.      * @return string 昨日の売上高・売上件数を算出する SQL
  100.      */
  101.     function getOrderYesterdaySql($methodreturn null}
  102.  
  103.     /**
  104.      * 当月の売上高・売上件数を算出する SQL を返す.
  105.      *
  106.      * @param string $method SUM または COUNT
  107.      * @return string 当月の売上高・売上件数を算出する SQL
  108.      */
  109.     function getOrderMonthSql($methodreturn null}
  110.  
  111.     /**
  112.      * 昨日のレビュー書き込み件数を算出する SQL を返す.
  113.      *
  114.      * @return string 昨日のレビュー書き込み件数を算出する SQL
  115.      */
  116.     function getReviewYesterdaySql(return null}
  117.  
  118.     /**
  119.      * メール送信履歴の start_date の検索条件の SQL を返す.
  120.      *
  121.      * @return string 検索条件の SQL
  122.      */
  123.     function getSendHistoryWhereStartdateSql(return null}
  124.  
  125.     /**
  126.      * ダウンロード販売の検索条件の SQL を返す.
  127.      *
  128.      * @return string 検索条件の SQL
  129.      */
  130.     function getDownloadableDaysWhereSql(return null}
  131.  
  132.     /**
  133.      * 文字列連結を行う.
  134.      *
  135.      * @param array $columns 連結を行うカラム名
  136.      * @return string 連結後の SQL 文
  137.      */
  138.     function concatColumn($columnsreturn null}
  139.  
  140.     /**
  141.      * テーブルを検索する.
  142.      *
  143.      * 引数に部分一致するテーブル名を配列で返す.
  144.      *
  145.      * @deprecated SC_Query::listTables() を使用してください
  146.      * @param string $expression 検索文字列
  147.      * @return array テーブル名の配列
  148.      */
  149.     function findTableNames($expression ""return array()}
  150.  
  151.     /**
  152.      * インデックス作成の追加定義を取得する
  153.      *
  154.      * 引数に部分一致するテーブル名を配列で返す.
  155.      *
  156.      * @param string $table 対象テーブル名
  157.      * @param string $name 対象カラム名
  158.      * @return array インデックス設定情報配列
  159.      */
  160.     function sfGetCreateIndexDefinition($table$name$definitionreturn $definition}
  161.  
  162. }
  163. ?>

Documentation generated on Fri, 24 Feb 2012 14:02:31 +0900 by Seasoft