Example #1
0
 /**
  *  ロガーを取得する
  *
  *  @retrun  Cascade_Driver_Log  ロガー
  */
 public static function get_logger()
 {
     static $instance = NULL;
     // ロガーを取得する
     if ($instance == NULL) {
         $file_name = sprintf('%s.dat', date('Ymd'));
         $config = Cascade_System_Config::get(self::$log_section, self::$log_config);
         $instance = Cascade_Driver_Factory::getInstance(Cascade::DRIVER_LOG_FILE, $args = array($file_name, $config, $config['level']));
     }
     return $instance;
 }
Example #2
0
File: DSN.php Project: gree/cascade
 /**
  *  条件に一致するサーバ情報を取得する
  *
  *  @param   string  データベース種別
  *  @param   string  接続ホスト識別子
  *  @param   string  接続ホスト種別
  *  @return  array   条件にマッチするサーバー情報
  */
 protected static function get_server_info($dbsyntax, $identifier, $category)
 {
     // 設定情報を取得する
     static $cached_config = array();
     if (isset($cached_config[$dbsyntax]) === FALSE) {
         $tmp = Cascade_System_Config::get(self::CONFIG_SECTION);
         $tmp = isset($tmp[$dbsyntax]) ? $tmp[$dbsyntax] : $tmp['default'];
         include $tmp['path'];
         $cached_config[$dbsyntax] = ${$tmp}['var'];
     }
     $config = $cached_config[$dbsyntax];
     // 設定ファイルに定義されているかを確認
     if (isset($config[$identifier]) === FALSE) {
         $ex_msg = 'Undefined DB identifier {identifier} %s';
         $ex_msg = sprintf($ex_msg, $identifier);
         trigger_error($ex_msg, E_USER_ERROR);
         throw new Cascade_Exception_SystemException($ex_msg);
     }
     // defaultが設定されているか確認
     if (isset($config['default']) === FALSE) {
         $ex_msg = 'Undefined DB \'default\' identifier';
         trigger_error($ex_msg, E_USER_ERROR);
         throw new Cascade_Exception_SystemException($ex_msg);
     }
     $specified = $config[$identifier];
     $server_info = $config['default'];
     foreach ($specified as $key => $val) {
         $server_info[$key] = $val;
     }
     return $server_info;
 }
Example #3
0
File: SQL.php Project: gree/cascade
 /**
  *  入力値の確認処理
  *
  *  @param   mixed    入力値
  *  @return  boolean  TRUE:入力値が想定値
  */
 protected function validate_schema_ns($value)
 {
     try {
         if (NULL === ($schema = Cascade_System_Config::getSchema($value))) {
             $ex_msg = 'Undefined namespace of schema {namespace} %s';
             $ex_msg = sprintf($ex_msg, $value);
             throw new Cascade_Exception_Exception($ex_msg);
         }
     } catch (Exception $ex) {
         print sprintf('ERROR :: %s', $ex->getMessage()) . PHP_EOL . PHP_EOL;
         return FALSE;
     }
     return TRUE;
 }