Index: branches/version-2_12-dev/data/class/SC_Query.php
===================================================================
--- branches/version-2_12-dev/data/class/SC_Query.php	(revision 21904)
+++ branches/version-2_12-dev/data/class/SC_Query.php	(revision 21914)
@@ -39,5 +39,6 @@
     var $order = '';
     var $force_run = false;
-    static $arrInstance = array();
+    /** シングルトン動作のためのインスタンスプール配列。キーは DSN の識別情報。 */
+    static $arrPoolInstance = array();
 
     /**
@@ -98,8 +99,8 @@
      * @return SC_Query シングルトンの SC_Query インスタンス
      */
-    function getSingletonInstance($dsn = '', $force_run = false, $new = false) {
-        $key_str = serialize($dsn);
-        if (!isset(SC_Query_Ex::$arrInstance[$key_str])) {
-            SC_Query_Ex::$arrInstance[$key_str] =& new SC_Query_Ex($dsn, $force_run, $new);
+    static function getSingletonInstance($dsn = '', $force_run = false, $new = false) {
+        $objThis = SC_Query_Ex::getPoolInstance($dsn);
+        if (is_null($objThis)) {
+            $objThis = SC_Query_Ex::setPoolInstance(new SC_Query_Ex($dsn, $force_run, $new), $dsn);
         }
         /*
@@ -109,5 +110,5 @@
          * 厳密な意味でのシングルトンではないが、パフォーマンス的に大差は無い。
          */
-        return clone SC_Query_Ex::$arrInstance[$key_str];
+        return clone $objThis;
     }
 
@@ -1106,3 +1107,28 @@
         GC_Utils_Ex::gfPrintLog($msg, DB_LOG_REALFILE);
     }
+
+    /**
+     * インスタンスをプールする
+     *
+     * @param SC_Query $objThis プールするインスタンス
+     * @param string $dsn データソース名
+     * @return SC_Query プールしたインスタンス
+     */
+    static function setPoolInstance(&$objThis, $dsn = '') {
+        $key_str = serialize($dsn);
+        return SC_Query_Ex::$arrPoolInstance[$key_str] = $objThis;
+    }
+
+    /**
+     * プールしているインスタンスを取得する
+     *
+     * @param string $dsn データソース名
+     * @return SC_Query|null
+     */
+    static function getPoolInstance($dsn = '') {
+        $key_str = serialize($dsn);
+        if (isset(SC_Query_Ex::$arrPoolInstance[$key_str])) {
+            return SC_Query_Ex::$arrPoolInstance[$key_str];
+        }
+    }
 }
