当前位置: 首页>>代码示例>>PHP>>正文


PHP R::freeze方法代码示例

本文整理汇总了PHP中R::freeze方法的典型用法代码示例。如果您正苦于以下问题:PHP R::freeze方法的具体用法?PHP R::freeze怎么用?PHP R::freeze使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在R的用法示例。


在下文中一共展示了R::freeze方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: freeze

 public static function freeze($tf = true)
 {
     if (!$tf) {
         throw new NotSupportedException("We are getting rid of no-freeze. Talk to @Shoaibi or @Jason");
     }
     parent::freeze($tf);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:7,代码来源:ZurmoRedBean.php

示例2: _log_focus

function _log_focus($openid, $operation, $user_info = NULL)
{
    R::addDatabase('wechat_csc', $GLOBALS['db_wechat_csc_url'], $GLOBALS['db_wechat_csc_user'], $GLOBALS['db_wechat_csc_pass']);
    R::selectDatabase('wechat_csc');
    if (!R::testConnection()) {
        exit('DB failed' . PHP_EOL);
    }
    R::freeze(true);
    try {
        $user = R::getRedBean()->dispense('wxcsc_focus');
        $user->openid = $openid;
        $user->operation = $operation;
        if ($operation == 'focus' && $user_info != NULL) {
            $user->nickname = $user_info['nickname'];
            $user->sex = $user_info['sex'];
            $user->language = $user_info['language'];
            $user->city = $user_info['city'];
            $user->province = $user_info['province'];
            $user->country = $user_info['country'];
        }
        $user_id = R::store($user);
    } catch (Exception $e) {
        header('Content-type:text/json;charset=utf-8');
        echo json_encode(['result' => 'failed', 'error' => 'db error wechat', 'details' => $e->getMessage()]);
        die;
    }
    R::close();
}
开发者ID:adexbn,项目名称:gds_wechat,代码行数:28,代码来源:api_csc.php

示例3: testChill

 /**
  * Test Chill mode.
  * 
  * @return void
  */
 public function testChill()
 {
     $bean = R::dispense('bean');
     $bean->col1 = '1';
     $bean->col2 = '2';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 3);
     $bean->col3 = '3';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 4);
     R::freeze(array('umbrella'));
     $bean->col4 = '4';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 5);
     R::freeze(array('bean'));
     $bean->col5 = '5';
     try {
         R::store($bean);
         fail();
     } catch (Exception $e) {
         pass();
     }
     asrt(count(R::$writer->getColumns('bean')), 5);
     R::freeze(array());
     $bean->col5 = '5';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 6);
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:33,代码来源:Chill.php

示例4: setup

 public static function setup($db_type = "pgsql", $host = "ec2-54-83-204-228.compute-1.amazonaws.com", $db_name = "d31sdik2uip6li", $username = "yghxnskjzqrpvp", $password = "EFOJeYOjNRTXXEBSbllNee1oqV")
 {
     if (!isset(self::$db)) {
         self::$db = R::setup($db_type . ":host=" . $host . "; dbname=" . $db_name, $username, $password);
         R::freeze();
     }
     return self::$db;
 }
开发者ID:33windowlicker,项目名称:web-lmul-rangers,代码行数:8,代码来源:Database.php

示例5: __construct

 public function __construct()
 {
     //        parent::__construct(DB_TYPE . ':host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
     //        R::setup('mysql:host=localhost;dbname=orm', 'root', 'mysqladmin');
     R::setup(DB_TYPE . ':host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
     R::freeze(TRUE);
     //R::startLogging(); //start logging
     //        R::debug(TRUE);//turns debugging ON
 }
开发者ID:xinerd,项目名称:SP_ROI,代码行数:9,代码来源:Database.php

示例6: __connect

 /**
  * Connect to database, for more information about redbean, check http://redbeanphp.com/
  * @return RedBean_ToolBox
  */
 protected function __connect()
 {
     if (!is_object(R::$toolbox)) {
         R::setup('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASSWORD, false);
         R::freeze(true);
         R::setStrictTyping(false);
         //$this->toolbox = RedBean_Setup::kickstart('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASSWORD, false);
     }
     return R::$toolbox;
 }
开发者ID:Artgorae,项目名称:wp-artgorae,代码行数:14,代码来源:ig-db-model.php

示例7: setup

 public static function setup()
 {
     self::init();
     self::$dbh = new PDO('mysql:host=' . self::$server . ';dbname=' . self::$databasename . ';', self::$username, self::$password);
     self::$dbh->query('SET NAMES utf8');
     R::setup(self::$dbh);
     R::debug(true, 1);
     R::freeze(true);
     // self::$logsrv = new SystemlogsService();
     self::$queryLogger = R::getDatabaseAdapter()->getDatabase()->getLogger();
 }
开发者ID:limweb,项目名称:webappservice,代码行数:11,代码来源:Pdoconfig.php

示例8: createService

 /**
  * @param ServiceLocatorInterface $serviceLocator
  * @return R
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $rjhRedbeanService = new R();
     $config = $serviceLocator->get('config');
     $rjhRedbeanConfig = $config['rjhredbean'];
     $connection = $rjhRedbeanConfig['connection'];
     $dsn = $connection['dsn'];
     $user = $connection['user'];
     $password = $connection['password'];
     $rjhRedbeanService->setup($dsn, $user, $password);
     $rjhRedbeanService->freeze($rjhRedbeanConfig['freeze']);
     $rjhRedbeanService->debug($rjhRedbeanConfig['debug']);
     return $rjhRedbeanService;
 }
开发者ID:richardjh,项目名称:rjhredbean,代码行数:18,代码来源:RjhRedbeanServiceFactory.php

示例9: connect

 /**
  * setup a Redbean instance from CosCMS
  */
 public static function connect()
 {
     static $connected = null;
     if (!$connected) {
         $url = conf::getMainIni('url');
         $username = conf::getMainIni('username');
         $password = conf::getMainIni('password');
         R::setup($url, $username, $password);
         $freeze = conf::getMainIni('rb_freeze');
         if ($freeze == 1) {
             R::freeze(true);
         }
         $connected = true;
     }
 }
开发者ID:gpawlik,项目名称:suited-php-classes,代码行数:18,代码来源:rb.php

示例10: setupRedBean

 public static function setupRedBean()
 {
     try {
         if (!self::$_redBeanInitialized) {
             self::$_redBeanInitialized = true;
             R::setup(Config::get('database_dsn'), Config::get('database_user'), Config::get('database_password'));
             R::freeze(true);
             R::exec('SET NAMES utf8');
             define('REDBEAN_MODEL_PREFIX', '\\Sop\\Model\\');
         }
     } catch (\Exception $e) {
         \Sop\Log::error(__FILE__, __LINE__, 'Failed to setup database connection');
         throw $e;
     }
 }
开发者ID:Yusuke-KOMIYAMA,项目名称:sop,代码行数:15,代码来源:Database.php

示例11: testNuke

 /**
  * Nuclear test suite.
  * 
  * @return void
  */
 public function testNuke()
 {
     $bean = R::dispense('bean');
     R::store($bean);
     asrt(count(R::$writer->getTables()), 1);
     R::nuke();
     asrt(count(R::$writer->getTables()), 0);
     $bean = R::dispense('bean');
     R::store($bean);
     asrt(count(R::$writer->getTables()), 1);
     R::freeze();
     R::nuke();
     // No effect
     asrt(count(R::$writer->getTables()), 1);
     R::freeze(FALSE);
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:21,代码来源:Nuke.php

示例12: testBatch

 /**
  * Begin testing.
  * This method runs the actual test pack.
  *
  * @return void
  */
 public function testBatch()
 {
     $toolbox = R::$toolbox;
     $adapter = $toolbox->getDatabaseAdapter();
     $writer = $toolbox->getWriter();
     $redbean = $toolbox->getRedBean();
     $pdo = $adapter->getDatabase();
     $page = $redbean->dispense("page");
     $page->name = "page no. 1";
     $page->rating = 1;
     $id1 = $redbean->store($page);
     $page = $redbean->dispense("page");
     $page->name = "page no. 2";
     $id2 = $redbean->store($page);
     $batch = $redbean->batch("page", array($id1, $id2));
     asrt(count($batch), 2);
     asrt($batch[$id1]->getMeta("type"), "page");
     asrt($batch[$id2]->getMeta("type"), "page");
     asrt((int) $batch[$id1]->id, $id1);
     asrt((int) $batch[$id2]->id, $id2);
     $book = $redbean->dispense("book");
     $book->name = "book 1";
     $redbean->store($book);
     $book = $redbean->dispense("book");
     $book->name = "book 2";
     $redbean->store($book);
     $book = $redbean->dispense("book");
     $book->name = "book 3";
     $redbean->store($book);
     $books = $redbean->batch("book", $adapter->getCol("SELECT id FROM book"));
     asrt(count($books), 3);
     $a = $redbean->batch('book', 9919);
     asrt(is_array($a), TRUE);
     asrt(count($a), 0);
     $a = $redbean->batch('triangle', 1);
     asrt(is_array($a), TRUE);
     asrt(count($a), 0);
     R::freeze(TRUE);
     $a = $redbean->batch('book', 9919);
     asrt(is_array($a), TRUE);
     asrt(count($a), 0);
     $a = $redbean->batch('triangle', 1);
     asrt(is_array($a), TRUE);
     asrt(count($a), 0);
     R::freeze(FALSE);
     asrt(R::wipe('spaghettimonster'), FALSE);
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:53,代码来源:Batch.php

示例13: saveMysql

function saveMysql($node, $nodeName)
{
    try {
        $record = R::dispense(strtolower($nodeName));
        $properties = $node["n"]->getProperties();
        foreach ($properties as $key => $property) {
            if ($key != "wkt") {
                $record[$key] = $property;
            }
            R::store($record);
        }
        R::freeze(TRUE);
    } catch (Exception $e) {
        echo $e;
        print_r($properties);
        R::freeze(FALSE);
        saveMysql($node, $nodeName);
    }
}
开发者ID:CHAIUganda,项目名称:Neo4j-MySQL-Migration-Script,代码行数:19,代码来源:index.php

示例14: testCountAndWipe

 /**
  * Test count and wipe.
  * 
  * @return void
  */
 public function testCountAndWipe()
 {
     testpack("Test count and wipe");
     $page = R::dispense("page");
     $page->name = "ABC";
     R::store($page);
     $n1 = R::count("page");
     $page = R::dispense("page");
     $page->name = "DEF";
     R::store($page);
     $n2 = R::count("page");
     asrt($n1 + 1, $n2);
     R::wipe("page");
     asrt(R::count("page"), 0);
     asrt(R::$redbean->count("page"), 0);
     asrt(R::$redbean->count("kazoo"), 0);
     // non existing table
     R::freeze(TRUE);
     asrt(R::$redbean->count("kazoo"), 0);
     // non existing table
     R::freeze(FALSE);
     $page = R::dispense('page');
     $page->name = 'foo';
     R::store($page);
     $page = R::dispense('page');
     $page->name = 'bar';
     R::store($page);
     asrt(R::count('page', ' name = ? ', array('foo')), 1);
     // Now count something that does not exist, this should return 0. (just be polite)
     asrt(R::count('teapot', ' name = ? ', array('flying')), 0);
     asrt(R::count('teapot'), 0);
     $currentDriver = $this->currentlyActiveDriverID;
     // Some drivers don't support that many error codes.
     if ($currentDriver === 'mysql' || $currentDriver === 'postgres') {
         try {
             R::count('teaport', ' for tea ');
             fail();
         } catch (RedBean_Exception_SQL $e) {
             pass();
         }
     }
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:47,代码来源:Count.php

示例15: initialize_database

function initialize_database(){
	//http://forums.hostgator.com/mysql-password-hashing-php-5-2-t117816.html
	$cfg = lib('config')->db;
	
	switch($cfg['driver']){
		case 'mysql':
			R::setup('mysql:host='.$cfg['host'].';dbname='.$cfg['dbName'],$cfg['username'],$cfg['password']);
			break;
		case 'sqlite':
			$path = explode('/',str_replace('\\','/',__DIR__.'\\..\\..\\'.$cfg['path']));
			array_shift($path);
			$path = implode('/',$path);
			R::setup('sqlite:/'.$path);
			break;
	}
	//$this->prefix = $cfg['prefix'];
	
	if($cfg['frozen']==true){
		R::freeze(true);
	}
}
开发者ID:nirgavish,项目名称:Framework--Apex,代码行数:21,代码来源:R.php


注:本文中的R::freeze方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。