public function getTitle()
 {
     if (!Cascade::isEmpty($this->page[$this->request]['title'])) {
         return $this->page[$this->request]['title'];
     }
     return $this->options['title'];
 }
示例#2
0
 /**
  *  コンストラクタ
  *
  *  @param  Cascade_DB_Criteria  データ抽出条件
  */
 public function __construct(Cascade_DB_Criteria $criteria)
 {
     parent::__construct();
     if ($criteria->df_name === NULL) {
         $ex_msg = 'Not found DataFormat Name in Criteria {criteria} %s';
         $ex_msg = sprintf($ex_msg, Cascade_System_Util::export($criteria, TRUE));
         throw new Cascade_Exception_DBException($ex_msg);
     }
     $this->data_format = Cascade::getDataFormat($criteria->df_name);
     $this->criteria = $criteria;
 }
示例#3
0
 public function test_get_all()
 {
     $session = Cascade::getAccessor(self::SCHEMA_NAME);
     $data_01 = $session->getAll();
     // -----------------------------
     $this->assertEquals(1, $data_01[1]['id']);
     $this->assertEquals(1, $data_01[1]['category']);
     $this->assertEquals('勇者の剣', $data_01[1]['name']);
     $this->assertEquals(1000, $data_01[1]['str']);
     $this->assertEquals(0, $data_01[1]['def']);
     // -----------------------------
     $this->assertEquals(2, $data_01[2]['id']);
     $this->assertEquals(2, $data_01[2]['category']);
     $this->assertEquals('勇者の盾', $data_01[2]['name']);
     $this->assertEquals(0, $data_01[2]['str']);
     $this->assertEquals(1000, $data_01[2]['def']);
 }
示例#4
0
 public function test_insert_failed_2()
 {
     $accessor = Cascade::getAccessor(self::SCHEMA_NAME);
     $stmt_name = 'insert';
     $object = new stdClass();
     $object->foo = 'bar';
     $object->hoge = 'fuga';
     $params = array('user_id' => $object, 'item_id' => 2, 'num' => null);
     try {
         $data_04 = $accessor->execute($stmt_name, $params, $hint = NULL);
         // exceition
     } catch (Cascade_Exception_DBException $exception) {
         $expected = "Invalid Z_TYPE of bind-value {z_type, value} object stdClass(\n    foo: bar,\n    hoge: fuga\n)";
         $this->assertSame($expected, $exception->getMessage());
         return;
     }
     $this->fail();
 }
示例#5
0
 public function test_to_execute_02()
 {
     $accessor = Cascade::getAccessor(self::SCHEMA_NAME);
     $stmt_name = 'inc_num';
     $params = array('user_id' => 200, 'item_id' => 5, 'diff_num' => 3);
     $data_01 = $accessor->execute($stmt_name, $params, $hint = NULL);
     $stmt_name = 'sum_num';
     $params = array('user_id' => 200);
     $data_02 = $accessor->toValue($stmt_name, $params, $hint = NULL, $use_master = TRUE);
     // -----------------------------
     $this->assertEquals(1, $data_01);
     $this->assertEquals(3, $data_02);
 }
示例#6
0
 public function test_inc_01()
 {
     $key = 564;
     $offset = 1;
     $accessor = Cascade::getAccessor(self::SCHEMA_NAME);
     $accessor->delete($key);
     // -----------------------------
     $accessor->add($key, 0);
     for ($i = 1; $i <= 100; $i++) {
         $data_01 = $accessor->increment($key, $offset);
         $this->assertEquals($data_01, $i * $offset);
     }
     // -----------------------------
     for ($i = 1; $i < 100; $i++) {
         $data_01 = $accessor->decrement($key, $offset);
         $this->assertEquals($data_01, 100 - $i * $offset);
     }
 }
示例#7
0
<?php

error_reporting(E_ALL ^ E_NOTICE);
require_once 'config.php';
require_once 'class/Cascade.class.php';
$Cascade = new Cascade($page, $options);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

    <head>

        <title><?php 
$Cascade->_getTitle();
?>
</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
		
		<meta name="keywords" content="<?php 
$Cascade->_getMeta('keywords');
?>
"/>
		<meta name="description" content="<?php 
$Cascade->_getMeta('description');
?>
"/>

        <link rel="stylesheet" type="text/css" href="style/nivo-slider.css"/> 	
示例#8
0
 public function test_create_db()
 {
     $accessor = Cascade::getAccessor(self::SCHEMA_NAME);
     $accessor->createDB();
 }
示例#9
0
 public function test_count_01()
 {
     $accessor = Cascade::getAccessor(self::SCHEMA_NAME);
     $data_01 = $accessor->count('staging');
     // -----------------------------
     $this->assertEquals(2, $data_01);
 }
示例#10
0
文件: Gateway.php 项目: gree/cascade
 /**
  *  インスタンスを生成する
  *
  *  @param   string                 スキーマ名
  *  @return  Cascade_DB_Gateway  インスタンス
  */
 public static function createInstance($schema_name)
 {
     // 基本情報の取得
     $data_format = Cascade::getDataFormat($schema_name);
     $facade = Cascade_Facade_Facade::getInstance($data_format);
     $class_name = Cascade_System_Schema::getGatewayClassName($schema_name);
     // インスタンス作成
     $instance = class_exists($class_name) ? new $class_name($facade, $schema_name) : new Cascade_Proxy_PassThroughGateway($facade, $schema_name);
     if ($instance instanceof Cascade_Proxy_Gateway === FALSE) {
         $ex_msg = 'Invalid a Instance of Gateway {class} %s';
         $ex_msg = sprintf($ex_msg, $class_name);
         throw new Cascade_Exception_Exception($ex_msg);
     }
     // 作成したインスタンスを返す
     return $instance;
 }